summaryrefslogtreecommitdiffstats
path: root/modules-available/roomplanner/inc/pvsgenerator.inc.php
diff options
context:
space:
mode:
authorChristoph Schulthess2017-02-23 14:43:05 +0100
committerChristoph Schulthess2017-02-23 14:43:05 +0100
commita87a14b9dc6670d1111b8204ae7a1ca14d814c57 (patch)
tree6b3c528804a91ced4ee14bbc4c31fb24541aa4c5 /modules-available/roomplanner/inc/pvsgenerator.inc.php
parentdebugrequest updated, using default SSL Relay Task (diff)
parent[inc/property] Add list-of-values interface (diff)
downloadslx-admin-a87a14b9dc6670d1111b8204ae7a1ca14d814c57.tar.gz
slx-admin-a87a14b9dc6670d1111b8204ae7a1ca14d814c57.tar.xz
slx-admin-a87a14b9dc6670d1111b8204ae7a1ca14d814c57.zip
Merge branch 'master' of git.openslx.org:openslx-ng/slx-admin into remote-debug
Diffstat (limited to 'modules-available/roomplanner/inc/pvsgenerator.inc.php')
-rw-r--r--modules-available/roomplanner/inc/pvsgenerator.inc.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/modules-available/roomplanner/inc/pvsgenerator.inc.php b/modules-available/roomplanner/inc/pvsgenerator.inc.php
index c00d5439..d61e826b 100644
--- a/modules-available/roomplanner/inc/pvsgenerator.inc.php
+++ b/modules-available/roomplanner/inc/pvsgenerator.inc.php
@@ -16,6 +16,8 @@ class PvsGenerator
/* get all rooms */
$rooms = array();
+ // Use left joins everywhere so we still have the complete list of locations below
+ // for figuring out which locations are leafs and which aren't
$ret = Database::simpleQuery(
'SELECT l.locationid, l.parentlocationid, l.locationname, lr.locationid AS notnull, lr.managerip, lr.tutoruuid, m.clientip as tutorip '
. 'FROM location l '
@@ -27,12 +29,27 @@ class PvsGenerator
settype($row['parentlocationid'], 'int');
$rooms[$row['locationid']] = $row;
}
+ // Mark all non-leafs as skip
foreach ($rooms as &$room) {
if ($room['parentlocationid'] > 0 && isset($rooms[$room['parentlocationid']])) {
$rooms[$room['parentlocationid']]['skip'] = true; // Don't just unset, might be wrong order
}
}
- unset($room); // refd!
+ // Now un-mark all where there's at least one child without valid room plan
+ foreach ($rooms as &$room) {
+ if (!isset($room['skip']) && (is_null($room['notnull']) || empty($room['managerip']))) {
+ $room['skip'] = true;
+ $r2 =& $room;
+ while ($r2['parentlocationid'] > 0) {
+ $r2 =& $rooms[$r2['parentlocationid']];
+ if (!(is_null($room['notnull']) || empty($room['managerip']))) {
+ unset($r2['skip']);
+ break;
+ }
+ }
+ }
+ }
+ unset($room, $r2); // refd!
/* collect names and build room blocks - filter empty rooms while at it */
$roomNames = array();