diff options
author | MaZderMind | 2016-08-02 22:12:09 +0200 |
---|---|---|
committer | MaZderMind | 2016-08-02 22:12:09 +0200 |
commit | 632c77889a0c3d7e3c5cf5d4d974f2b866c857e7 (patch) | |
tree | 2324628ad2af3bc77a3a8bc16ed88c5cd5600910 /model | |
parent | a91df33997fdac99c5f7ed8577adebda0a676ec2 (diff) |
sort events in a day (frab does that but not all schedules are sorted that way)
Diffstat (limited to 'model')
-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; |