aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind2016-08-02 22:23:00 +0200
committerMaZderMind2016-08-02 22:23:00 +0200
commit37f786bf233b901eebf5c0f11fafc19addf752ed (patch)
treea39b42549fc410e630e6b24da8697bd644d3da36
parent632c77889a0c3d7e3c5cf5d4d974f2b866c857e7 (diff)
sort rooms according to roomfilter
Diffstat (limited to '')
-rw-r--r--model/Schedule.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/model/Schedule.php b/model/Schedule.php
index 96ac28e..cc1db55 100644
--- a/model/Schedule.php
+++ b/model/Schedule.php
@@ -208,6 +208,31 @@ class Schedule extends ModelBase
}
}
+
+ if($this->has('SCHEDULE.ROOMFILTER'))
+ {
+ // sort by roomfilter
+ $roomfilter = $this->get('SCHEDULE.ROOMFILTER');
+
+ // map roomfilter-rooms to room-slugs
+ $roomfilter = array_map(function($e) use ($mapping) {
+ if(isset($mapping[$e]))
+ return $mapping[$e];
+
+ return $e;
+ }, $roomfilter);
+
+ // sort according to roomtilter ordering
+ uksort($program, function($a, $b) use ($roomfilter) {
+ return array_search($a, $roomfilter) - array_search($b, $roomfilter);
+ });
+ }
+ else
+ {
+ // sort by key
+ ksort($program);
+ }
+
return $program;
}