Exemple #1
0
 */
require_once __DIR__ . '/lib/Application.php';
$operator = Horde_Registry::appInit('operator');
require_once OPERATOR_BASE . '/lib/Form/SearchCDR.php';
$cache = $GLOBALS['cache'];
$renderer = new Horde_Form_Renderer();
$vars = Horde_Variables::getDefaultVariables();
if (!$vars->exists('rowstart')) {
    $rowstart = 0;
} elseif (!is_numeric($rowstart = $vars->get('rowstart'))) {
    $notification->push(_("Invalid number for row start.  Using 0."));
    $rowstart = 0;
}
$data = $session->get('operator', 'lastdata', Horde_Session::TYPE_ARRAY);
$form = new SearchCDRForm(_("Search Call Detail Records"), $vars);
if ($form->isSubmitted() && $form->validate($vars, true)) {
    $accountcode = $vars->get('accountcode');
    $dcontext = $vars->get('dcontext');
    if (empty($dcontext)) {
        $dcontext = '%';
    }
    try {
        $start = new Horde_Date($vars->get('startdate'));
        $end = new Horde_Date($vars->get('enddate'));
        list($stats, $data) = $operator->driver->getRecords($start, $end, $accountcode, $dcontext, $rowstart, $GLOBALS['conf']['storage']['searchlimit']);
        $session->set('operator', 'lastsearch/params', array('accountcode' => $vars->get('accountcode'), 'dcontext' => $vars->get('dcontext'), 'startdate' => $vars->get('startdate'), 'enddate' => $vars->get('enddate')));
        $session->set('operator', 'lastdata', $data);
    } catch (Exception $e) {
        //$notification->push(_("Invalid date requested."));
        $notification->push($e);
        $data = array();