Moved contacts onto jqgrid. Added 'name' and 'longname' formats.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@120 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -1,18 +1,8 @@
|
||||
<?php
|
||||
|
||||
class ContactsController extends AppController {
|
||||
var $paginate = array('limit' => 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')),
|
||||
);
|
||||
var $sidemenu_links = array();
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -28,27 +18,32 @@ class ContactsController extends AppController {
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: index
|
||||
* - Lists all contacts
|
||||
* action: index / all
|
||||
* - Generate a listing of contacts
|
||||
*/
|
||||
|
||||
function index() {
|
||||
$this->all();
|
||||
}
|
||||
function index() { $this->all(); }
|
||||
function all() { $this->jqGridView('All Contacts', 'all'); }
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: all
|
||||
* - Lists all contacts
|
||||
* virtuals: jqGridData
|
||||
* - With the application controller handling the jqGridData action,
|
||||
* these virtual functions ensure that the correct data is passed
|
||||
* to jqGrid.
|
||||
*/
|
||||
|
||||
function all() {
|
||||
$title = 'All Contacts';
|
||||
$this->set('title', $title); $this->set('heading', $title);
|
||||
$this->set('contacts', $this->paginate());
|
||||
$this->render('index');
|
||||
function jqGridDataOrder(&$params, $index, $direction) {
|
||||
$order = parent::jqGridDataOrder($params, $index, $direction);
|
||||
if ($index === 'Contact.last_name') {
|
||||
$order[] = 'Contact.first_name ' . $direction;
|
||||
}
|
||||
if ($index === 'Contact.first_name') {
|
||||
$order[] = 'Contact.last_name ' . $direction;
|
||||
}
|
||||
return $order;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user