Esempio n. 1
0
 public function __construct($title, &$vars)
 {
     parent::__construct($title, $vars);
     $formats = array(Horde_Data::EXPORT_CSV => 'Comma-Delimited (CSV)', Horde_Data::EXPORT_TSV => 'Tab-Delimited');
     $this->addVariable(_("Data Format"), 'format', 'enum', true, false, null, array($formats));
 }
Esempio n. 2
0
 * @author Ben Klang <*****@*****.**>
 */
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);