public function execute($vars) { global $notification; if ($vars->get('yesno')) { if (!$GLOBALS['whups_query']->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE)) { $notifications->push(sprintf(_("Permission denied.")), 'horde.error'); } else { try { $result = $GLOBALS['whups_query']->delete(); $notification->push(sprintf(_("The query \"%s\" has been deleted."), $GLOBALS['whups_query']->name), 'horde.success'); $qManager = new Whups_Query_Manager(); unset($GLOBALS['whups_query']); $GLOBALS['whups_query'] = $qManager->newQuery(); } catch (Whups_Exception $e) { $notification->push(sprintf(_("The query \"%s\" couldn't be deleted: %s"), $GLOBALS['whups_query']->name, $result->getMessage()), 'horde.error'); } } } $this->unsetVars($vars); }
} return substr($qUrl, 1); } require_once __DIR__ . '/lib/Application.php'; Horde_Registry::appInit('whups'); $renderer = new Horde_Form_Renderer(); $beendone = false; $vars = Horde_Variables::getDefaultVariables(); Whups::addTopbarSearch(); $form = new Whups_Form_Search($vars); $results = null; if (($vars->get('formname') || $vars->get('summary') || $vars->get('states') || Horde_Util::getFormData('haveSearch', false)) && $form->validate($vars, true)) { $form->getInfo($vars, $info); if ($vars->get('submitbutton') == _("Save as Query")) { $qManager = new Whups_Query_Manager(); $whups_query = $qManager->newQuery(); if (strlen($info['summary'])) { $whups_query->insertCriterion('', Whups_Query::CRITERION_SUMMARY, null, Whups_Query::OPERATOR_CI_SUBSTRING, $info['summary']); } if ($vars->get('queue')) { $whups_query->insertCriterion('', Whups_Query::CRITERION_QUEUE, null, Whups_Query::OPERATOR_EQUAL, $info['queue'][0]); } foreach (array('ticket_timestamp', 'date_updated', 'date_resolved', 'date_assigned', 'date_due') as $date_field) { if (!empty($info[$date_field]['from']) || !empty($info[$date_field]['to'])) { $path = $whups_query->insertBranch('', Whups_Query::TYPE_AND); break; } } if (!empty($info['ticket_timestamp']['from'])) { $whups_query->insertCriterion($path, Whups_Query::CRITERION_TIMESTAMP, null, Whups_Query::OPERATOR_GREATER, $info['ticket_timestamp']['from']); }