From 93e0274ef130b72b9375d3e0adcfe88ba5d16702 Mon Sep 17 00:00:00 2001 From: Christian Klinger Date: Tue, 9 Aug 2016 12:59:33 +0200 Subject: Added link from locations module to roomplanner. --- modules-available/locations/inc/location.inc.php | 11 +++++++++++ modules-available/locations/page.inc.php | 9 +++++++++ modules-available/locations/templates/location-subnets.html | 6 ++++++ 3 files changed, 26 insertions(+) (limited to 'modules-available') 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 '
';
+		// var_dump($data);
+		// echo '
'; 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 @@
+
+ {{#isLeaf}} + {{lang_editRoomplan}} + {{/isLeaf}} + +
-- cgit v1.2.3-55-g7522