|
|
@ -1,11 +1,9 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
namespace Engelsystem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Exception;
|
|
|
|
namespace Engelsystem;
|
|
|
|
|
|
|
|
|
|
|
|
class ShiftCalendarRenderer
|
|
|
|
class ShiftCalendarRenderer
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 15m * 60s/m = 900s
|
|
|
|
* 15m * 60s/m = 900s
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -69,9 +67,7 @@ class ShiftCalendarRenderer
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Assigns the shifts to different lanes per room if they collide
|
|
|
|
* Assigns the shifts to different lanes per room if they collide
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param array[] $shifts
|
|
|
|
* @param array[] $shifts The shifts to assign
|
|
|
|
* The shifts to assign
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return array Returns an array that assigns a room_id to an array of ShiftCalendarLane containing the shifts
|
|
|
|
* @return array Returns an array that assigns a room_id to an array of ShiftCalendarLane containing the shifts
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private function assignShiftsToLanes($shifts)
|
|
|
|
private function assignShiftsToLanes($shifts)
|
|
|
@ -113,7 +109,6 @@ class ShiftCalendarRenderer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return int
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getFirstBlockStartTime()
|
|
|
|
public function getFirstBlockStartTime()
|
|
|
@ -122,7 +117,6 @@ class ShiftCalendarRenderer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return int
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getLastBlockEndTime()
|
|
|
|
public function getLastBlockEndTime()
|
|
|
@ -131,7 +125,6 @@ class ShiftCalendarRenderer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return float
|
|
|
|
* @return float
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function getBlocksPerSlot()
|
|
|
|
public function getBlocksPerSlot()
|
|
|
@ -178,8 +171,7 @@ class ShiftCalendarRenderer
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Renders a single lane
|
|
|
|
* Renders a single lane
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param ShiftCalendarLane $lane
|
|
|
|
* @param ShiftCalendarLane $lane The lane to render
|
|
|
|
* The lane to render
|
|
|
|
|
|
|
|
* @return string
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private function renderLane(ShiftCalendarLane $lane)
|
|
|
|
private function renderLane(ShiftCalendarLane $lane)
|
|
|
@ -196,7 +188,12 @@ class ShiftCalendarRenderer
|
|
|
|
$rendered_until += ShiftCalendarRenderer::SECONDS_PER_ROW;
|
|
|
|
$rendered_until += ShiftCalendarRenderer::SECONDS_PER_ROW;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
list ($shift_height, $shift_html) = $shift_renderer->render($shift, $this->needed_angeltypes[$shift['SID']], $this->shift_entries[$shift['SID']], $user);
|
|
|
|
list ($shift_height, $shift_html) = $shift_renderer->render(
|
|
|
|
|
|
|
|
$shift,
|
|
|
|
|
|
|
|
$this->needed_angeltypes[$shift['SID']],
|
|
|
|
|
|
|
|
$this->shift_entries[$shift['SID']],
|
|
|
|
|
|
|
|
$user
|
|
|
|
|
|
|
|
);
|
|
|
|
$html .= $shift_html;
|
|
|
|
$html .= $shift_html;
|
|
|
|
$rendered_until += $shift_height * ShiftCalendarRenderer::SECONDS_PER_ROW;
|
|
|
|
$rendered_until += $shift_height * ShiftCalendarRenderer::SECONDS_PER_ROW;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -215,10 +212,8 @@ class ShiftCalendarRenderer
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Renders a tick/block for given time
|
|
|
|
* Renders a tick/block for given time
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param int $time
|
|
|
|
* @param int $time unix timestamp
|
|
|
|
* unix timestamp
|
|
|
|
* @param boolean $label Should time labels be generated?
|
|
|
|
* @param boolean $label
|
|
|
|
|
|
|
|
* Should time labels be generated?
|
|
|
|
|
|
|
|
* @return string rendered tick html
|
|
|
|
* @return string rendered tick html
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private function renderTick($time, $label = false)
|
|
|
|
private function renderTick($time, $label = false)
|
|
|
@ -261,7 +256,6 @@ class ShiftCalendarRenderer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param array[] $shifts
|
|
|
|
* @param array[] $shifts
|
|
|
|
* @return int
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -277,7 +271,6 @@ class ShiftCalendarRenderer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param array[] $shifts
|
|
|
|
* @param array[] $shifts
|
|
|
|
* @return int
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -293,7 +286,6 @@ class ShiftCalendarRenderer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return int
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private function calcBlocksPerSlot()
|
|
|
|
private function calcBlocksPerSlot()
|
|
|
|