summaryrefslogtreecommitdiffstats
path: root/modules-available/statistics/inc
diff options
context:
space:
mode:
authorSimon Rettberg2019-10-31 15:15:03 +0100
committerSimon Rettberg2019-10-31 15:15:03 +0100
commite18b0b0c764652d6f77465082eb474330f43915b (patch)
tree7f3a3e588cc6a5f6a9d4c1c02a615d1ab3cb1c98 /modules-available/statistics/inc
parent[statistics] Don't try to show room plan for non-leaf rooms (diff)
downloadslx-admin-e18b0b0c764652d6f77465082eb474330f43915b.tar.gz
slx-admin-e18b0b0c764652d6f77465082eb474330f43915b.tar.xz
slx-admin-e18b0b0c764652d6f77465082eb474330f43915b.zip
[statistics/baseconfig] Allow per-machine configvar overrides
Diffstat (limited to 'modules-available/statistics/inc')
-rw-r--r--modules-available/statistics/inc/statisticshooks.inc.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/modules-available/statistics/inc/statisticshooks.inc.php b/modules-available/statistics/inc/statisticshooks.inc.php
new file mode 100644
index 00000000..ead4917b
--- /dev/null
+++ b/modules-available/statistics/inc/statisticshooks.inc.php
@@ -0,0 +1,37 @@
+<?php
+
+class StatisticsHooks
+{
+
+ private static $row = false;
+
+ private static function getRow($machineuuid)
+ {
+ if (self::$row !== false)
+ return;
+ self::$row = Database::queryFirst('SELECT hostname, clientip, locationid FROM machine WHERE machineuuid = :machineuuid',
+ ['machineuuid' => $machineuuid]);
+ }
+
+ public static function getBaseconfigName($machineuuid)
+ {
+ self::getRow($machineuuid);
+ if (self::$row === false)
+ return false;
+ return self::$row['hostname'] ? self::$row['hostname'] : self::$row['clientip'];
+ }
+
+ public static function getBaseconfigParent($machineuuid)
+ {
+ return false; // TODO
+ }
+
+ public static function baseconfigLocationResolver($machineuuid)
+ {
+ self::getRow($machineuuid);
+ if (self::$row === false)
+ return 0;
+ return (int)self::$row['locationid'];
+ }
+
+} \ No newline at end of file