summaryrefslogtreecommitdiff
path: root/includes/model/Shifts_model.php
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2013-12-09 17:10:07 +0100
committerPhilip Häusler <msquare@notrademark.de>2013-12-09 17:10:07 +0100
commitad5899f02876e9c2e81804d6d3a58988fae8c3db (patch)
tree76f21c9544bb5e2af5cb4d3772c9949f5d694b00 /includes/model/Shifts_model.php
parent9a1ffdf198c74466b86129568fb78a677dc56025 (diff)
api export for all shifts
Diffstat (limited to 'includes/model/Shifts_model.php')
-rw-r--r--includes/model/Shifts_model.php24
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