aboutsummaryrefslogtreecommitdiff
path: root/model
diff options
context:
space:
mode:
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;
}