summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/baseconfig
diff options
context:
space:
mode:
authorSimon Rettberg2017-07-11 12:08:53 +0200
committerSimon Rettberg2017-07-11 12:08:53 +0200
commit1cfb2dc5e668bd82f62a5606e80ad61b56b8596c (patch)
tree8d6dbe1756ae043a45b65539a316ef55ae7dae0b /modules-available/locations/baseconfig
parent[baseconfig] Make ConfigHolder static, change default prio, add getter (diff)
downloadslx-admin-1cfb2dc5e668bd82f62a5606e80ad61b56b8596c.tar.gz
slx-admin-1cfb2dc5e668bd82f62a5606e80ad61b56b8596c.tar.xz
slx-admin-1cfb2dc5e668bd82f62a5606e80ad61b56b8596c.zip
[*] Adapt to new baseconfig API
Diffstat (limited to 'modules-available/locations/baseconfig')
-rw-r--r--modules-available/locations/baseconfig/getconfig.inc.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules-available/locations/baseconfig/getconfig.inc.php b/modules-available/locations/baseconfig/getconfig.inc.php
index 3a0c918f..f21503f1 100644
--- a/modules-available/locations/baseconfig/getconfig.inc.php
+++ b/modules-available/locations/baseconfig/getconfig.inc.php
@@ -17,7 +17,7 @@ $matchingLocations = array();
if ($locationId !== false) {
// Get all parents
$matchingLocations = Location::getLocationRootChain($locationId);
- $configVars["SLX_LOCATIONS"] = implode(' ', $matchingLocations);
+ ConfigHolder::add("SLX_LOCATIONS", implode(' ', $matchingLocations), 100);
}
// Query location specific settings (from bottom to top)
@@ -31,14 +31,15 @@ if (!empty($matchingLocations)) {
}
// $matchingLocations contains the location ids sorted from closest to furthest, so we use it to make sure the order
// in which they override is correct (closest setting wins, e.g. room setting beats department setting)
+ $prio = count($matchingLocations) + 1;
foreach ($matchingLocations as $lid) {
if (!isset($tmp[$lid]))
continue;
+ ConfigHolder::setContext('location-' . $lid);
foreach ($tmp[$lid] as $setting => $value) {
- if (!isset($configVars[$setting])) {
- $configVars[$setting] = $value;
- }
+ ConfigHolder::add($setting, $value, $prio);
}
+ $prio -= 1;
}
unset($tmp);
}