Overview

Packages

  • Hermes
  • Horde
    • Data
  • Kronolith
  • None

Classes

  • Hermes
  • Hermes_Ajax_Application
  • Hermes_Api
  • Hermes_Driver
  • Hermes_Driver_Sql
  • Hermes_Factory_Driver
  • Hermes_Form_Admin_AddJobType
  • Hermes_Form_Admin_DeleteJobType
  • Hermes_Form_Admin_EditClientStepOne
  • Hermes_Form_Admin_EditClientStepTwo
  • Hermes_Form_Admin_EditJobTypeStepOne
  • Hermes_Form_Admin_EditJobTypeStepTwo
  • Hermes_Form_Deliverable
  • Hermes_Form_Deliverable_ClientSelector
  • Hermes_Form_Export
  • Hermes_Form_JobType_Edit_Step1
  • Hermes_Form_Search
  • Hermes_Form_Time
  • Hermes_Form_Time_Entry
  • Hermes_LoginTasks_SystemTask_Upgrade
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * @package Hermes
 4:  *
 5:  * Copyright 2002-2012 Horde LLC (http://www.horde.org/)
 6:  *
 7:  * See the enclosed file LICENSE for license information (BSD). If you
 8:  * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
 9:  */
10: 
11: /**
12:  * TimeForm abstract class.
13:  *
14:  * Hermes forms can extend this to gain access to shared functionality.
15:  *
16:  * @author  Chuck Hagenbuch <chuck@horde.org>
17:  * @package Hermes
18:  */
19: class Hermes_Form_Time extends Horde_Form
20: {
21:     public function __construct(&$vars, $name = null)
22:     {
23:         parent::Horde_Form($vars, $name);
24:     }
25: 
26:     public function getJobTypeType()
27:     {
28:         try {
29:             $types = $GLOBALS['injector']->getInstance('Hermes_Driver')->listJobTypes(array('enabled' => true));
30:         } catch (Horde_Exception $e) {
31:             return array('invalid', array(sprintf(_("An error occurred listing job types: %s"), $e->getMessage())));
32:         }
33:         if (count($types)) {
34:             $values = array();
35:             foreach ($types as $id => $type) {
36:                 $values[$id] = $type['name'];
37:             }
38:             return array('enum', array($values));
39:         }
40: 
41:         return array('invalid', array(_("There are no job types configured.")));
42:     }
43: 
44:     public function getClientType()
45:     {
46:         try {
47:             $clients = Hermes::listClients();
48:         } catch (Horde_Exception $e) {
49:             return array('invalid', array(sprintf(_("An error occurred listing clients: %s"), $e->getMessage())));
50:         }
51:         if ($clients) {
52:             if (count($clients) > 1) {
53:                 $clients = array('' => _("--- Select A Client ---")) + $clients;
54:             }
55:             return array('enum', array($clients));
56:         } else {
57:             return array('invalid', array(_("There are no clients which you have access to.")));
58:         }
59:     }
60: 
61: }
API documentation generated by ApiGen