'.__('Contacts',true).''; $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'], $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('
' . "\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('
' . "\n"); }