summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/inc
diff options
context:
space:
mode:
authorSimon Rettberg2016-06-22 17:56:04 +0200
committerSimon Rettberg2016-06-22 17:56:04 +0200
commita6a484ea37aeb91f848c11cb818e2d7d4351d391 (patch)
tree03cc7b9df8dabf61bdb1bc84137601ce187339ef /modules-available/locations/inc
parent[location] Support passing array of selected locs to getLocations() (diff)
downloadslx-admin-a6a484ea37aeb91f848c11cb818e2d7d4351d391.tar.gz
slx-admin-a6a484ea37aeb91f848c11cb818e2d7d4351d391.tar.xz
slx-admin-a6a484ea37aeb91f848c11cb818e2d7d4351d391.zip
[locations/sysconfig] Implement location specific sysconfig
Diffstat (limited to 'modules-available/locations/inc')
-rw-r--r--modules-available/locations/inc/location.inc.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules-available/locations/inc/location.inc.php b/modules-available/locations/inc/location.inc.php
index 788fc588..b1474279 100644
--- a/modules-available/locations/inc/location.inc.php
+++ b/modules-available/locations/inc/location.inc.php
@@ -64,7 +64,7 @@ class Location
return $output;
}
- public static function getLocations($selected = 0, $excludeId = 0, $addNoParent = false)
+ public static function getLocations($selected = 0, $excludeId = 0, $addNoParent = false, $keepArrayKeys = false)
{
if (is_string($selected)) {
settype($selected, 'int');
@@ -99,6 +99,8 @@ class Location
'selected' => $selected === 0
));
}
+ if ($keepArrayKeys)
+ return $rows;
return array_values($rows);
}
@@ -129,14 +131,14 @@ class Location
}
$output = array();
foreach ($tree as $node) {
- $output[] = array(
+ $output[(int)$node['locationid']] = array(
'locationid' => $node['locationid'],
'locationname' => $node['locationname'],
'locationpad' => str_repeat('--', $depth),
'depth' => $depth
);
if (!empty($node['children'])) {
- $output = array_merge($output, self::flattenTree($node['children'], $depth + 1));
+ $output += self::flattenTree($node['children'], $depth + 1);
}
}
return $output;