1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: 16: 17:
18: class Whups_Form_Ticket_CreateStepTwo 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 2"));
27:
28: $types = $whups_driver->getTypes($vars->get('queue'));
29: $info = $whups_driver->getQueue($vars->get('queue'));
30: $type = $whups_driver->getDefaultType($vars->get('queue'));
31: if (count($types) == 0) {
32: $typetype = 'invalid';
33: $type_params = array(
34: _("There are no ticket types associated with this queue; until there are, you cannot create any tickets in this queue."));
35: } else {
36: $typetype = 'enum';
37: $type_params = array($types);
38: if (empty($type) || !isset($types[$type])) {
39: $type_params[] = _("Choose:");
40: }
41: }
42: $types = &$this->addVariable(
43: _("Ticket Type"), 'type', $typetype, true, false, null, $type_params);
44: $types->setDefault($type);
45:
46: if (!empty($info['versioned'])) {
47: $versions = $whups_driver->getVersions($vars->get('queue'));
48: if (count($versions) == 0) {
49: $vtype = 'invalid';
50: $v_params = array(_("This queue requires that you specify a version, but there are no versions associated with it. Until versions are created for this queue, you will not be able to create tickets."));
51: } else {
52: $vtype = 'enum';
53: $v_params = array($versions);
54: }
55: $this->addVariable(
56: _("Queue Version"), 'version', $vtype, true, false, null, $v_params);
57: } else {
58: $types->setAction(Horde_Form_Action::factory('submit'));
59: }
60: }
61:
62: }
63: