Whups_Form_Ticket_Delete::validate PHP Method

validate() public method

public validate ( &$vars )
    public function validate(&$vars)
    {
        if (Whups::hasPermission($this->_queue, 'queue', Horde_Perms::DELETE)) {
            $this->_warn->setDefault('<span class="horde-form-error">' . _("Permission Denied.") . '</span>');
        }
        return parent::validate($vars);
    }

Usage Example

コード例 #1
0
ファイル: delete.php プロジェクト: horde/horde
$ticket = Whups::getCurrentTicket();
$page_output->addLinkTag($ticket->feedLink());
$details = $ticket->getDetails();
if (!Whups::hasPermission($details['queue'], 'queue', Horde_Perms::DELETE)) {
    $notification->push(_("Permission Denied"), 'horde.error');
    Horde::url($prefs->getValue('whups_default_view') . '.php', true)->redirect();
}
Whups::addTopbarSearch();
$vars = Horde_Variables::getDefaultVariables();
$vars->set('id', $id = $ticket->getId());
foreach ($details as $varname => $value) {
    $vars->add($varname, $value);
}
$title = sprintf(_("Delete %s?"), '[#' . $id . '] ' . $ticket->get('summary'));
$deleteform = new Whups_Form_Ticket_Delete($vars, $title);
if ($vars->get('formname') == 'whups_form_ticket_delete' && $deleteform->validate($vars)) {
    if ($vars->get('submitbutton') == _("Delete")) {
        $deleteform->getInfo($vars, $info);
        try {
            $ticket->delete();
            $notification->push(sprintf(_("Ticket %d has been deleted."), $info['id']), 'horde.success');
            Horde::url($prefs->getValue('whups_default_view') . '.php', true)->redirect();
        } catch (Whups_Exception $e) {
            $notification->push(_("There was an error deleting the ticket:") . ' ' . $e->getMessage(), 'horde.error');
        } catch (Horde_Exception_NotFound $e) {
            $notification->push(sprintf(_("Ticket %d not found."), $info['id']));
        }
    } else {
        $notification->push(_("The ticket was not deleted."), 'horde.message');
    }
}
All Usage Examples Of Whups_Form_Ticket_Delete::validate
Whups_Form_Ticket_Delete