From 9cd078d34d5f3172e8e770fce3c3ec7d6445a460 Mon Sep 17 00:00:00 2001 From: Udo Walter Date: Mon, 16 Jan 2017 18:59:46 +0100 Subject: [statistics_reporting] added ui to disable the reporting --- .../lang/de/template-tags.json | 4 +- .../lang/en/template-tags.json | 4 +- .../statistics_reporting/page.inc.php | 45 ++++++++++++++------- modules-available/statistics_reporting/style.css | 4 ++ .../templates/columnChooser.html | 46 +++++++++++++++++++++- 5 files changed, 85 insertions(+), 18 deletions(-) (limited to 'modules-available') diff --git a/modules-available/statistics_reporting/lang/de/template-tags.json b/modules-available/statistics_reporting/lang/de/template-tags.json index 7dcec880..73c39e1e 100644 --- a/modules-available/statistics_reporting/lang/de/template-tags.json +++ b/modules-available/statistics_reporting/lang/de/template-tags.json @@ -28,5 +28,7 @@ "lang_last30": "Letzten 30 Tage", "lang_last90": "Letzten 90 Tage", "lang_apply": "Anwenden", - "lang_notassigned": "NICHT ZUGEWIESEN" + "lang_save": "Speichern", + "lang_notassigned": "NICHT ZUGEWIESEN", + "lang_reportingDescription": "Helfen Sie uns bwLehrpool, durch das wöchentliche, automatische Verschicken eines anonymisierten Statistikberichts, zu verbessern." } \ No newline at end of file diff --git a/modules-available/statistics_reporting/lang/en/template-tags.json b/modules-available/statistics_reporting/lang/en/template-tags.json index 366a10de..90d59b38 100644 --- a/modules-available/statistics_reporting/lang/en/template-tags.json +++ b/modules-available/statistics_reporting/lang/en/template-tags.json @@ -28,5 +28,7 @@ "lang_last30": "Last 30 days", "lang_last90": "Last 90 days", "lang_apply": "Apply", - "lang_notassigned": "NOT ASSIGNED" + "lang_save": "Save", + "lang_notassigned": "NOT ASSIGNED", + "lang_reportingDescription": "Help us improve bwLehrpool by automatically sending an anonymized statistics report once per week." } \ No newline at end of file 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"); + } } } diff --git a/modules-available/statistics_reporting/style.css b/modules-available/statistics_reporting/style.css index d7fa7a2f..4f314b14 100644 --- a/modules-available/statistics_reporting/style.css +++ b/modules-available/statistics_reporting/style.css @@ -7,6 +7,10 @@ margin-bottom: 10px; } +.top-row #button-settings { + margin-right: 0; +} + .buttonbar button { margin-bottom: 4px; } diff --git a/modules-available/statistics_reporting/templates/columnChooser.html b/modules-available/statistics_reporting/templates/columnChooser.html index 09551fc1..47fef2a5 100644 --- a/modules-available/statistics_reporting/templates/columnChooser.html +++ b/modules-available/statistics_reporting/templates/columnChooser.html @@ -22,6 +22,7 @@
+
@@ -37,6 +38,30 @@
+ + + \ No newline at end of file -- cgit v1.2.3-55-g7522