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:  * TimeEntryForm Class.
 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:  * @author  Chuck Hagenbuch <chuck@horde.org>
11:  * @package Hermes
12:  */
13: class Hermes_Form_Time_Entry extends Hermes_Form_Time
14: {
15:     /**
16:      * Reference to the form field storing the cost objects.
17:      *
18:      * @var Horde_Form_Variable
19:      */
20:     protected $_costObjects;
21: 
22:     public function __construct (&$vars)
23:     {
24:         global $conf;
25: 
26:         if ($vars->exists('id')) {
27:             parent::__construct($vars, _("Update Time"));
28:             $delete_link = Horde::url('time.php')->add('delete', $vars->get('id'))->link(array('title' => _("Delete Entry"))) . _("Delete");
29:             $this->setExtra('<span class="smallheader">' . $delete_link . '</a></span>');
30:         } else {
31:             parent::__construct($vars, _("New Time"));
32:         }
33:         $this->setButtons(_("Save"));
34: 
35:         list($clienttype, $clientparams) = $this->getClientType();
36:         if ($clienttype == 'enum') {
37:             $action = &Horde_Form_Action::factory('submit');
38:         }
39: 
40:         list($typetype, $typeparams) = $this->getJobTypeType();
41: 
42:         if ($vars->exists('id')) {
43:             $this->addHidden('', 'id', 'int', true);
44:         }
45: 
46:         if ($vars->exists('url')) {
47:             $this->addHidden('', 'url', 'text', true);
48:         }
49: 
50:         $var = &$this->addVariable(_("Date"), 'date', 'monthdayyear', true,
51:                                    false, null, array(date('Y') - 1));
52:         $var->setDefault(date('Y-m-d'));
53: 
54:         $cli = &$this->addVariable(_("Client"), 'client', $clienttype, true, false, null, $clientparams);
55:         if (isset($action)) {
56:             $cli->setAction($action);
57:             $cli->setOption('trackchange', true);
58:         }
59: 
60:         $this->addVariable(_("Job Type"), 'type', $typetype, true, false, null, $typeparams);
61: 
62:         $this->_costObjects = &$this->addVariable(
63:             _("Cost Object"), 'costobject', 'enum', false, false, null,
64:             array(array()));
65: 
66:         $this->addVariable(_("Hours"), 'hours', 'number', true);
67: 
68:         if ($conf['time']['choose_ifbillable']) {
69:             $yesno = array(1 => _("Yes"), 0 => _("No"));
70:             $this->addVariable(_("Billable?"), 'billable', 'enum', true, false, null, array($yesno));
71:         }
72: 
73:         if ($vars->exists('client') && $vars->get('client')) {
74:             try {
75:                 $info = $GLOBALS['injector']->getInstance('Hermes_Driver')->getClientSettings($vars->get('client'));
76:             } catch (Horde_Exception_NotFound $e) {
77:             }
78:             if (!$info['enterdescription']) {
79:                 $vars->set('description', _("See Attached Timesheet"));
80:             }
81:         }
82:         $descvar = &$this->addVariable(_("Description"), 'description', 'longtext', true, false, null, array(4, 60));
83:         $this->addVariable(_("Additional Notes"), 'note', 'longtext', false, false, null, array(4, 60));
84:     }
85: 
86:     function setCostObjects($vars)
87:     {
88:         $this->_costObjects->type->setValues(Hermes::getCostObjectType($vars->get('client')));
89:     }
90: 
91: }
API documentation generated by ApiGen