diff options
Diffstat (limited to 'model/Schedule.php')
-rw-r--r-- | model/Schedule.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/model/Schedule.php b/model/Schedule.php index 371a8ce..96ac28e 100644 --- a/model/Schedule.php +++ b/model/Schedule.php @@ -107,8 +107,21 @@ class Schedule extends ModelBase if($room_known) $name = $mapping[$name]; + $eventsSorted = []; foreach($room->event as $event) { + $eventsSorted[] = $event; + } + + usort($eventsSorted, function($a, $b) { + $a_start = (string)$a->date; + $b_start = (string)$b->date; + + return strcmp($a_start, $b_start); + }); + + foreach($eventsSorted as $event) + { $start = strtotime((string)$event->date); $duration = $this->strToDuration((string)$event->duration); $end = $start + $duration; |