summaryrefslogtreecommitdiff
path: root/includes/view/ShiftCalendarRenderer.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-11-15 22:00:17 +0100
committermsquare <msquare@notrademark.de>2016-11-15 22:00:17 +0100
commitac53559feac4948fc082b5384d3c0ca897f18cd0 (patch)
tree95add0bef42847a6320409e76e8118c8b8ca0b18 /includes/view/ShiftCalendarRenderer.php
parent54f3253c32d53bd9642132e45e1c7caab2eae233 (diff)
fix shift calendar headers
Diffstat (limited to 'includes/view/ShiftCalendarRenderer.php')
-rw-r--r--includes/view/ShiftCalendarRenderer.php13
1 files changed, 8 insertions, 5 deletions
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()