Exemplo n.º 1
0
                    $qUrl->add("states[{$type}][]", $s);
                }
            } else {
                $qUrl->add("states[{$type}]", $state);
            }
        }
    }
    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);
Exemplo n.º 2
0
Arquivo: rss.php Projeto: horde/horde
<?php

/**
 * Copyright 2008-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.
 *
 * @author Duck <*****@*****.**>
 */
require_once __DIR__ . '/../lib/Application.php';
Horde_Registry::appInit('whups');
$vars = Horde_Variables::getDefaultVariables();
$limit = (int) $vars->get('limit');
$form = new Whups_Form_Search($vars);
if ($form->validate($vars, true)) {
    $form->getInfo($vars, $info);
    $tickets = $whups_driver->getTicketsByProperties($info);
    Whups::sortTickets($tickets, 'date_updated', 'desc');
} else {
    throw new Horde_Exception(_("Invalid search"));
}
$count = 0;
$items = array();
foreach (array_keys($tickets) as $i) {
    if ($limit > 0 && $count++ == $limit) {
        break;
    }
    $description = sprintf(_("Type: %s; State: %s"), $tickets[$i]['type_name'], $tickets[$i]['state_name']);
    $items[$i]['title'] = htmlspecialchars(sprintf('[%s] %s', $tickets[$i]['id'], $tickets[$i]['summary']));
    $items[$i]['description'] = htmlspecialchars($description);