getQueryBySlug() 공개 메소드

Returns a specific query identified by its slug name.
public getQueryBySlug ( string $slug ) : Whups_Query
$slug string A query slug.
리턴 Whups_Query The matching query or null if not found.
예제 #1
0
파일: rss.php 프로젝트: jubinpatel/horde
 *
 * 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;
}
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']));
예제 #2
0
파일: run.php 프로젝트: jubinpatel/horde
 * 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();
// 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');
    }