Changed how sidemenu links work, so that order of execution doesn't have to control ordering of the list.
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@734 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -38,53 +38,158 @@ class AppController extends Controller {
|
||||
var $helpers = array('Html', 'Form', 'Javascript', 'Format', 'Time', 'Grid');
|
||||
var $components = array('DebugKit.Toolbar');
|
||||
|
||||
var $sidemenu_areas = array('SITE' => false, 'CONTROLLER' => false, 'ACTION' => false);
|
||||
var $admin_area = 2;
|
||||
var $dev_area = 3;
|
||||
|
||||
function __construct() {
|
||||
$this->params['dev'] = false;
|
||||
$this->params['admin'] = false;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
function sideMenuLinks() {
|
||||
// Stupid Cake... our constructor sets admin/dev,
|
||||
// but cake stomps it somewhere along the way
|
||||
// after constructing the CakeError controller.
|
||||
if ($this->name === 'CakeError') {
|
||||
$this->params['dev'] = false;
|
||||
$this->params['admin'] = false;
|
||||
}
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: sideMenuAreaVerify
|
||||
* - Verifies the validity of the sidemenu area/subarea/priority,
|
||||
* and ensures the class member is set to appropriately handle it.
|
||||
*/
|
||||
|
||||
$menu = array();
|
||||
$menu[] = array('name' => 'Common', 'header' => true);
|
||||
$menu[] = array('name' => 'Site Map', 'url' => array('controller' => 'maps', 'action' => 'view', 1));
|
||||
$menu[] = array('name' => 'Units', 'url' => array('controller' => 'units', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Leases', 'url' => array('controller' => 'leases', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Customers', 'url' => array('controller' => 'customers', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Deposits', 'url' => array('controller' => 'transactions', 'action' => 'deposit'));
|
||||
function sideMenuAreaVerify(&$area, $subarea, $priority = null) {
|
||||
$area = strtoupper($area);
|
||||
if (!array_key_exists($area, $this->sidemenu_areas))
|
||||
$this->INTERNAL_ERROR("Sidemenu link '{$area}': Unknown");
|
||||
|
||||
if ($area == 'SITE')
|
||||
$name = 'Common';
|
||||
elseif ($area == 'CONTROLLER')
|
||||
$name = Inflector::humanize($this->params['controller']);
|
||||
elseif ($area == 'ACTION')
|
||||
$name = Inflector::humanize(Inflector::singularize($this->params['controller']));
|
||||
|
||||
$subname = $name;
|
||||
if ($subarea == $this->admin_area)
|
||||
$subname .= '-Admin';
|
||||
elseif ($subarea == $this->dev_area)
|
||||
$subname .= '-Dev';
|
||||
elseif ($subarea > 1)
|
||||
$subname .= '-' . $subarea;
|
||||
|
||||
if (empty($this->sidemenu_areas[$area]))
|
||||
$this->sidemenu_areas[$area] = array('name' => $name, 'subarea' => array());
|
||||
if (empty($this->sidemenu_areas[$area]['subarea'][$subarea]))
|
||||
$this->sidemenu_areas[$area]['subarea'][$subarea]
|
||||
= array('name' => $subname, 'priorities' => array());
|
||||
|
||||
if (isset($priority) && empty($this->sidemenu_areas[$area]['subarea'][$subarea]['priorities'][$priority]))
|
||||
$this->sidemenu_areas[$area]['subarea'][$subarea]['priorities'][$priority]
|
||||
= array();
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: sideMenuAreaName
|
||||
* - Sets the name of the sidemenu area/subarea
|
||||
*/
|
||||
|
||||
function sideMenuAreaName($name, $area, $subarea = 1) {
|
||||
$this->sideMenuAreaVerify($area, $subarea);
|
||||
$this->sidemenu_areas[$area]['subarea'][$subarea]['name'] = $name;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: addSideMenuLink
|
||||
* - Adds another link to the sidemenu area/subarea/priority
|
||||
*/
|
||||
|
||||
function addSideMenuLink($name, $url, $extra, $area, $subarea = 1, $priority = 10) {
|
||||
$this->sideMenuAreaVerify($area, $subarea);
|
||||
$this->sidemenu_areas[$area]['subarea'][$subarea]['priorities'][$priority][]
|
||||
= array('name' => $name, 'url' => $url) + (empty($extra) ? array() : $extra);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: addDefaultSideMenuLinks
|
||||
* - Adds the standard links present on all generated pages
|
||||
*/
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
|
||||
$this->addSideMenuLink('Site Map',
|
||||
array('controller' => 'maps', 'action' => 'view', 1), null,
|
||||
'SITE');
|
||||
$this->addSideMenuLink('Units',
|
||||
array('controller' => 'units', 'action' => 'index'), null,
|
||||
'SITE');
|
||||
$this->addSideMenuLink('Leases',
|
||||
array('controller' => 'leases', 'action' => 'index'), null,
|
||||
'SITE');
|
||||
$this->addSideMenuLink('Customers',
|
||||
array('controller' => 'customers', 'action' => 'index'), null,
|
||||
'SITE');
|
||||
$this->addSideMenuLink('Deposits',
|
||||
array('controller' => 'transactions', 'action' => 'deposit'), null,
|
||||
'SITE');
|
||||
|
||||
if ($this->params['admin']) {
|
||||
$menu[] = array('name' => 'Admin', 'header' => true);
|
||||
$menu[] = array('name' => 'Accounts', 'url' => array('controller' => 'accounts', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Contacts', 'url' => array('controller' => 'contacts', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Ledgers', 'url' => array('controller' => 'ledgers', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Tenders', 'url' => array('controller' => 'tenders', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Transactions', 'url' => array('controller' => 'transactions', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Ldgr Entries', 'url' => array('controller' => 'ledger_entries', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'Stmt Entries', 'url' => array('controller' => 'statement_entries', 'action' => 'index'));
|
||||
$menu[] = array('name' => 'New Ledgers', 'url' => array('controller' => 'accounts', 'action' => 'newledger'));
|
||||
$menu[] = array('name' => 'Assess Charges', 'url' => array('controller' => 'leases', 'action' => 'assess_all'));
|
||||
$this->addSideMenuLink('Accounts',
|
||||
array('controller' => 'accounts', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Contacts',
|
||||
array('controller' => 'contacts', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Ledgers',
|
||||
array('controller' => 'ledgers', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Tenders',
|
||||
array('controller' => 'tenders', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Transactions',
|
||||
array('controller' => 'transactions', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Ldgr Entries',
|
||||
array('controller' => 'ledger_entries', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Stmt Entries',
|
||||
array('controller' => 'statement_entries', 'action' => 'index'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('New Ledgers',
|
||||
array('controller' => 'accounts', 'action' => 'newledger'), null,
|
||||
'SITE', $this->admin_area);
|
||||
$this->addSideMenuLink('Assess Charges',
|
||||
array('controller' => 'leases', 'action' => 'assess_all'), null,
|
||||
'SITE', $this->admin_area);
|
||||
}
|
||||
|
||||
if ($this->params['dev']) {
|
||||
$menu[] = array('name' => 'Development', 'header' => true);
|
||||
$menu[] = array('name' => 'Un-Nuke', 'url' => '#', 'htmlAttributes' =>
|
||||
array('onclick' => '$(".pr-section").show(); return false;'));
|
||||
$menu[] = array('name' => 'New Ledgers', 'url' => array('controller' => 'accounts', 'action' => 'newledger'));
|
||||
//array('name' => 'RESET DATA', 'url' => array('controller' => 'accounts', 'action' => 'reset_data'));
|
||||
$this->addSideMenuLink('Un-Nuke',
|
||||
'#', array('htmlAttributes' =>
|
||||
array('onclick' => '$(".pr-section").show(); return false;')),
|
||||
'SITE', $this->dev_area);
|
||||
$this->addSideMenuLink('New Ledgers',
|
||||
array('controller' => 'accounts', 'action' => 'newledger'), null,
|
||||
'SITE', $this->dev_area);
|
||||
//array('name' => 'RESET DATA', array('controller' => 'accounts', 'action' => 'reset_data'));
|
||||
}
|
||||
|
||||
return $menu;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* hook: beforeFilter
|
||||
* - Called just before the action function
|
||||
*/
|
||||
|
||||
function beforeFilter() {
|
||||
$this->params['dev'] =
|
||||
(!empty($this->params['dev_route']));
|
||||
@@ -93,12 +198,50 @@ class AppController extends Controller {
|
||||
|
||||
if (!$this->params['dev'])
|
||||
Configure::write('debug', '0');
|
||||
|
||||
$this->addDefaultSideMenuLinks();
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* hook: beforeRender
|
||||
* - Called just before rendering the page
|
||||
*/
|
||||
|
||||
function beforeRender() {
|
||||
$this->set('sidemenu', $this->sideMenuLinks());
|
||||
// Stupid Cake... our constructor sets admin/dev,
|
||||
// but cake stomps it somewhere along the way
|
||||
// after constructing the CakeError controller.
|
||||
if ($this->name === 'CakeError') {
|
||||
$this->params['dev'] = false;
|
||||
$this->params['admin'] = false;
|
||||
}
|
||||
|
||||
foreach ($this->sidemenu_areas AS &$area) {
|
||||
if (empty($area['subarea']))
|
||||
continue;
|
||||
|
||||
ksort($area['subarea']);
|
||||
foreach ($area['subarea'] AS &$subarea) {
|
||||
if (empty($subarea['priorities']))
|
||||
continue;
|
||||
ksort($subarea['priorities']);
|
||||
}
|
||||
}
|
||||
|
||||
//pr($this->sidemenu_areas);
|
||||
$this->set('sidemenu', $this->sidemenu_areas);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: redirect
|
||||
*/
|
||||
|
||||
function redirect($url, $status = null, $exit = true) {
|
||||
// OK, since the controller will not be able to
|
||||
// utilize our overriden url function in AppHelper,
|
||||
@@ -127,6 +270,14 @@ class AppController extends Controller {
|
||||
return parent::redirect($url, $status, $exit);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: reset_data
|
||||
* - Development function. TO BE DELETED
|
||||
*/
|
||||
|
||||
function reset_data() {
|
||||
$this->layout = null;
|
||||
$this->autoLayout = false;
|
||||
|
||||
@@ -4,28 +4,37 @@ class AccountsController extends AppController {
|
||||
|
||||
var $uses = array('Account', 'LedgerEntry');
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Accounts', 'header' => true),
|
||||
array('name' => 'All', 'url' => array('controller' => 'accounts', 'action' => 'all')),
|
||||
array('name' => 'Asset', 'url' => array('controller' => 'accounts', 'action' => 'asset')),
|
||||
array('name' => 'Liability', 'url' => array('controller' => 'accounts', 'action' => 'liability')),
|
||||
array('name' => 'Equity', 'url' => array('controller' => 'accounts', 'action' => 'equity')),
|
||||
array('name' => 'Income', 'url' => array('controller' => 'accounts', 'action' => 'income')),
|
||||
array('name' => 'Expense', 'url' => array('controller' => 'accounts', 'action' => 'expense')),
|
||||
);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
$this->addSideMenuLink('Asset',
|
||||
array('controller' => 'accounts', 'action' => 'asset'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Liability',
|
||||
array('controller' => 'accounts', 'action' => 'liability'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Equity',
|
||||
array('controller' => 'accounts', 'action' => 'equity'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Income',
|
||||
array('controller' => 'accounts', 'action' => 'income'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Expense',
|
||||
array('controller' => 'accounts', 'action' => 'expense'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'accounts', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -189,12 +198,12 @@ class AccountsController extends AppController {
|
||||
$stats = $this->Account->stats($id, true);
|
||||
$stats = $stats['Ledger'];
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Ledger', 'url' => array('action' => 'newledger', $id));
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Collected', 'url' => array('action' => 'collected', $id));
|
||||
$this->addSideMenuLink('New Ledger',
|
||||
array('action' => 'newledger', $id), null,
|
||||
'ACTION');
|
||||
$this->addSideMenuLink('Collected',
|
||||
array('action' => 'collected', $id), null,
|
||||
'ACTION');
|
||||
|
||||
// Prepare to render
|
||||
$title = 'Account: ' . $account['Account']['name'];
|
||||
|
||||
@@ -2,19 +2,7 @@
|
||||
|
||||
class ContactsController extends AppController {
|
||||
|
||||
var $sidemenu_links = array();
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -78,13 +66,9 @@ class ContactsController extends AppController {
|
||||
));
|
||||
|
||||
// Set up dynamic menu items
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Edit',
|
||||
'url' => array('action' => 'edit',
|
||||
$id));
|
||||
$this->addSideMenuLink('Edit',
|
||||
array('action' => 'edit', $id), null,
|
||||
'ACTION');
|
||||
|
||||
// Prepare to render.
|
||||
$title = 'Contact: ' . $contact['Contact']['display_name'];
|
||||
|
||||
@@ -1,28 +1,33 @@
|
||||
<?php
|
||||
|
||||
class CustomersController extends AppController {
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Customers', 'header' => true),
|
||||
array('name' => 'Current', 'url' => array('controller' => 'customers', 'action' => 'current')),
|
||||
array('name' => 'Past', 'url' => array('controller' => 'customers', 'action' => 'past')),
|
||||
array('name' => 'All', 'url' => array('controller' => 'customers', 'action' => 'all')),
|
||||
array('name' => 'Add Customer', 'url' => array('controller' => 'customers', 'action' => 'add')),
|
||||
);
|
||||
|
||||
//var $components = array('RequestHandler');
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
$this->addSideMenuLink('Current',
|
||||
array('controller' => 'customers', 'action' => 'current'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Past',
|
||||
array('controller' => 'customers', 'action' => 'past'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'customers', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Add Customer',
|
||||
array('controller' => 'customers', 'action' => 'add'), null,
|
||||
'CONTROLLER');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -229,42 +234,35 @@ class CustomersController extends AppController {
|
||||
}
|
||||
|
||||
// Set up dynamic menu items
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Edit',
|
||||
'url' => array('action' => 'edit',
|
||||
$id));
|
||||
$this->addSideMenuLink('Edit',
|
||||
array('action' => 'edit', $id), null,
|
||||
'ACTION');
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-In',
|
||||
'url' => array('action' => 'move_in',
|
||||
$id));
|
||||
$this->addSideMenuLink('Move-In',
|
||||
array('action' => 'move_in', $id), null,
|
||||
'ACTION');
|
||||
|
||||
/* if ($show_moveout) { */
|
||||
/* $this->sidemenu_links[] = */
|
||||
/* array('name' => 'Move-Out', */
|
||||
/* 'url' => array('action' => 'move_out', */
|
||||
/* $id)); */
|
||||
/* $this->addSideMenuLink('Move-Out', */
|
||||
/* array('action' => 'move_out', $id), null, */
|
||||
/* 'ACTION'); */
|
||||
/* } */
|
||||
|
||||
if ($show_payment || $outstanding_balance > 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Receipt',
|
||||
'url' => array('action' => 'receipt',
|
||||
$id));
|
||||
$this->addSideMenuLink('New Receipt',
|
||||
array('action' => 'receipt', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if (!$show_moveout && $outstanding_balance > 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Write-Off',
|
||||
'url' => array('action' => 'bad_debt',
|
||||
$id));
|
||||
$this->addSideMenuLink('Write-Off',
|
||||
array('action' => 'bad_debt', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if ($outstanding_balance < 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Issue Refund',
|
||||
'url' => array('action' => 'refund', $id));
|
||||
$this->addSideMenuLink('Issue Refund',
|
||||
array('action' => 'refund', $id), null,
|
||||
'ACTION');
|
||||
|
||||
// Prepare to render.
|
||||
$title = 'Customer: ' . $customer['Customer']['name'];
|
||||
|
||||
@@ -2,20 +2,7 @@
|
||||
|
||||
class DoubleEntriesController extends AppController {
|
||||
|
||||
var $sidemenu_links = array();
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
@@ -2,26 +2,31 @@
|
||||
|
||||
class LeasesController extends AppController {
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Leases', 'header' => true),
|
||||
array('name' => 'Active', 'url' => array('controller' => 'leases', 'action' => 'active')),
|
||||
array('name' => 'Closed', 'url' => array('controller' => 'leases', 'action' => 'closed')),
|
||||
array('name' => 'Delinquent', 'url' => array('controller' => 'leases', 'action' => 'delinquent')),
|
||||
array('name' => 'All', 'url' => array('controller' => 'leases', 'action' => 'all')),
|
||||
);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
$this->addSideMenuLink('Active',
|
||||
array('controller' => 'leases', 'action' => 'active'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Closed',
|
||||
array('controller' => 'leases', 'action' => 'closed'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Delinquent',
|
||||
array('controller' => 'leases', 'action' => 'delinquent'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'leases', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -467,28 +472,21 @@ class LeasesController extends AppController {
|
||||
// yet still have an outstanding balance. This can happen if someone
|
||||
// were to reverse charges, or if a payment should come back NSF.
|
||||
if (!isset($lease['Lease']['close_date']) || $outstanding_balance > 0) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
if (!isset($lease['Lease']['moveout_date']))
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-Out', 'url' => array('action' => 'move_out',
|
||||
$id));
|
||||
$this->addSideMenuLink('Move-Out',
|
||||
array('action' => 'move_out', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if (!isset($lease['Lease']['close_date']))
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Invoice', 'url' => array('action' => 'invoice',
|
||||
$id));
|
||||
$this->addSideMenuLink('New Invoice',
|
||||
array('action' => 'invoice', $id), null,
|
||||
'ACTION');
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Receipt', 'url' => array('controller' => 'customers',
|
||||
'action' => 'receipt',
|
||||
$lease['Customer']['id']));
|
||||
|
||||
/* if ($outstanding_balance < 0) */
|
||||
/* $this->sidemenu_links[] = */
|
||||
/* array('name' => 'Transfer Credit to Customer', */
|
||||
/* 'url' => array('action' => 'promote_surplus', $id)); */
|
||||
$this->addSideMenuLink('New Receipt',
|
||||
array('controller' => 'customers',
|
||||
'action' => 'receipt',
|
||||
$lease['Customer']['id']), null,
|
||||
'ACTION');
|
||||
|
||||
// REVISIT <AP>:
|
||||
// Not allowing refund to be issued from the lease, as
|
||||
@@ -500,19 +498,19 @@ class LeasesController extends AppController {
|
||||
$this->INTERNAL_ERROR("Should not have a customer lease credit.");
|
||||
|
||||
/* if ($outstanding_balance < 0) */
|
||||
/* $this->sidemenu_links[] = */
|
||||
/* array('name' => 'Issue Refund', */
|
||||
/* 'url' => array('action' => 'refund', $id)); */
|
||||
/* $this->addSideMenuLink('Issue Refund', */
|
||||
/* array('action' => 'refund', $id), null, */
|
||||
/* 'ACTION'); */
|
||||
|
||||
if (isset($lease['Lease']['moveout_date']) && $outstanding_balance > 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Write-Off', 'url' => array('action' => 'bad_debt',
|
||||
$id));
|
||||
$this->addSideMenuLink('Write-Off',
|
||||
array('action' => 'bad_debt', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if ($this->Lease->closeable($id))
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Close', 'url' => array('action' => 'close',
|
||||
$id));
|
||||
$this->addSideMenuLink('Close',
|
||||
array('action' => 'close', $id), null,
|
||||
'ACTION');
|
||||
}
|
||||
|
||||
// Prepare to render
|
||||
|
||||
@@ -2,19 +2,6 @@
|
||||
|
||||
class LedgerEntriesController extends AppController {
|
||||
|
||||
var $sidemenu_links = array();
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
@@ -2,25 +2,28 @@
|
||||
|
||||
class LedgersController extends AppController {
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Ledgers', 'header' => true),
|
||||
array('name' => 'Current', 'url' => array('controller' => 'ledgers', 'action' => 'current')),
|
||||
array('name' => 'Closed', 'url' => array('controller' => 'ledgers', 'action' => 'closed')),
|
||||
array('name' => 'All', 'url' => array('controller' => 'ledgers', 'action' => 'all')),
|
||||
);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
$this->addSideMenuLink('Current',
|
||||
array('controller' => 'ledgers', 'action' => 'current'), null
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Closed',
|
||||
array('controller' => 'ledgers', 'action' => 'closed'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'ledgers', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
@@ -2,20 +2,7 @@
|
||||
|
||||
class StatementEntriesController extends AppController {
|
||||
|
||||
var $sidemenu_links = array();
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -293,24 +280,16 @@ class StatementEntriesController extends AppController {
|
||||
|
||||
if (strtoupper($entry['StatementEntry']['type']) === 'CHARGE') {
|
||||
|
||||
$reversable = $this->StatementEntry->reversable($id);
|
||||
|
||||
// Set up dynamic menu items
|
||||
if ($reversable || $stats['balance'] > 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
if ($reversable)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Reverse',
|
||||
'url' => array('action' => 'reverse',
|
||||
$id));
|
||||
if ($this->StatementEntry->reversable($id))
|
||||
$this->addSideMenuLink('Reverse',
|
||||
array('action' => 'reverse', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if ($stats['balance'] > 0)
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Waive Balance',
|
||||
'url' => array('action' => 'waive',
|
||||
$id));
|
||||
$this->addSideMenuLink('Waive Balance',
|
||||
array('action' => 'waive', $id), null,
|
||||
'ACTION');
|
||||
}
|
||||
|
||||
// Prepare to render.
|
||||
|
||||
@@ -2,20 +2,7 @@
|
||||
|
||||
class TendersController extends AppController {
|
||||
|
||||
var $sidemenu_links = array();
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -163,16 +150,11 @@ class TendersController extends AppController {
|
||||
));
|
||||
|
||||
|
||||
// Set up dynamic menu items
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
// Watch out for the special "Closing" entries
|
||||
if (!empty($tender['TenderType']['id']))
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Edit',
|
||||
'url' => array('action' => 'edit',
|
||||
$id));
|
||||
$this->addSideMenuLink('Edit',
|
||||
array('action' => 'edit', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if (!empty($tender['Tender']['deposit_transaction_id'])
|
||||
&& empty($tender['Tender']['nsf_transaction_id'])
|
||||
@@ -181,10 +163,9 @@ class TendersController extends AppController {
|
||||
// (or if we're in development mode)
|
||||
&& (!empty($tender['TenderType']['data1_name']) || !empty($this->params['dev']))
|
||||
) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'NSF',
|
||||
'url' => array('action' => 'nsf',
|
||||
$id));
|
||||
$this->addSideMenuLink('NSF',
|
||||
array('action' => 'nsf', $id), null,
|
||||
'ACTION');
|
||||
}
|
||||
|
||||
// Prepare to render.
|
||||
|
||||
@@ -4,26 +4,31 @@ class TransactionsController extends AppController {
|
||||
|
||||
var $components = array('RequestHandler');
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Transactions', 'header' => true),
|
||||
array('name' => 'All', 'url' => array('controller' => 'transactions', 'action' => 'all')),
|
||||
array('name' => 'Invoices', 'url' => array('controller' => 'transactions', 'action' => 'invoice')),
|
||||
array('name' => 'Receipts', 'url' => array('controller' => 'transactions', 'action' => 'receipt')),
|
||||
array('name' => 'Deposits', 'url' => array('controller' => 'transactions', 'action' => 'deposit')),
|
||||
);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
$this->addSideMenuLink('Invoices',
|
||||
array('controller' => 'transactions', 'action' => 'invoice'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Receipts',
|
||||
array('controller' => 'transactions', 'action' => 'receipt'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Deposits',
|
||||
array('controller' => 'transactions', 'action' => 'deposit'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'transactions', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -36,10 +41,9 @@ class TransactionsController extends AppController {
|
||||
function invoice() { $this->gridView('Invoices'); }
|
||||
function receipt() { $this->gridView('Receipts'); }
|
||||
function deposit() {
|
||||
$this->sidemenu_links = array
|
||||
(array('name' => 'Operations', 'header' => true),
|
||||
array('name' => 'New Deposit', 'url' => array('controller' => 'tenders',
|
||||
'action' => 'deposit')));
|
||||
$this->addSideMenuLink('New Deposit',
|
||||
array('controller' => 'tenders', 'action' => 'deposit'), null,
|
||||
'ACTION');
|
||||
$this->gridView('Deposits');
|
||||
}
|
||||
|
||||
@@ -410,20 +414,19 @@ class TransactionsController extends AppController {
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
|
||||
if ($transaction['Transaction']['type'] === 'DEPOSIT' || $this->params['dev']) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
if ($transaction['Transaction']['type'] === 'DEPOSIT')
|
||||
$this->addSideMenuLink('View Slip',
|
||||
array('action' => 'deposit_slip', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if ($transaction['Transaction']['type'] === 'DEPOSIT')
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'View Slip', 'url' => array('action' => 'deposit_slip', $id));
|
||||
if ($this->params['dev'])
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Destroy', 'url' => array('action' => 'destroy', $id),
|
||||
'confirmMessage' => ("This may leave the database in an unstable state." .
|
||||
" Do NOT do this unless you know what you're doing." .
|
||||
" Proceed anyway?"));
|
||||
}
|
||||
if ($this->params['dev'])
|
||||
$this->addSideMenuLink('Destroy',
|
||||
array('action' => 'destroy', $id),
|
||||
array('confirmMessage' =>
|
||||
"This may leave the database in an unstable state." .
|
||||
" Do NOT do this unless you know what you're doing." .
|
||||
" Proceed anyway?"),
|
||||
'ACTION', $this->dev_area);
|
||||
|
||||
// OK, prepare to render.
|
||||
$title = 'Transaction #' . $transaction['Transaction']['id'];
|
||||
@@ -482,10 +485,9 @@ class TransactionsController extends AppController {
|
||||
if ($deposit['Transaction']['amount'] != $deposit_total)
|
||||
$this->INTERNAL_ERROR("Deposit items do not add up to deposit slip total");
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'View Transaction', 'url' => array('action' => 'view', $id));
|
||||
$this->addSideMenuLink('View',
|
||||
array('action' => 'view', $id), null,
|
||||
'ACTION');
|
||||
|
||||
$title = 'Deposit Slip';
|
||||
$this->set(compact('title', 'deposit'));
|
||||
|
||||
@@ -2,23 +2,28 @@
|
||||
|
||||
class UnitsController extends AppController {
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Units', 'header' => true),
|
||||
array('name' => 'Occupied', 'url' => array('controller' => 'units', 'action' => 'occupied')),
|
||||
array('name' => 'Vacant', 'url' => array('controller' => 'units', 'action' => 'vacant')),
|
||||
array('name' => 'Unavailable', 'url' => array('controller' => 'units', 'action' => 'unavailable')),
|
||||
array('name' => 'All', 'url' => array('controller' => 'units', 'action' => 'all')),
|
||||
);
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* override: sideMenuLinks
|
||||
* - Generates controller specific links for the side menu
|
||||
* override: addDefaultSideMenuLinks
|
||||
* - Adds controller specific default side menu links
|
||||
*/
|
||||
function sideMenuLinks() {
|
||||
return array_merge(parent::sideMenuLinks(), $this->sidemenu_links);
|
||||
|
||||
function addDefaultSideMenuLinks() {
|
||||
parent::addDefaultSideMenuLinks();
|
||||
$this->addSideMenuLink('Occupied',
|
||||
array('controller' => 'units', 'action' => 'occupied'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Vacant',
|
||||
array('controller' => 'units', 'action' => 'vacant'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('Unavailable',
|
||||
array('controller' => 'units', 'action' => 'unavailable'), null,
|
||||
'CONTROLLER');
|
||||
$this->addSideMenuLink('All',
|
||||
array('controller' => 'units', 'action' => 'all'), null,
|
||||
'CONTROLLER');
|
||||
}
|
||||
|
||||
|
||||
@@ -233,36 +238,35 @@ class UnitsController extends AppController {
|
||||
}
|
||||
|
||||
// Set up dynamic menu items
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Operations', 'header' => true);
|
||||
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Edit', 'url' => array('action' => 'edit',
|
||||
$id));
|
||||
$this->addSideMenuLink('Edit',
|
||||
array('action' => 'edit', $id), null,
|
||||
'ACTION');
|
||||
|
||||
if (isset($unit['CurrentLease']['id']) &&
|
||||
!isset($unit['CurrentLease']['moveout_date'])) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-Out', 'url' => array('action' => 'move_out',
|
||||
$id));
|
||||
$this->addSideMenuLink('Move-Out',
|
||||
array('action' => 'move_out', $id), null,
|
||||
'ACTION');
|
||||
} elseif ($this->Unit->available($unit['Unit']['status'])) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'Move-In', 'url' => array('action' => 'move_in',
|
||||
$id));
|
||||
$this->addSideMenuLink('Move-In',
|
||||
array('action' => 'move_in', $id), null,
|
||||
'ACTION');
|
||||
} else {
|
||||
// Unit is unavailable (dirty, damaged, reserved, business-use, etc)
|
||||
}
|
||||
|
||||
if (isset($unit['CurrentLease']['id']) &&
|
||||
!isset($unit['CurrentLease']['close_date'])) {
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Invoice', 'url' => array('controller' => 'leases',
|
||||
'action' => 'invoice',
|
||||
$unit['CurrentLease']['id']));
|
||||
$this->sidemenu_links[] =
|
||||
array('name' => 'New Receipt', 'url' => array('controller' => 'customers',
|
||||
'action' => 'receipt',
|
||||
$unit['CurrentLease']['customer_id']));
|
||||
$this->addSideMenuLink('New Invoice',
|
||||
array('controller' => 'leases',
|
||||
'action' => 'invoice',
|
||||
$unit['CurrentLease']['id']), null,
|
||||
'ACTION');
|
||||
$this->addSideMenuLink('New Receipt',
|
||||
array('controller' => 'customers',
|
||||
'action' => 'receipt',
|
||||
$unit['CurrentLease']['customer_id']), null,
|
||||
'ACTION');
|
||||
}
|
||||
|
||||
// Prepare to render.
|
||||
|
||||
@@ -8,17 +8,29 @@
|
||||
* @package pmgr
|
||||
*/
|
||||
|
||||
foreach ($menu AS $item) {
|
||||
if (isset($item['header']))
|
||||
echo('<DIV CLASS="header">' . $item['name'] . '</DIV>' . "\n");
|
||||
elseif (isset($item['hr']))
|
||||
echo('<HR>' . "\n");
|
||||
elseif (isset($item['url']))
|
||||
echo('<DIV CLASS="item">'
|
||||
. $html->link($item['name'], $item['url'],
|
||||
isset($item['htmlAttributes']) ? $item['htmlAttributes'] : null,
|
||||
isset($item['confirmMessage']) ? $item['confirmMessage'] : null,
|
||||
isset($item['escapeTitle']) ? $item['escapeTitle'] : null)
|
||||
foreach ($menu AS $area) {
|
||||
if (empty($area['subarea']))
|
||||
continue;
|
||||
|
||||
. '</DIV>' . "\n");
|
||||
foreach ($area['subarea'] AS $subarea) {
|
||||
if (empty($subarea['priorities']))
|
||||
continue;
|
||||
|
||||
echo('<DIV CLASS="header">' . $subarea['name'] . '</DIV>' . "\n");
|
||||
foreach ($subarea['priorities'] AS $priority) {
|
||||
foreach ($priority AS $item) {
|
||||
if (isset($item['header']))
|
||||
echo('<DIV CLASS="header">' . $item['name'] . '</DIV>' . "\n");
|
||||
elseif (isset($item['hr']))
|
||||
echo('<HR>' . "\n");
|
||||
elseif (isset($item['url']))
|
||||
echo('<DIV CLASS="item">'
|
||||
. $html->link($item['name'], $item['url'],
|
||||
isset($item['htmlAttributes']) ? $item['htmlAttributes'] : null,
|
||||
isset($item['confirmMessage']) ? $item['confirmMessage'] : null,
|
||||
isset($item['escapeTitle']) ? $item['escapeTitle'] : null)
|
||||
. '</DIV>' . "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user