From ac53559feac4948fc082b5384d3c0ca897f18cd0 Mon Sep 17 00:00:00 2001 From: msquare Date: Tue, 15 Nov 2016 22:00:17 +0100 Subject: fix shift calendar headers --- includes/view/ShiftCalendarRenderer.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'includes/view/ShiftCalendarRenderer.php') diff --git a/includes/view/ShiftCalendarRenderer.php b/includes/view/ShiftCalendarRenderer.php index 151a39e0..d25f4048 100644 --- a/includes/view/ShiftCalendarRenderer.php +++ b/includes/view/ShiftCalendarRenderer.php @@ -19,7 +19,7 @@ class ShiftCalendarRenderer { * Distance between two shifts in pixels */ const MARGIN = 5; - + /** * Seconds added to the start and end time */ @@ -56,12 +56,12 @@ class ShiftCalendarRenderer { foreach ($shifts as $shift) { $room_id = $shift['RID']; + $header = Room_name_render([ + 'RID' => $room_id, + 'Name' => $shift['room_name'] + ]); if (! isset($lanes[$room_id])) { // initialize room with one lane - $header = Room_name_render([ - 'RID' => $room_id, - 'Name' => $shift['room_name'] - ]); $lanes[$room_id] = [ new ShiftCalendarLane($header, $this->getFirstBlockStartTime(), $this->getBlocksPerSlot()) ]; @@ -108,6 +108,9 @@ class ShiftCalendarRenderer { * @return the generated html */ public function render() { + if (count($this->lanes) == 0) { + return ''; + } return div('shift-calendar', [ $this->renderTimeLane(), $this->renderShiftLanes() -- cgit v1.2.3-54-g00ecf