diff options
author | Udo Walter | 2017-01-16 18:59:46 +0100 |
---|---|---|
committer | Udo Walter | 2017-01-16 18:59:46 +0100 |
commit | 9cd078d34d5f3172e8e770fce3c3ec7d6445a460 (patch) | |
tree | eb549108705ae18d9c7000a5116ef8a8e0bd420f /modules-available/statistics_reporting/page.inc.php | |
parent | [statistics_reporting] improved anonymization (diff) | |
download | slx-admin-9cd078d34d5f3172e8e770fce3c3ec7d6445a460.tar.gz slx-admin-9cd078d34d5f3172e8e770fce3c3ec7d6445a460.tar.xz slx-admin-9cd078d34d5f3172e8e770fce3c3ec7d6445a460.zip |
[statistics_reporting] added ui to disable the reporting
Diffstat (limited to 'modules-available/statistics_reporting/page.inc.php')
-rw-r--r-- | modules-available/statistics_reporting/page.inc.php | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index 941bf12f..1428848a 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -4,6 +4,8 @@ class Page_Statistics_Reporting extends Page { + private $action = false; + /** * Called before any page rendering happens - early hook to check parameters etc. */ @@ -15,6 +17,8 @@ class Page_Statistics_Reporting extends Page Message::addError('main.no-permission'); Util::redirect('?do=Main'); // does not return } + + $this->action = Request::any('action', 'show', 'string'); } /** @@ -22,20 +26,31 @@ class Page_Statistics_Reporting extends Page */ protected function doRender() { - // timespan you want to see = Days selected * seconds per Day (86400) - // default = 14 days - GetData::$from = strtotime("- ".(Request::get('cutoff', 14, 'int') - 1)." days 00:00:00"); - GetData::$to = time(); - GetData::$lowerTimeBound = Request::get('lower', 0, 'int'); - GetData::$upperTimeBound = Request::get('upper', 24, 'int'); - - $data = array_merge(GetData::total(), array('perLocation' => array(), 'perClient' => array(), 'perUser' => array(), 'perVM' => array())); - $data['perLocation'] = GetData::perLocation(); - $data['perClient'] = GetData::perClient(); - $data['perUser'] = GetData::perUser(); - $data['perVM'] = GetData::perVM(); - - Render::addTemplate('columnChooser'); - Render::addTemplate('_page', $data); + if ($this->action === 'show') { + // timespan you want to see. default = last 7 days + GetData::$from = strtotime("- " . (Request::get('cutoff', 14, 'int') - 1) . " days 00:00:00"); + GetData::$to = time(); + GetData::$lowerTimeBound = Request::get('lower', 0, 'int'); + GetData::$upperTimeBound = Request::get('upper', 24, 'int'); + + $data = array_merge(GetData::total(), array('perLocation' => array(), 'perClient' => array(), 'perUser' => array(), 'perVM' => array())); + $data['perLocation'] = GetData::perLocation(); + $data['perClient'] = GetData::perClient(); + $data['perUser'] = GetData::perUser(); + $data['perVM'] = GetData::perVM(); + + Render::addTemplate('columnChooser'); + Render::addTemplate('_page', $data); + } + } + + protected function doAjax() + { + $this->action = Request::any('action', false, 'string'); + if ($this->action === 'setReporting') { + Property::set("reportingStatus", Request::get('reporting', "on", 'string')); + } elseif ($this->action === 'getReporting') { + echo Property::get("reportingStatus", "on"); + } } } |