summaryrefslogtreecommitdiffstats
path: root/modules-available/locations
diff options
context:
space:
mode:
authorChristian Klinger2016-08-09 12:59:33 +0200
committerChristian Klinger2016-08-09 12:59:33 +0200
commit93e0274ef130b72b9375d3e0adcfe88ba5d16702 (patch)
treeec19f3f61bbcf3b8c98ec0411fbccad9198494df /modules-available/locations
parentloading & saving of roomconfig. (diff)
downloadslx-admin-93e0274ef130b72b9375d3e0adcfe88ba5d16702.tar.gz
slx-admin-93e0274ef130b72b9375d3e0adcfe88ba5d16702.tar.xz
slx-admin-93e0274ef130b72b9375d3e0adcfe88ba5d16702.zip
Added link from locations module to roomplanner.
Diffstat (limited to 'modules-available/locations')
-rw-r--r--modules-available/locations/inc/location.inc.php11
-rw-r--r--modules-available/locations/page.inc.php9
-rw-r--r--modules-available/locations/templates/location-subnets.html6
3 files changed, 26 insertions, 0 deletions
diff --git a/modules-available/locations/inc/location.inc.php b/modules-available/locations/inc/location.inc.php
index 69ddb4ee..a018208d 100644
--- a/modules-available/locations/inc/location.inc.php
+++ b/modules-available/locations/inc/location.inc.php
@@ -137,6 +137,7 @@ class Location
'locationid' => $node['locationid'],
'locationname' => $node['locationname'],
'locationpad' => str_repeat('--', $depth),
+ 'isleaf' => empty($node['children']),
'depth' => $depth
);
if (!empty($node['children'])) {
@@ -146,6 +147,15 @@ class Location
return $output;
}
+ public static function isLeaf($locationid) {
+ $result = Database::queryFirst('SELECT COUNT(locationid) = 0 AS isleaf '
+ . 'FROM location '
+ . 'WHERE parentlocationid = :locationid', ['locationid' => $locationid]);
+ $result = $result['isleaf'];
+ settype($result, 'bool');
+ return $result;
+ }
+
public static function extractIds($tree)
{
$ids = array();
@@ -298,6 +308,7 @@ class Location
return $locs;
}
+
private static function findOverlap($locs, $subnets, &$overlapSelf, &$overlapOther)
{
if ($overlapSelf) {
diff --git a/modules-available/locations/page.inc.php b/modules-available/locations/page.inc.php
index 464c4c95..b1146959 100644
--- a/modules-available/locations/page.inc.php
+++ b/modules-available/locations/page.inc.php
@@ -412,6 +412,7 @@ class Page_Locations extends Page
'locationid' => $loc['locationid'],
'locationname' => $loc['locationname'],
'list' => $rows,
+ 'isLeaf' => Location::isLeaf($locationId),
'parents' => Location::getLocations($loc['parentlocationid'], $locationId, true)
);
if (Module::get('dozmod') !== false) {
@@ -443,6 +444,14 @@ class Page_Locations extends Page
$data['machines_online'] = $online;
$data['machines_used'] = $used;
$data['used_percent'] = $online === 0 ? 0 : round(100 * $used / $online);
+
+
+ $data['havebaseconfig'] = Module::get('baseconfig') !== false;
+ $data['havesysconfig'] = Module::get('sysconfig') !== false;
+
+ // echo '<pre>';
+ // var_dump($data);
+ // echo '</pre>';
echo Render::parse('location-subnets', $data);
}
diff --git a/modules-available/locations/templates/location-subnets.html b/modules-available/locations/templates/location-subnets.html
index a7afaa35..70b21113 100644
--- a/modules-available/locations/templates/location-subnets.html
+++ b/modules-available/locations/templates/location-subnets.html
@@ -59,6 +59,12 @@
</tr>
</table>
<br>
+ <div class="btn-group">
+ {{#isLeaf}}
+ <a class="btn btn-default" href="?do=roomplanner&amp;locationid={{locationid}}"><span class="glyphicon glyphicon-move"></span>{{lang_editRoomplan}}</a>
+ {{/isLeaf}}
+
+ </div>
<div class="pull-right">
<button type="submit" class="btn btn-primary">{{lang_save}}</button>
</div>