Files
pmgr/views/elements/transactions.ctp

66 lines
2.1 KiB
PHP

<?php /* -*- mode:PHP -*- */
if (isset($heading))
echo $heading;
elseif (!isset($caption))
echo '<h2>'.__('Transactions',true).'</h2>';
$headers = array('Id', 'Timestamp', 'Comment');
$column_class = array();
foreach (array_intersect($headers, array('Comment')) AS $k => $v) {
$column_class[$k] = 'comment';
}
foreach (array_intersect($headers, array('Id')) AS $k => $v) {
$column_class[$k] = 'id';
}
if (isset($paginator)) {
echo $paginator->counter(array(
'format' => __('Page %page% of %pages%, showing %current% records (%start% - %end%) of %count% total', true)));
$headers = array($paginator->sort('id'),
$paginator->sort('customer_id'),
$paginator->sort('Timestamp', 'stamp'),
$paginator->sort('Through', 'through_date'),
$paginator->sort('Due', 'due_date'),
$paginator->sort('comment'));
}
$rows = array();
foreach ($transactions as $transaction) {
$customer = $transaction['Customer'];
if (isset($transaction['Transaction']))
$transaction = $transaction['Transaction'];
$rows[] = array($html->link('#'.$transaction['id'],
array('controller' => 'transactions',
'action' => 'view',
$transaction['id'])),
$html->link($customer['name'],
array('controller' => 'customers',
'action' => 'view',
$customer['id'])),
datefmt($transaction['stamp']),
datefmt($transaction['through_date']),
datefmt($transaction['due_date']),
$transaction['comment']);
}
echo $this->element('table',
array('class' => 'item transaction list',
'caption' => isset($caption) ? $caption : null,
'headers' => $headers,
'rows' => $rows,
'column_class' => $column_class));
if (isset($paginator)) {
echo('<div class="paging">' . "\n");
echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));
echo(' | ');
echo $paginator->numbers();
echo(' | ');
echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));
echo('</div>' . "\n");
}