Minor change to the display and sort order of unit sizes

git-svn-id: file:///svn-source/pmgr/branches/v0.3_work@992 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2010-07-02 13:38:38 +00:00
parent d96145530c
commit 112a128492
2 changed files with 29 additions and 5 deletions

View File

@@ -148,6 +148,23 @@ class UnitSizesController extends AppController {
return $conditions; return $conditions;
} }
function gridDataOrder(&$params, &$model, $index, $direction) {
if ($index == 'UnitType.name')
$index = 'UnitType.code';
$order = parent::gridDataOrder($params, $model, $index, $direction);
// After sorting by whatever the user wants, add these
// defaults into the sort mechanism. If we're already
// sorting by one of them, it will only be redundant,
// and should cause no harm (possible a longer query?)
$order[] = 'UnitType.code ' . $direction;
$order[] = 'sqft ' . $direction;
$order[] = 'UnitSize.rent ' . $direction;
return $order;
}
function gridDataPostProcessLinks(&$params, &$model, &$records, $links) { function gridDataPostProcessLinks(&$params, &$model, &$records, $links) {
$links['UnitSize'] = array('name'); $links['UnitSize'] = array('name');
return parent::gridDataPostProcessLinks($params, $model, $records, $links); return parent::gridDataPostProcessLinks($params, $model, $records, $links);

View File

@@ -3,6 +3,7 @@
// Define the table columns // Define the table columns
$cols = array(); $cols = array();
$cols['Size'] = array('index' => 'UnitSize.name', 'formatter' => 'shortname'); $cols['Size'] = array('index' => 'UnitSize.name', 'formatter' => 'shortname');
$cols['Type'] = array('index' => 'UnitType.name', 'formatter' => 'shortname');
$cols['Width'] = array('index' => 'UnitSize.width', 'formatter' => 'number'); $cols['Width'] = array('index' => 'UnitSize.width', 'formatter' => 'number');
$cols['Depth'] = array('index' => 'UnitSize.depth', 'formatter' => 'number'); $cols['Depth'] = array('index' => 'UnitSize.depth', 'formatter' => 'number');
$cols['Height'] = array('index' => 'UnitSize.height', 'formatter' => 'number'); $cols['Height'] = array('index' => 'UnitSize.height', 'formatter' => 'number');
@@ -10,8 +11,8 @@ $cols['Area'] = array('index' => 'sqft', 'formatter' => 'nu
$cols['Volume'] = array('index' => 'cuft', 'formatter' => 'number'); $cols['Volume'] = array('index' => 'cuft', 'formatter' => 'number');
$cols['Deposit'] = array('index' => 'UnitSize.deposit', 'formatter' => 'currency'); $cols['Deposit'] = array('index' => 'UnitSize.deposit', 'formatter' => 'currency');
$cols['Rent'] = array('index' => 'UnitSize.rent', 'formatter' => 'currency'); $cols['Rent'] = array('index' => 'UnitSize.rent', 'formatter' => 'currency');
$cols['A. Cost'] = array('index' => 'sqcost', 'formatter' => 'currency'); $cols['Per Foot'] = array('index' => 'sqcost', 'formatter' => 'currency');
$cols['V. Cost'] = array('index' => 'cucost', 'formatter' => 'currency'); $cols['Per Cubic Ft'] = array('index' => 'cucost', 'formatter' => 'currency');
$cols['Unavailable'] = array('index' => 'unavailable', 'formatter' => 'number'); $cols['Unavailable'] = array('index' => 'unavailable', 'formatter' => 'number');
$cols['Occupied'] = array('index' => 'occupied', 'formatter' => 'number'); $cols['Occupied'] = array('index' => 'occupied', 'formatter' => 'number');
$cols['Available'] = array('index' => 'available', 'formatter' => 'number'); $cols['Available'] = array('index' => 'available', 'formatter' => 'number');
@@ -27,7 +28,13 @@ $grid
->defaultFields(array('Size', 'Area')) ->defaultFields(array('Size', 'Area'))
->searchFields(array('Size', 'Width', 'Depth', 'Area', 'Deposit', 'Rent')) ->searchFields(array('Size', 'Width', 'Depth', 'Area', 'Deposit', 'Rent'))
->render($this, isset($config) ? $config : null, ->render($this, isset($config) ? $config : null,
array_diff(array_keys($cols), array('Height', 'Volume', array_diff(array_keys($cols), array('Width', 'Depth',
'A. Cost', 'V. Cost', 'Deposit',
'Occupied', 'Total', 'Occupancy', 'Vacancy', 'Height', 'Volume',
//'Per Foot',
'Per Cubic Ft',
'Occupied',
//'Total',
'Occupancy',
//'Vacancy',
'Comment'))); 'Comment')));