Added comment blocks and context specific side menu link items. Also tweaked the Page titles and headings for the table listings.
git-svn-id: file:///svn-source/pmgr/branches/initial_20090526@41 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -7,10 +7,64 @@ class ContactsController extends AppController {
|
||||
'order' => array('Contact.last_name' => 'ASC',
|
||||
'Contact.first_name' => 'ASC'));
|
||||
|
||||
function index() {
|
||||
$this->all();
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
$menu = parent::sideMenuLinks();
|
||||
//$menu[] = array('hr' => true);
|
||||
$menu[] = array('name' => 'Tenants', 'header' => true);
|
||||
$menu[] = array('name' => 'Current', 'url' => array('controller' => 'contacts', 'action' => 'current'));
|
||||
$menu[] = array('name' => 'Past', 'url' => array('controller' => 'contacts', 'action' => 'past'));
|
||||
$menu[] = array('name' => 'All Tenants', 'url' => array('controller' => 'contacts', 'action' => 'tenants'));
|
||||
$menu[] = array('name' => 'All Contacts', 'url' => array('controller' => 'contacts', 'action' => 'all'));
|
||||
|
||||
return $menu;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: index
|
||||
* - Lists all current tenants
|
||||
*/
|
||||
|
||||
function index() {
|
||||
$this->current();
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: past
|
||||
* - Lists all tenants, past and present
|
||||
*/
|
||||
|
||||
function tenants() {
|
||||
$this->Contact->recursive = 0;
|
||||
$this->Contact->bindModel(array('hasOne' => array('ContactsLease')),
|
||||
false);
|
||||
|
||||
$title = 'All Tenants';
|
||||
$this->set('title', $title); $this->set('heading', $title);
|
||||
$this->set('contacts', $this->paginate(array('ContactsLease.type != "ALTERNATE"')));
|
||||
$this->render('index');
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: current
|
||||
* - Lists all current tenants
|
||||
*/
|
||||
|
||||
function current() {
|
||||
$this->Contact->recursive = 0;
|
||||
$this->Contact->bindModel(array('hasOne' => array('ContactsLease',
|
||||
@@ -19,21 +73,62 @@ class ContactsController extends AppController {
|
||||
'conditions' => array('Lease.id = ContactsLease.lease_id')
|
||||
))),
|
||||
false);
|
||||
|
||||
|
||||
$title = 'Current Tenants';
|
||||
$this->set('title', $title); $this->set('heading', $title);
|
||||
$this->set('contacts', $this->paginate(array('Lease.close_date IS NULL',
|
||||
'ContactsLease.type != "ALTERNATE"')));
|
||||
$this->render('index');
|
||||
}
|
||||
|
||||
function all() {
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: past
|
||||
* - Lists all past tenants
|
||||
*/
|
||||
|
||||
function past() {
|
||||
$this->Contact->recursive = 0;
|
||||
$this->Contact->bindModel(array('hasOne' => array('ContactsLease')),
|
||||
$this->Contact->bindModel(array('hasOne' => array('ContactsLease',
|
||||
'Lease' => array(
|
||||
'foreignKey' => false,
|
||||
'conditions' => array('Lease.id = ContactsLease.lease_id')
|
||||
))),
|
||||
false);
|
||||
|
||||
$this->set('contacts', $this->paginate(array('ContactsLease.type != "ALTERNATE"')));
|
||||
$title = 'Past Tenants';
|
||||
$this->set('title', $title); $this->set('heading', $title);
|
||||
$this->set('contacts', $this->paginate(array('Lease.close_date IS NOT NULL',
|
||||
'ContactsLease.type != "ALTERNATE"')));
|
||||
$this->render('index');
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: all
|
||||
* - Lists all contacts, including non-tenants
|
||||
*/
|
||||
|
||||
function all() {
|
||||
$this->Contact->recursive = 0;
|
||||
$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));
|
||||
@@ -45,7 +140,9 @@ class ContactsController extends AppController {
|
||||
$this->Contact->Lease->Charge->ChargeType->unbindModel(array('hasMany' => array('Charge')));
|
||||
$this->Contact->Lease->Charge->Receipt->unbindModel(array('hasMany' => array('ChargesReceipt')));
|
||||
|
||||
$this->set('tenant', $this->Contact->read(null, $id));
|
||||
$contact = $this->Contact->read(null, $id);
|
||||
$title = $contact['Contact']['display_name'];
|
||||
$this->set(compact('contact', 'title'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user