git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@81 97e9348a-65ac-dc4b-aefc-98561f571b83
75 lines
2.5 KiB
PHP
75 lines
2.5 KiB
PHP
<?php /* -*- mode:PHP -*- */
|
|
|
|
if (isset($heading))
|
|
echo $heading;
|
|
elseif (!isset($caption))
|
|
echo '<h2>'.__('Contacts',true).'</h2>';
|
|
|
|
$headers = array_merge(array('ID', 'Last Name', 'First Name', 'Company'),
|
|
isset($contacts[0]['ContactsCustomer']) ? array('Type', 'Active') : array(),
|
|
array('Comment'));
|
|
|
|
foreach (array_intersect($headers, array('ID')) AS $k => $v) {
|
|
$column_class[$k] = 'id';
|
|
}
|
|
foreach (array_intersect($headers, array('Comment')) AS $k => $v) {
|
|
$column_class[$k] = 'comment';
|
|
}
|
|
|
|
if (isset($paginator)) {
|
|
echo $paginator->counter(array(
|
|
'format' => __('Page %page% of %pages%, showing %current% records (%start% - %end%) of %count% total', true)));
|
|
|
|
$headers = array_merge(array($paginator->sort('id'),
|
|
$paginator->sort('last_name'),
|
|
$paginator->sort('first_name'),
|
|
$paginator->sort('company_name')),
|
|
(isset($contacts[0]['ContactsCustomer'])
|
|
? array($paginator->sort('type'),
|
|
$paginator->sort('active'))
|
|
: array()),
|
|
array($paginator->sort('comment')));
|
|
}
|
|
|
|
$rows = array();
|
|
foreach ($contacts as $contact) {
|
|
if (isset($contact['Contact']))
|
|
$contact = $contact['Contact'];
|
|
|
|
$rows[] = array_merge(array($html->link($contact['id'],
|
|
array('controller' => 'contacts',
|
|
'action' => 'view',
|
|
$contact['id'])),
|
|
$html->link($contact['last_name'],
|
|
array('controller' => 'contacts',
|
|
'action' => 'view',
|
|
$contact['id'])),
|
|
$html->link($contact['first_name'],
|
|
array('controller' => 'contacts',
|
|
'action' => 'view',
|
|
$contact['id'])),
|
|
$contact['company_name']),
|
|
(isset($contact['ContactsCustomer'])
|
|
? array($contact['ContactsCustomer']['type'],
|
|
$contact['ContactsCustomer']['active'] ? 'Yes' : 'No',
|
|
$contact['ContactsCustomer']['comment'])
|
|
: array($contact['comment'])));
|
|
}
|
|
|
|
echo $this->element('table',
|
|
array('class' => 'item contact 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");
|
|
}
|