summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics_reporting
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/statistics_reporting')
-rw-r--r--modules-available/statistics_reporting/config.json9
-rw-r--r--modules-available/statistics_reporting/inc/queries.inc.php12
-rw-r--r--modules-available/statistics_reporting/lang/de/template-tags.json2
-rw-r--r--modules-available/statistics_reporting/lang/en/template-tags.json2
-rw-r--r--modules-available/statistics_reporting/lang/pt/template-tags.json3
-rw-r--r--modules-available/statistics_reporting/page.inc.php4
-rw-r--r--modules-available/statistics_reporting/permissions/permissions.json36
7 files changed, 44 insertions, 24 deletions
diff --git a/modules-available/statistics_reporting/config.json b/modules-available/statistics_reporting/config.json
index 78ca35ba..c439efa8 100644
--- a/modules-available/statistics_reporting/config.json
+++ b/modules-available/statistics_reporting/config.json
@@ -1,4 +1,9 @@
{
"category": "main.status",
- "dependencies": [ "statistics", "locations", "js_stupidtable", "js_jqueryui" ]
-}
+ "dependencies": [
+ "statistics",
+ "locations",
+ "js_stupidtable",
+ "js_jqueryui"
+ ]
+} \ No newline at end of file
diff --git a/modules-available/statistics_reporting/inc/queries.inc.php b/modules-available/statistics_reporting/inc/queries.inc.php
index 395bb548..58e9e63b 100644
--- a/modules-available/statistics_reporting/inc/queries.inc.php
+++ b/modules-available/statistics_reporting/inc/queries.inc.php
@@ -326,9 +326,9 @@ class Queries
public static function getUserStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24) {
$res = Database::simpleQuery("SELECT username AS name, COUNT(*) AS 'count'
FROM statistic
- WHERE typeid='.vmchooser-session-name' AND dateline >= :from and dateline <= :to
- AND FROM_UNIXTIME(dateline, '%H') >= :lowerTimeBound AND FROM_UNIXTIME(dateline, '%H') < :upperTimeBound
- GROUP BY username", compact('from', 'to', 'lowerTimeBound', 'upperTimeBound'));
+ WHERE typeid='.vmchooser-session-name' AND dateline >= $from and dateline <= $to
+ AND FROM_UNIXTIME(dateline, '%H') >= $lowerTimeBound AND FROM_UNIXTIME(dateline, '%H') < $upperTimeBound
+ GROUP BY username");
return $res;
}
@@ -336,9 +336,9 @@ class Queries
public static function getVMStatistics($from, $to, $lowerTimeBound = 0, $upperTimeBound = 24) {
$res = Database::simpleQuery("SELECT data AS name, COUNT(*) AS 'count'
FROM statistic
- WHERE typeid='.vmchooser-session-name' AND dateline >= :from and dateline <= :to
- AND FROM_UNIXTIME(dateline, '%H') >= :lowerTimeBound AND FROM_UNIXTIME(dateline, '%H') < :upperTimeBound
- GROUP BY data", compact('from', 'to', 'lowerTimeBound', 'upperTimeBound'));
+ WHERE typeid='.vmchooser-session-name' AND dateline >= $from and dateline <= $to
+ AND FROM_UNIXTIME(dateline, '%H') >= $lowerTimeBound AND FROM_UNIXTIME(dateline, '%H') < $upperTimeBound
+ GROUP BY data");
return $res;
}
diff --git a/modules-available/statistics_reporting/lang/de/template-tags.json b/modules-available/statistics_reporting/lang/de/template-tags.json
index 397d93de..34c4b80b 100644
--- a/modules-available/statistics_reporting/lang/de/template-tags.json
+++ b/modules-available/statistics_reporting/lang/de/template-tags.json
@@ -14,6 +14,7 @@
"lang_reportingDescription": "Helfen Sie uns bwLehrpool durch das w\u00f6chentliche Verschicken eines anonymisierten Statistikberichts zu verbessern. Wenn Sie den Inhalt eines solchen Reports genauer inspizieren wollen, k\u00f6nnen Sie \u00fcber den untenstehenden Button einen aktuellen Report Ihres Servers herunterladen.",
"lang_reportingLabel": "Anonymisierte Nutzungsstatistiken \u00fcbermitteln",
"lang_sessions": "Sitzungen",
+ "lang_settings": "Einstellungen",
"lang_shortSessions": "Sitzungen < 60s",
"lang_show": "Anzeigen",
"lang_total": "Gesamt",
@@ -22,6 +23,5 @@
"lang_totalSessionTime": "Belegt",
"lang_totalStandbyTime": "Standby",
"lang_totalTime": "Gesamtzeit",
- "lang_user": "Nutzer",
"lang_vm": "Veranstaltung"
} \ 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 a4d19222..7ddc3973 100644
--- a/modules-available/statistics_reporting/lang/en/template-tags.json
+++ b/modules-available/statistics_reporting/lang/en/template-tags.json
@@ -14,6 +14,7 @@
"lang_reportingDescription": "Help us improve bwLehrpool by automatically sending an anonymized statistics report once a week. If you want to check what data the report contains, you can download such a report for reference below.",
"lang_reportingLabel": "Send anonymized usage statistics",
"lang_sessions": "Sessions",
+ "lang_settings": "Settings",
"lang_shortSessions": "Sessions < 60s",
"lang_show": "Show",
"lang_total": "Total",
@@ -22,6 +23,5 @@
"lang_totalSessionTime": "Occupied",
"lang_totalStandbyTime": "Standby",
"lang_totalTime": "Total Time",
- "lang_user": "User",
"lang_vm": "Lecture"
} \ No newline at end of file
diff --git a/modules-available/statistics_reporting/lang/pt/template-tags.json b/modules-available/statistics_reporting/lang/pt/template-tags.json
deleted file mode 100644
index e7981844..00000000
--- a/modules-available/statistics_reporting/lang/pt/template-tags.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "lang_hello": "Olá"
-} \ 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 b30b5cab..cc03e4d8 100644
--- a/modules-available/statistics_reporting/page.inc.php
+++ b/modules-available/statistics_reporting/page.inc.php
@@ -84,6 +84,7 @@ class Page_Statistics_Reporting extends Page
die(json_encode($report));
}
}
+ User::assertPermission('*');
}
/**
@@ -283,6 +284,7 @@ class Page_Statistics_Reporting extends Page
private function fetchData($flags)
{
+ // TODO: Make all modes location-aware, filter while querying, not after
switch ($this->type) {
case 'total':
return GetData::total($flags);
@@ -309,7 +311,7 @@ class Page_Statistics_Reporting extends Page
case 'client':
$data = GetData::perClient($flags, Request::any('new', false, 'string'));
// only show clients from locations which you have permission for
- $filterLocs = User::getAllowedLocations("table.view.location");
+ $filterLocs = User::getAllowedLocations("table.view.client");
foreach ($data as $key => $row) {
if (!in_array($row['locationid'], $filterLocs)) {
unset($data[$key]);
diff --git a/modules-available/statistics_reporting/permissions/permissions.json b/modules-available/statistics_reporting/permissions/permissions.json
index d967b75d..1244027e 100644
--- a/modules-available/statistics_reporting/permissions/permissions.json
+++ b/modules-available/statistics_reporting/permissions/permissions.json
@@ -1,10 +1,26 @@
-[
- "table.view.total",
- "table.view.location",
- "table.view.client",
- "table.view.user",
- "table.view.vm",
- "table.export",
- "reporting.download",
- "reporting.change"
-] \ No newline at end of file
+{
+ "reporting.change": {
+ "location-aware": false
+ },
+ "reporting.download": {
+ "location-aware": false
+ },
+ "table.export": {
+ "location-aware": false
+ },
+ "table.view.client": {
+ "location-aware": true
+ },
+ "table.view.location": {
+ "location-aware": true
+ },
+ "table.view.total": {
+ "location-aware": false
+ },
+ "table.view.user": {
+ "location-aware": false
+ },
+ "table.view.vm": {
+ "location-aware": false
+ }
+} \ No newline at end of file