1: <?php
2: 3: 4: 5: 6: 7: 8:
9: class Whups_Form_Ticket_Delete extends Horde_Form
10: {
11: protected $_queue;
12:
13: public function __construct(&$vars, $title = '')
14: {
15: parent::__construct($vars, $title);
16:
17: $info = $GLOBALS['whups_driver']->getTicketDetails($vars->get('id'));
18: $this->_queue = $info['queue'];
19: $this->addHidden('', 'id', 'int', true, true);
20: $summary = &$this->addVariable(_("Summary"), 'summary', 'text', false,
21: true);
22: $summary->setDefault($info['summary']);
23: $yesno = array(0 => _("No"), 1 => _("Yes"));
24: $this->addVariable(_("Really delete this ticket? It will NOT be archived, and will be gone forever."), 'yesno', 'enum', true, false, null, array($yesno));
25: }
26:
27: public function validate(&$vars)
28: {
29: if (!Whups::hasPermission($this->_queue, 'queue', Horde_Perms::DELETE)) {
30: $this->setError('yesno', _("Permission Denied."));
31: }
32:
33: return parent::validate($vars);
34: }
35:
36: }