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/locations/inc | |
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/locations/inc')
-rw-r--r-- | modules-available/locations/inc/location.inc.php | 19 | ||||
-rw-r--r-- | modules-available/locations/inc/locationhooks.inc.php | 31 |
2 files changed, 31 insertions, 19 deletions
diff --git a/modules-available/locations/inc/location.inc.php b/modules-available/locations/inc/location.inc.php index ac866cbc..a29be5c3 100644 --- a/modules-available/locations/inc/location.inc.php +++ b/modules-available/locations/inc/location.inc.php @@ -375,25 +375,6 @@ class Location } /** - * Used for baseconfig hook - * @param $locationId - * @return bool|array ('value' => x, 'display' => y), false if no parent or unknown id - */ - public static function getBaseconfigParent($locationId) - { - $locationId = (int)$locationId; - if (self::$assocLocationCache === false) { - self::getLocationsAssoc(); - } - if (!isset(self::$assocLocationCache[$locationId])) - return false; - $locationId = (int)self::$assocLocationCache[$locationId]['parentlocationid']; - if (!isset(self::$assocLocationCache[$locationId])) - return false; - return array('value' => $locationId, 'display' => self::$assocLocationCache[$locationId]['locationname']); - } - - /** * @return array list of subnets as numeric array */ public static function getSubnets() diff --git a/modules-available/locations/inc/locationhooks.inc.php b/modules-available/locations/inc/locationhooks.inc.php new file mode 100644 index 00000000..c15c34ab --- /dev/null +++ b/modules-available/locations/inc/locationhooks.inc.php @@ -0,0 +1,31 @@ +<?php + +class LocationHooks +{ + + /** + * Used for baseconfig hook + * @param $locationId + * @return bool|array ('value' => x, 'display' => y), false if no parent or unknown id + */ + public static function getBaseconfigParent($locationId) + { + $locationId = (int)$locationId; + $assoc = Location::getLocationsAssoc(); + if (!isset($assoc[$locationId])) + return false; + $locationId = (int)$assoc[$locationId]['parentlocationid']; + if (!isset($assoc[$locationId])) + return false; + return array('value' => $locationId, 'display' => $assoc[$locationId]['locationname']); + } + + /** + * Resolve baseconfig id to locationid -- noop in this case + */ + public static function baseconfigLocationResolver($id) + { + return $id; + } + +}
\ No newline at end of file |