Copyright 2001-2002 Robert E. Coyle
Copyright 2001-2016 Horde LLC (http://www.horde.org/)
See the enclosed file LICENSE for license information (BSD). If you
did not receive this file, see http://www.horde.org/licenses/bsdl.php.
public function execute(&$vars) { $qManager = new Whups_Query_Manager(); try { $query = $qManager->getQuery($vars->get('name')); $GLOBALS['whups_query'] = $query; } catch (Whups_Exception $e) { $GLOBALS['notification']->push(sprintf(_("The query couldn't be loaded:"), $e->getMessage()), 'horde.error'); } $this->unsetVars($vars); }
public function sidebar($sidebar) { global $registry, $session; $sidebar->addNewButton(_("_New Ticket"), Horde::url('ticket/create.php')); $sidebar->containers['queries'] = array('header' => array('id' => 'whups-toggle-queries', 'label' => _("Saved Queries"))); $manager = new Whups_Query_Manager(); $queries = $manager->listQueries($registry->getAuth(), true); foreach ($queries as $id => $query) { $row = array('selected' => strpos(strval(Horde::selfUrl()), $registry->get('webroot') . '/query') === 0 && $id == $session->get('whups', 'query'), 'cssClass' => 'whups-sidebar-query', 'url' => Whups::urlFor('query', empty($query['slug']) ? array('id' => $id) : array('slug' => $query['slug'])), 'label' => $query['name']); $sidebar->addRow($row, 'queries'); } }
/** */ protected function _content() { $qManager = new Whups_Query_Manager(); $queries = $qManager->listQueries($GLOBALS['registry']->getAuth(), true); $myqueries = new Whups_View_SavedQueries(array('results' => $queries)); Horde::startBuffer(); $myqueries->html(false); $html = Horde::endBuffer(); if ($html) { return $html; } return '<p class="horde-content"><em>' . _("No queries have been saved.") . '</em></p>'; }
/** */ private function _getQuery() { if (empty($this->_params['query'])) { return false; } $qManager = new Whups_Query_Manager(); try { $query = $qManager->getQuery($this->_params['query']); } catch (Whups_Exception $e) { return false; } if (!$query->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) { return false; } return $query; }
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); }
<?php /** * Whups RSS feed. * * Copyright 2008-2014 Horde LLC (http://www.horde.org/) * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. * * @author Michael J. Rubinsky <*****@*****.**> * @author Jan Schneider <*****@*****.**> */ require_once __DIR__ . '/../lib/Application.php'; Horde_Registry::appInit('whups'); $qManager = new Whups_Query_Manager(); $vars = new Horde_Variables(); // See if we were passed a slug or id. Slug is tried first. $whups_query = null; $slug = Horde_Util::getFormData('slug'); if ($slug) { $whups_query = $qManager->getQueryBySlug($slug); } else { $whups_query = $qManager->getQuery(Horde_Util::getFormData('query')); } if (!isset($whups_query) || $whups_query->parameters || !$whups_query->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) { exit; } $tickets = $whups_driver->executeQuery($whups_query, $vars); if (!count($tickets)) { exit;
} try { $tickets = $whups_driver->getTicketsByProperties($info); Whups::sortTickets($tickets); $session->set('whups', 'last_search', Horde::url('search.php?' . _getSearchUrl($vars))); $results = new Whups_View_Results(array('title' => _("Search Results"), 'results' => $tickets, 'values' => Whups::getSearchResultColumns(), 'url' => $session->get('whups', 'last_search'))); $beendone = true; } catch (Whups_Exception $e) { $notification->push(sprintf(_("There was an error performing your search: %s"), $tickets->getMessage()), 'horde.error'); } } Whups::addFeedLink(); $page_output->ajax = true; $page_output->header(array('title' => _("Search"))); $notification->notify(array('listeners' => 'status')); if ($results) { $results->html(); if (is_object($form)) { $form->setTitle(_("Refine Search")); $form->renderActive($renderer, $vars, Horde::url('search.php'), 'get'); } } if (!$beendone) { // Front search page. $form->setTitle(_("Ticket Search")); $form->renderActive($renderer, $vars, Horde::url('search.php'), 'get'); } $qManager = new Whups_Query_Manager(); $myqueries = new Whups_View_SavedQueries(array('title' => $GLOBALS['registry']->getAuth() ? _("My Queries") : _("Public Queries"), 'results' => $qManager->listQueries($GLOBALS['registry']->getAuth(), true))); $myqueries->html(); $page_output->footer();
<?php /** * Copyright 2001-2002 Robert E. Coyle <*****@*****.**> * Copyright 2001-2014 Horde LLC (http://www.horde.org/) * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. * * @author Chuck Hagenbuch <*****@*****.**> */ require_once __DIR__ . '/../lib/Application.php'; Horde_Registry::appInit('whups'); $vars = Horde_Variables::getDefaultVariables(); $qManager = new Whups_Query_Manager(); // Load the current query. If we have a 'slug' or 'query' parameter, that // overrides and we load in that from the query store. Slug is tried // first. Otherwise we use the query that is currently in our session. $whups_query = null; try { if ($vars->exists('slug')) { $whups_query = $qManager->getQueryBySlug($vars->get('slug')); } elseif ($vars->exists('query')) { $whups_query = $qManager->getQuery($vars->get('query')); } else { $whups_query = $session->get('whups', 'query'); } } catch (Whups_Exception $e) { $notification->push($e->getMessage()); } Whups::addTopbarSearch();
/** * Delete this object from the backend permanently. * */ public function delete() { $this->_qManager->delete($this); }
<?php /** * Copyright 2001-2002 Robert E. Coyle <*****@*****.**> * Copyright 2001-2015 Horde LLC (http://www.horde.org/) * * See the enclosed file LICENSE for license information (BSD). If you * did not receive this file, see http://www.horde.org/licenses/bsdl.php. * * @author Chuck Hagenbuch <*****@*****.**> */ require_once __DIR__ . '/../lib/Application.php'; Horde_Registry::appInit('whups'); $vars = Horde_Variables::getDefaultVariables(); $qManager = new Whups_Query_Manager(); // Set up the page config vars. $showEditQuery = true; $showExtraForm = null; Whups::addTopbarSearch(); // Find our current query. if ($whups_query = $session->get('whups', 'query')) { if (!$whups_query->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) { $notification->push(_("Permission denied."), 'horde.error'); Horde::url($prefs->getValue('whups_default_view') . '.php', true)->redirect(); } } else { $whups_query = $qManager->newQuery(); } // Find the current criteria form, and default to the user form if not // present. if (!$session->exists('whups', 'query_form')) {