aboutsummaryrefslogtreecommitdiff
path: root/model/Schedule.php
diff options
context:
space:
mode:
authorMaZderMind2016-08-06 12:46:47 +0200
committerMaZderMind2016-08-06 12:47:26 +0200
commit6250f381d68256f7a23c369d169ad2e103205fed (patch)
treea76abed02201f51062476e1bb879b88c292720e6 /model/Schedule.php
parent2bfe55c99cfde006c755af8bc70dd01a6ab3a43c (diff)
sort days in the schedule
Diffstat (limited to 'model/Schedule.php')
-rw-r--r--model/Schedule.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/model/Schedule.php b/model/Schedule.php
index cc1db55..0b2958e 100644
--- a/model/Schedule.php
+++ b/model/Schedule.php
@@ -85,9 +85,20 @@ class Schedule extends ModelBase
$day['end'] = $dayend;
}
- $dayidx = 0;
+
+ $daysSorted = [];
foreach($schedule->day as $day)
{
+ $daysSorted[] = $day;
+ }
+
+ usort($daysSorted, function($a, $b) {
+ return (int)$a['start'] - (int)$b['start'];
+ });
+
+ $dayidx = 0;
+ foreach($daysSorted as $day)
+ {
$dayidx++;
$daystart = (int)$day['start'];
$dayend = (int)$day['end'];