1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: 16: 17:
18: class Whups_Form_Ticket_CreateStepOne extends Horde_Form
19: {
20: protected $_useFormToken = false;
21:
22: public function __construct(&$vars)
23: {
24: global $whups_driver;
25:
26: parent::__construct($vars, _("Create Ticket - Step 1"));
27:
28: $queues = Whups::permissionsFilter(
29: $whups_driver->getQueues(), 'queue', Horde_Perms::EDIT);
30: if (!$queues) {
31: $this->addVariable(
32: _("Queue Name"), 'queue', 'invalid', true, false, null,
33: array(_("There are no queues which you can create tickets in.")));
34: } else {
35: foreach (array_keys($queues) as $queue_id) {
36: $info = $whups_driver->getQueue($queue_id);
37: if (!empty($info['description'])) {
38: $queues[$queue_id] .= ' [' . $info['description'] . ']';
39: }
40: }
41:
42:
43: if (count($queues) == 1) {
44: $vars->set('queue', array_pop(array_keys($queues)));
45: }
46:
47: $queues = &$this->addVariable(
48: _("Queue Name"), 'queue', 'enum', true, false, null,
49: array($queues, _("Choose:")));
50: $queues->setAction(Horde_Form_Action::factory('submit'));
51: }
52: }
53:
54: }