/**
* @TODO
*
* @param <type> $name
* @param <type> $params
*
* @return <type>
*/
public static function getTableMetaData($name, $params)
{
switch ($name) {
case 'hours':
$emptype = Hermes::getEmployeesType('enum');
$clients = Hermes::listClients();
$hours = $GLOBALS['injector']->getInstance('Hermes_Driver')->getHours($params);
$yesno = array(1 => _("Yes"), 0 => _("No"));
$columns = array(array('name' => 'icons', 'title' => '', 'type' => '%html', 'nobr' => true), array('name' => 'checkbox', 'title' => '', 'type' => '%html', 'nobr' => true), array('name' => 'date', 'title' => _("Date"), 'type' => 'date', 'params' => array($GLOBALS['prefs']->getValue('date_format')), 'nobr' => true), array('name' => 'employee', 'title' => _("Employee"), 'type' => $emptype[0], 'params' => $emptype[1]), array('name' => '_client_name', 'title' => _("Client"), 'type' => 'enum', 'params' => array($clients)), array('name' => '_type_name', 'title' => _("Job Type")), array('name' => '_costobject_name', 'title' => _("Cost Object")), array('name' => 'hours', 'title' => _("Hours"), 'type' => 'number', 'align' => 'right'));
if ($GLOBALS['conf']['time']['choose_ifbillable']) {
$columns[] = array('name' => 'billable', 'title' => _("Bill?"), 'type' => 'enum', 'params' => array($yesno));
}
$columns = array_merge($columns, array(array('name' => 'description', 'title' => _("Description")), array('name' => 'note', 'title' => _("Notes"))));
$colspan = 6;
if ($GLOBALS['conf']['time']['choose_ifbillable']) {
$colspan++;
}
$fColumns = array(array('name' => 'approval', 'colspan' => $colspan, 'type' => '%html', 'align' => 'right'), array('name' => 'hours', 'type' => 'number', 'align' => 'right'));
if ($GLOBALS['conf']['time']['choose_ifbillable']) {
$fColumns[] = array('name' => 'billable', 'type' => 'enum', 'params' => array($yesno));
}
$fColumns = array_merge($fColumns, array(array('name' => 'description'), array('name' => 'blank2')));
return array('title' => _("Search Results"), 'sections' => array('data' => array('rows' => count($hours), 'columns' => $columns), 'footer' => array('rows' => 3, 'strong' => true, 'columns' => $fColumns)));
default:
throw new Hermes_Exception(sprintf(_("\"%s\" is not a defined table."), $name));
}
}