diff options
author | Andreas Hubel | 2019-06-07 23:35:46 +0200 |
---|---|---|
committer | Andreas Hubel | 2019-06-07 23:35:46 +0200 |
commit | b93a03b6c477d60384c540a6eeab0314eeedb4ba (patch) | |
tree | 3ad5c413f5ada09935cbfa4d93ef9d8f8978695d | |
parent | d16f2d888819d19b547ff3caec3f7e34f768dac0 (diff) |
fixed asymetic rendering of events where one room starts a day before the others
-rw-r--r-- | model/Schedule.php | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/model/Schedule.php b/model/Schedule.php index 143bd0a..712ecf8 100644 --- a/model/Schedule.php +++ b/model/Schedule.php @@ -81,6 +81,7 @@ class Schedule return []; $program = array(); + $rooms = array(); // re-calculate day-ends // some schedules have long gaps before the first talk or talks that expand beyond the dayend @@ -96,6 +97,9 @@ class Schedule $roomName = (string)$room['name']; if($this->isRoomFiltered($roomName)) continue; + + if(!in_array($roomName, $rooms)) + $rooms[] = $roomName; foreach($room->event as $event) { @@ -131,15 +135,39 @@ class Schedule $dayend = (int)$day['end']; $roomidx = 0; - foreach($day->room as $room) + foreach($rooms as $roomName) { $roomidx++; $lastend = false; - $roomName = trim((string)$room['name']); if($this->isRoomFiltered($roomName)) continue; + $result = $day->xpath("room[@name='".$roomName."']"); + if(!$result) { + // this room has no events on this day -> add long gap + $program[$roomName][] = array( + 'special' => 'gap', + + 'fstart' => date('c', $daystart), + 'fend' => date('c', $dayend), + + 'start' => $daystart, + 'end' => $dayend, + 'duration' => $dayend - $daystart, + ); + $program[$roomName][] = array( + 'special' => 'daychange', + 'title' => 'Daychange from Day '.$dayidx.' to '.($dayidx+1), + + 'start' => $dayend, + 'end' => (int)$schedule->day[$dayidx]['start'], + 'duration' => 60*60, + ); + continue; + } + $room = $result[0]; + $eventsSorted = []; foreach($room->event as $event) { |