From cf8cc5f592d4935e857fb5434aaf00168bdcb4c5 Mon Sep 17 00:00:00 2001 From: msquare Date: Sat, 5 Nov 2016 10:06:06 +0100 Subject: change shift table to html5 --- includes/view/ShiftCalendarLane.php | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 includes/view/ShiftCalendarLane.php (limited to 'includes/view/ShiftCalendarLane.php') diff --git a/includes/view/ShiftCalendarLane.php b/includes/view/ShiftCalendarLane.php new file mode 100644 index 00000000..33fccec3 --- /dev/null +++ b/includes/view/ShiftCalendarLane.php @@ -0,0 +1,63 @@ +header = $header; + $this->firstBlockStartTime = $firstBlockStartTime; + $this->blockCount = $blockCount; + } + + /** + * Adds a shift to the lane, but only if it fits. + * Returns true on success. + * + * @param Shift $shift + * The shift to add + * @return boolean true on success + */ + public function addShift($shift) { + if ($this->shiftFits($shift)) { + $this->shifts[] = $shift; + return true; + } + return false; + } + + /** + * Returns true if given shift fits into this lane. + * + * @param Shift $shift + * The shift to fit into this lane + */ + public function shiftFits($newShift) { + foreach ($this->shifts as $laneShift) { + if (! ($newShift['start'] >= $laneShift['end'] || $newShift['end'] <= $laneShift['start'])) { + return false; + } + } + return true; + } + + public function getHeader() { + return $this->header; + } + + public function getShifts() { + return $this->shifts; + } +} +?> \ No newline at end of file -- cgit v1.2.3-54-g00ecf