From: Ben Klang Date: Thu, 26 Jun 2008 17:31:47 +0000 (+0000) Subject: Stub of page to display per-month call stats X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2843fab9cd61bb4dcdc6c6a4f267ab187ab0f4c1;p=horde.git Stub of page to display per-month call stats --- diff --git a/viewgraph.php b/viewgraph.php new file mode 100644 index 000000000..a40ccaa14 --- /dev/null +++ b/viewgraph.php @@ -0,0 +1,72 @@ + + * + * See the enclosed file COPYING for license information (GPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/gpl.html. + * + * @author Ben Klang + */ + +@define('OPERATOR_BASE', dirname(__FILE__)); +require_once OPERATOR_BASE . '/lib/base.php'; + +// Form libraries. +require_once 'Horde/Form.php'; +require_once 'Horde/Form/Renderer.php'; +require_once 'Horde/Variables.php'; +require_once OPERATOR_BASE . '/lib/Form/SearchCDR.php'; + +$renderer = new Horde_Form_Renderer(); +$vars = Variables::getDefaultVariables(); + +$form = new SearchCDRForm($vars); +if ($form->isSubmitted() && $form->validate($vars, true)) { + if ($vars->exists('accountcode')) { + $accountcode = $vars->get('accountcode'); + } else { + $accountcode = ''; + } + $start = new Horde_Date($vars->get('startdate')); + $end = new Horde_Date($vars->get('enddate')); + $data = $operator_driver->getData($accountcode, $start, $end); + $_SESSION['operator']['lastsearch']['params'] = array( + 'accountcode' => $vars->get('accountcode'), + 'startdate' => $vars->get('startdate'), + 'enddate' => $vars->get('enddate')); + $_SESSION['operator']['lastsearch']['data'] = $data; +} else { + if (isset($_SESSION['operator']['lastsearch']['params'])) { + foreach($_SESSION['operator']['lastsearch']['params'] as $var => $val) { + $vars->set($var, $val); + } + } + if (isset($_SESSION['operator']['lastsearch']['data'])) { + $data = $_SESSION['operator']['lastsearch']['data']; + } +} + +$startdate = array('year' => 2007, + 'month' => 1, + 'mday' => 1); +$enddate = array('year' => date('Y'), + 'month' => date('n'), + 'mday' => date('j')); + +$startdate = new Horde_Date($startdate); +$enddate = new Horde_Date($enddate); +$accountcode = null; +$dcontext = null; + +$stats = $operator_driver->getCallStats($startdate, $enddate, $accountcode, $dcontext); + +$title = _("Call Statistics"); +Horde::addScriptFile('stripe.js', 'horde', true); + +require OPERATOR_TEMPLATES . '/common-header.inc'; +require OPERATOR_TEMPLATES . '/menu.inc'; + +print_r($stats); +require $registry->get('templates', 'horde') . '/common-footer.inc';