Files
pmgr/views/transactions/ledger.ctp
2009-05-28 05:49:03 +00:00

53 lines
1.3 KiB
PHP

<?php /* -*- mode:PHP -*- */ ?>
<div class="ledgers view">
<h2><?php __('Ledgers'); ?></h2>
<?php
foreach($ledgers AS $ledger) {
foreach ($ledger AS $tablename => $table) {
if (array_key_exists(0, $table)) {
// Horizontal table (multiple items)
$headers = array_keys($table[0]);
//$rows = array_map('array_values', $table);
$rows = array();
//echo("<PRE>table:\n"); print_r($table); echo("</PRE>\n");
foreach ($table as $row) {
//echo("<PRE>row:\n"); print_r($row); echo("</PRE>\n");
$rows[] = array_values($row);
}
}
else {
// Vertical table (one item)
$headers = array('Field', 'Value');
$rows = array();
foreach ($table as $col => $val) {
$rows[] = array($col, $val);
}
}
foreach($rows AS &$row) {
foreach ($row AS &$cell) {
if (is_array($cell))
$cell = "&lt;ARRAY&gt;";
}
}
//echo("<PRE>headers:\n"); print_r($headers); echo("</PRE>\n");
//echo("<PRE>rows:\n"); print_r($rows); echo("</PRE>\n");
?>
<table cellpadding="0" cellspacing="0">
<CAPTION><?php echo $tablename ?></CAPTION>
<?php
echo $html->tableHeaders($headers);
echo $html->tableCells($rows, null, array('class' => "altrow"));
?>
</table>
<?php
}
}
?>
</div>