diff options
Diffstat (limited to 'includes/model/Shifts_model.php')
-rw-r--r-- | includes/model/Shifts_model.php | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php new file mode 100644 index 00000000..84d14c7a --- /dev/null +++ b/includes/model/Shifts_model.php @@ -0,0 +1,24 @@ +<?php + +/** + * Returns all shifts with needed angeltypes and count of subscribed jobs. + */ +function Shifts() { + $shifts_source = sql_select(" + SELECT `Shifts`.*, `Room`.`RID`, `Room`.`Name` as `room_name` + FROM `Shifts` + JOIN `Room` ON `Room`.`RID` = `Shifts`.`RID` + "); + if ($shifts_source === false) + return false; + + foreach ($shifts_source as &$shift) { + $needed_angeltypes = NeededAngelTypes_by_shift($shift); + if ($needed_angeltypes === false) + return false; + + $shift['angeltypes'] = $needed_angeltypes; + } +} + +?>
\ No newline at end of file |