getEmployeesType() public static method

What type of control we use depends on whether the Auth driver has list capability.
public static getEmployeesType ( string $enumtype = 'multienum' ) : array
$enumtype string The type to return if we have list capability (should be either 'enum' or 'multienum').
return array A two-element array of the type and the type's parameters.
Esempio n. 1
0
 /**
  * @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));
     }
 }
Esempio n. 2
0
 public function __construct(&$vars)
 {
     parent::__construct($vars, _("Search For Time"));
     if ($GLOBALS['registry']->isAdmin(array('permission' => 'hermes:review'))) {
         $type = Hermes::getEmployeesType();
         $this->addVariable(_("Employees"), 'employees', $type[0], false, false, null, array($type[1]));
     }
     $type = $this->getClientsType();
     $cli = $this->addVariable(_("Clients"), 'clients', $type[0], false, false, null, $type[1]);
     $cli->setAction(Horde_Form_Action::factory('submit'));
     $cli->setOption('trackchange', true);
     $type = $this->getJobTypesType();
     $this->addVariable(_("Job Types"), 'jobtypes', $type[0], false, false, null, $type[1]);
     $this->addVariable(_("Cost Objects"), 'costobjects', 'multienum', false, false, null, array(Hermes::getCostObjectType($vars->get('clients'))));
     $this->addVariable(_("Do not include entries before"), 'start', 'monthdayyear', false, false, null, array(date('Y') - 10));
     $this->addVariable(_("Do not include entries after"), 'end', 'monthdayyear', false, false, null, array(date('Y') - 10));
     $states = array('' => '', '1' => _("Yes"), '0' => _("No"));
     $this->addVariable(_("Submitted?"), 'submitted', 'enum', false, false, null, array($states));
     $this->addVariable(_("Exported?"), 'exported', 'enum', false, false, null, array($states));
     $this->addVariable(_("Billable?"), 'billable', 'enum', false, false, null, array($states));
     $this->setButtons(_("Search"));
 }