diff options
author | Simon Rettberg | 2019-10-31 15:15:03 +0100 |
---|---|---|
committer | Simon Rettberg | 2019-10-31 15:15:03 +0100 |
commit | e18b0b0c764652d6f77465082eb474330f43915b (patch) | |
tree | 7f3a3e588cc6a5f6a9d4c1c02a615d1ab3cb1c98 /modules-available/statistics/baseconfig | |
parent | [statistics] Don't try to show room plan for non-leaf rooms (diff) | |
download | slx-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/baseconfig')
-rw-r--r-- | modules-available/statistics/baseconfig/getconfig.inc.php | 15 | ||||
-rw-r--r-- | modules-available/statistics/baseconfig/hook.json | 7 |
2 files changed, 22 insertions, 0 deletions
diff --git a/modules-available/statistics/baseconfig/getconfig.inc.php b/modules-available/statistics/baseconfig/getconfig.inc.php new file mode 100644 index 00000000..ea351d15 --- /dev/null +++ b/modules-available/statistics/baseconfig/getconfig.inc.php @@ -0,0 +1,15 @@ +<?php + +// Location handling: figure out location +if (Request::any('force', 0, 'int') === 1 && Request::any('module', false, 'string') === 'statistics') { + // Force location for testing, but require logged in admin + if (User::load()) { + $uuid = Request::any('value', '', 'string'); + } +} + +// Query machine specific settings +$res = Database::simpleQuery("SELECT setting, value FROM setting_machine WHERE machineuuid = :uuid", ['uuid' => $uuid]); +while ($row = $res->fetch(PDO::FETCH_ASSOC)) { + ConfigHolder::add($row['setting'], $row['value'], 500); +} diff --git a/modules-available/statistics/baseconfig/hook.json b/modules-available/statistics/baseconfig/hook.json new file mode 100644 index 00000000..da28ad5d --- /dev/null +++ b/modules-available/statistics/baseconfig/hook.json @@ -0,0 +1,7 @@ +{ + "table": "setting_machine", + "field": "machineuuid", + "locationResolver": "StatisticsHooks::baseconfigLocationResolver", + "tostring": "StatisticsHooks::getBaseconfigName", + "getfallback": "StatisticsHooks::getBaseconfigParent" +}
\ No newline at end of file |