100, 'group' => 'Contact.id', 'order' => array('Contact.last_name' => 'ASC', 'Contact.first_name' => 'ASC')); var $sidemenu_links = array(array('name' => 'Contacts', 'header' => true), //array('name' => 'Current', 'url' => array('controller' => 'contacts', 'action' => 'current')), //array('name' => 'Past', 'url' => array('controller' => 'contacts', 'action' => 'past')), //array('name' => 'All Tenants', 'url' => array('controller' => 'contacts', 'action' => 'tenants')), array('name' => 'All Contacts', 'url' => array('controller' => 'contacts', 'action' => 'all')), ); /************************************************************************** ************************************************************************** ************************************************************************** * override: sideMenuLinks * - Generates controller specific links for the side menu */ function sideMenuLinks() { return array_merge(parent::sideMenuLinks(), $this->sidemenu_links); } /************************************************************************** ************************************************************************** ************************************************************************** * action: index * - Lists all contacts */ function index() { $this->all(); } /************************************************************************** ************************************************************************** ************************************************************************** * action: all * - Lists all contacts */ function all() { $title = 'All Contacts'; $this->set('title', $title); $this->set('heading', $title); $this->set('contacts', $this->paginate()); $this->render('index'); } /************************************************************************** ************************************************************************** ************************************************************************** * 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')); } $this->Contact->Behaviors->attach('Containable'); $this->Contact->contain (array(// Models 'ContactPhone', 'ContactEmail', 'ContactAddress', 'Customer') ); $contact = $this->Contact->read(null, $id); $this->Contact->Behaviors->detach('Containable'); // Prepare to render. $title = $contact['Contact']['display_name']; $this->set(compact('contact', 'title')); } }