Files
pmgr/site/views/elements/customers.ctp

52 lines
1.5 KiB
PHP

<?php /* -*- mode:PHP -*- */
if (isset($heading))
echo $heading;
else
echo '<h2>'.__('Customers',true).'</h2>';
$headers_manual = array('Id', 'Name', 'Comment');
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('name'),
$paginator->sort('comment'));
} else {
$headers = $headers_manual;
}
$rows = array();
foreach ($customers as $customer) {
if (isset($customer['Customer']))
$customer = $customer['Customer'];
$rows[] = array($html->link($customer['id'],
array('controller' => 'customers',
'action' => 'view',
$customer['id'])),
$html->link($customer['name'],
array('controller' => 'customers',
'action' => 'view',
$customer['id'])),
$customer['comment']);
}
echo $this->element('table',
array('class' => 'item customer list',
'caption' => isset($caption) ? $caption : null,
'headers' => $headers,
'rows' => $rows,
'column_class' => $headers_manual));
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");
}