sidemenu_links); } /************************************************************************** ************************************************************************** ************************************************************************** * action: index / all * - Generate a listing of contacts */ function index() { $this->all(); } function all() { $this->jqGridView('All Contacts', 'all'); } /************************************************************************** ************************************************************************** ************************************************************************** * virtuals: jqGridData * - With the application controller handling the jqGridData action, * these virtual functions ensure that the correct data is passed * to jqGrid. */ function jqGridDataOrder(&$params, &$model, $index, $direction) { $order = parent::jqGridDataOrder($params, $model, $index, $direction); if ($index === 'Contact.last_name') { $order[] = 'Contact.first_name ' . $direction; } if ($index === 'Contact.first_name') { $order[] = 'Contact.last_name ' . $direction; } return $order; } /************************************************************************** ************************************************************************** ************************************************************************** * action: view * - Displays information about a specific contact */ function view($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid Item.', true)); $this->redirect(array('action'=>'index')); } $contact = $this->Contact->find ('first', array ('contain' => array (// Models 'ContactPhone', 'ContactEmail', 'ContactAddress', 'Customer'), 'conditions' => array('Contact.id' => $id), )); // Prepare to render. $title = $contact['Contact']['display_name']; $this->set(compact('contact', 'title')); } }