END;
$template = " | | ";
$objStats = new clsStatList();
$objStats->Query_Item("SELECT * FROM ".GetTablePrefix()."StatItem WHERE AdminSummary=1");
$ItemCount = $objStats->NumItems();
$ItemsPerCol = ceil($ItemCount / 2);
$i = 0;
$col = 1;
$o = "";
while($i < $ItemsPerCol)
{
$s = $objStats->GetItemByIndex($i);
$o .= $s->ParseTemplateText($template);
$i++;
}
print $o;
print <<
END;
$o = "";
while($i<$ItemCount)
{
$s = $objStats->GetItemByIndex($i);
$o .= $s->ParseTemplateText($template);
$i++;
}
print $o;
// ---- prepare pending items list based on modules installed: begin -----
$m = GetModuleArray();
foreach($m as $key => $value)
{
$path = $pathtoroot.$value."admin/include/parser.php";
if( file_exists($path) ) include_once($path);
}
$modules = $objModules->GetModuleList();
$pending_source = $objModules->ExecuteFunction('GetModuleInfo', 'summary_pending');
// get total pending item count & merge them into one array
$all_pending = Array();
$pending_col_1 = '';
$pending_col_2 = '';
foreach($pending_source as $module_name => $pending_items)
{
foreach($pending_items as $p_item)
{
$all_pending[] = $p_item;
}
}
if( count($all_pending) % 2 ) $all_pending[] = 'empty';
$ItemCount = count($all_pending);
$ItemsPerCol = ceil($ItemCount / 2);
$i = 0;
while($i < $ItemCount)
{
// create cell content
$item_count = 0;
$col_type = ($i < $ItemsPerCol) ? 'l' : 'r';
$class = $col_type.'TDi';
// if last item then change class
if($i+1 == $ItemsPerCol)
$class = 'lTD';
elseif($i+1 == $ItemsPerCol*2)
$class = 'rTD';
//print_pre($all_pending[$i]);
$cell = is_array($all_pending[$i]) ? PendingCell($all_pending[$i], $class, $item_count) : ' | ';
if($col_type == 'l')
$pending_col_1 .= $cell;
elseif($col_type == 'r')
$pending_col_2 .= $cell;
$PendingTotal += $item_count;
//allocate it to row
$i++;
}
function PendingCell($params, $class, &$pending_count)
{
$list_name = getArrayValue($params, 'list_var_name');
$prefix_pos = strpos($list_name, ':');
if( $prefix_pos !== false)
{
global $application;
$prefix = substr($list_name, $prefix_pos+1, strlen($list_name) );
$table =& $application->getUnitOption($prefix, 'TableName');
$sql = 'SELECT COUNT(*) FROM %s WHERE Status = 2';
$pending_count = $application->DB->GetOne( sprintf($sql, $table) );
}
else
{
$pending_count = $GLOBALS[ $params['list_var_name'] ]->CountPending();
$params['link'] = 'javascript:'.$params['link'];
}
$o = ''."\n";
$o .= ''."\n";
$o .= ''."\n";
$o .= ' '."\n";
$o .= admin_language($params['phrase']);
$o .= ' ('.$pending_count.')'."\n";
$o .= ' | '."\n";
$o .= ' '."\n";
return $o;
}
// ---- prepare pending items list based on modules installed: end -----
print <<
END;
?> | |