1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: 12: 13: 14: 15: 16: 17: 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: }