getQuery() public method

Returns a specific query identified by its id.
public getQuery ( integer $queryId ) : Whups_Query
$queryId integer A query id.
return Whups_Query The matching query or null if not found.
コード例 #1
0
ファイル: ChooseNameForLoad.php プロジェクト: horde/horde
 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);
 }
コード例 #2
0
ファイル: Query.php プロジェクト: raz0rsdge/horde
 /**
  */
 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;
 }
コード例 #3
0
ファイル: rss.php プロジェクト: jubinpatel/horde
 * 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;
}
Whups::sortTickets($tickets, 'date_updated', 'desc');
$cnt = 0;
foreach (array_keys($tickets) as $i) {
    $description = 'Type: ' . $tickets[$i]['type_name'] . '; State: ' . $tickets[$i]['state_name'];
    $items[$i]['title'] = htmlspecialchars(sprintf('[%s] %s', $tickets[$i]['id'], $tickets[$i]['summary']));
    $items[$i]['description'] = htmlspecialchars($description);
    $items[$i]['url'] = Whups::urlFor('ticket', $tickets[$i]['id'], true, -1);
コード例 #4
0
ファイル: run.php プロジェクト: jubinpatel/horde
 *
 * @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();
// If we have an error, or if we still don't have a query, or if we don't have
// read permissions on the requested query, go to the initial Whups page.
if (!isset($whups_query) || !$whups_query->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) {
    if (isset($whups_query)) {
        $notification->push(_("Permission denied."), 'horde.error');
    }
    Horde::url($prefs->getValue('whups_default_view') . '.php', true)->redirect();
}