1<?php
2/**
3 * Displays and handles the form to change the ticket type.
4 *
5 * Copyright 2001-2002 Robert E. Coyle <robertecoyle@hotmail.com>
6 * Copyright 2001-2017 Horde LLC (http://www.horde.org/)
7 *
8 * See the enclosed file LICENSE for license information (BSD). If you
9 * did not receive this file, see http://www.horde.org/licenses/bsdl.php.
10 */
11
12class Whups_Form_SetTypeStepOne extends Horde_Form
13{
14    public function __construct(&$vars, $title = '')
15    {
16        global $whups_driver;
17
18        parent::__construct($vars, $title);
19
20        $this->addHidden('', 'id', 'int', true, true);
21
22        /* Types */
23        $queue = $vars->get('queue');
24        $this->addVariable(_("New Type"), 'type', 'enum', true, false, null, array($whups_driver->getTypes($queue)));
25        $this->addVariable(_("Comment"), 'newcomment', 'longtext', false);
26
27        /* Group restrictions. */
28        $groups = $GLOBALS['injector']->getInstance('Horde_Group');
29        $mygroups = $groups->listGroups($GLOBALS['registry']->getAuth());
30        if ($mygroups) {
31            foreach (array_keys($mygroups) as $gid) {
32                $grouplist[$gid] = $groups->getName($gid, true);
33            }
34            asort($grouplist);
35            $grouplist = array_merge(array(0 => _("Any Group")), $grouplist);
36            $this->addVariable(_("Viewable only by members of"), 'group', 'enum', true, false, null, array($grouplist));
37        }
38    }
39
40}