diff options
author | Simon Rettberg | 2017-02-08 12:13:57 +0100 |
---|---|---|
committer | Simon Rettberg | 2017-02-08 12:13:57 +0100 |
commit | 5a6575b1c07997ba1af20952f435290ce8ce970c (patch) | |
tree | 0c98a876934bb3dbed01549bb814a1c480b5750e /modules-available/statistics_reporting/page.inc.php | |
parent | [statistics_reporting] Fix location highlighting (do it server side) (diff) | |
download | slx-admin-5a6575b1c07997ba1af20952f435290ce8ce970c.tar.gz slx-admin-5a6575b1c07997ba1af20952f435290ce8ce970c.tar.xz slx-admin-5a6575b1c07997ba1af20952f435290ce8ce970c.zip |
[statistics_reporting] Nag user if statistics reporting is disabled
Diffstat (limited to 'modules-available/statistics_reporting/page.inc.php')
-rw-r--r-- | modules-available/statistics_reporting/page.inc.php | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index 90188121..f0614d35 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -55,6 +55,14 @@ class Page_Statistics_Reporting extends Page $this->doExport(); // Does not return } + // Get report - fetch data exactly the way it would automatically be reported + // so the user can know what is going on + if ($this->action === 'getreport') { + $report = RemoteReport::generateReport(strtotime('-7 days'), time('now')); + Header('Content-Disposition: attachment; filename=remote-report.json'); + Header('Content-Type: application/json; charset=utf-8'); + die(json_encode($report)); + } } /** @@ -105,6 +113,13 @@ class Page_Statistics_Reporting extends Page $data['lower'] = $this->lower; $data['upper'] = $this->upper; + if (RemoteReport::isReportingEnabled()) { + $data['settingsButtonClass'] = 'default'; + $data['reportChecked'] = 'checked'; + } else { + $data['settingsButtonClass'] = 'danger'; + } + Render::addTemplate('columnChooser', $data); $data['data'] = $this->fetchData(GETDATA_PRINTABLE); @@ -124,8 +139,15 @@ class Page_Statistics_Reporting extends Page die('Missing setting value.'); } RemoteReport::setReportingEnabled($state); - } elseif ($this->action === 'getReporting') { - echo RemoteReport::isReportingEnabled() ? 'on' : ''; + $data = array(); + if (RemoteReport::isReportingEnabled()) { + $data['class'] = 'default'; + $data['checked'] = true; + } else { + $data['class'] = 'danger'; + } + Header('Content-Type: application/json; charset=utf-8'); + die(json_encode($data)); } else { echo 'Invalid action.'; } |