summaryrefslogtreecommitdiffstats
path: root/modules-available/locations
diff options
context:
space:
mode:
authorSimon Rettberg2017-04-27 13:46:42 +0200
committerSimon Rettberg2017-04-27 13:46:42 +0200
commit8666590dd1184970bf8c93415e49f8f4be43ea5b (patch)
treee9c0f1ba79b3400e98c6249daf61f8f519105f29 /modules-available/locations
parent[locationinfo] Clean up translations (diff)
parentRelax anti-caching headers a bit (diff)
downloadslx-admin-8666590dd1184970bf8c93415e49f8f4be43ea5b.tar.gz
slx-admin-8666590dd1184970bf8c93415e49f8f4be43ea5b.tar.xz
slx-admin-8666590dd1184970bf8c93415e49f8f4be43ea5b.zip
Merge branch 'master' into location-info-panel
Diffstat (limited to 'modules-available/locations')
-rw-r--r--modules-available/locations/baseconfig/hook.json3
-rw-r--r--modules-available/locations/inc/location.inc.php16
2 files changed, 18 insertions, 1 deletions
diff --git a/modules-available/locations/baseconfig/hook.json b/modules-available/locations/baseconfig/hook.json
index c295e0f6..b7b3581b 100644
--- a/modules-available/locations/baseconfig/hook.json
+++ b/modules-available/locations/baseconfig/hook.json
@@ -1,5 +1,6 @@
{
"table": "setting_location",
"field": "locationid",
- "tostring": "Location::getName"
+ "tostring": "Location::getName",
+ "getfallback": "Location::getBaseconfigParent"
} \ No newline at end of file
diff --git a/modules-available/locations/inc/location.inc.php b/modules-available/locations/inc/location.inc.php
index 7ac76b3e..8f3447da 100644
--- a/modules-available/locations/inc/location.inc.php
+++ b/modules-available/locations/inc/location.inc.php
@@ -286,6 +286,22 @@ class Location
}
/**
+ * @param $locationId
+ * @return bool|array ('value' => x, 'display' => y), false if no parent or unknown id
+ */
+ public static function getBaseconfigParent($locationId)
+ {
+ settype($locationId, 'integer');
+ $locations = Location::getLocationsAssoc();
+ if (!isset($locations[$locationId]))
+ return false;
+ $locationId = (int)$locations[$locationId]['parentlocationid'];
+ if (!isset($locations[$locationId]))
+ return false;
+ return array('value' => $locationId, 'display' => $locations[$locationId]['locationname']);
+ }
+
+ /**
* @return array list of subnets as numeric array
*/
public static function getSubnets()