Files
pmgr/site/views/elements/units.ctp

38 lines
1.3 KiB
PHP

<?php /* -*- mode:PHP -*- */
// Define the table columns
$cols = array();
$cols['Sort'] = array('index' => 'Unit.sort_order', 'hidden' => true);
//$cols['Sort'] = array('index' => 'Unit.sort_order');
//$cols['Walk'] = array('index' => 'Unit.walk_order');
$cols['ID'] = array('index' => 'Unit.id', 'formatter' => 'id');
$cols['Unit'] = array('index' => 'Unit.name', 'width' => '50');
$cols['Size'] = array('index' => 'UnitSize.name', 'width' => '75');
$cols['Status'] = array('index' => 'Unit.status', 'width' => '75');
$cols['Comment'] = array('index' => 'Unit.comment', 'formatter' => 'comment');
$custom_post_data = compact('nothing');
$jqGrid_options = array('jqGridColumns' => $cols,
'controller' => 'units');
$jqGrid_options += compact('action', 'caption',
'grid_div_id', 'grid_id', 'grid_setup',
'nolinks', 'limit');
if (isset($units)) {
$jqGrid_options += array('custom_ids' =>
array_map(create_function('$data',
'return $data["id"];'),
$units),
'limit' => 5);
}
if (isset($searchfields)) {
$jqGrid_options += array('search_fields' => array('Unit', 'Size', 'Status'));
}
$jqGrid_options += compact('custom_post_data');
$jqGrid_options['sort_column'] = 'Sort';
echo $this->element('jqGrid', $jqGrid_options);