summaryrefslogtreecommitdiff
path: root/includes/model/ShiftEntry_model.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/model/ShiftEntry_model.php')
-rw-r--r--includes/model/ShiftEntry_model.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php
index 97fdf784..332620f6 100644
--- a/includes/model/ShiftEntry_model.php
+++ b/includes/model/ShiftEntry_model.php
@@ -1,9 +1,25 @@
<?php
/**
+ * Returns next (or current) shifts of given user.
+ * @param User $user
+ */
+function ShiftEntries_upcoming_for_user($user) {
+ return sql_select("
+ SELECT *
+ FROM `ShiftEntry`
+ JOIN `Shifts` ON `Shifts`.`SID`=`ShiftEntry`.`SID`
+ WHERE `ShiftEntry`.`UID`=" . sql_escape($user['UID']) . "
+ AND `Shifts`.`end` > " . sql_escape(time()) . "
+ ORDER BY `Shifts`.`end`
+ ");
+}
+
+/**
* Returns all shift entries in given shift for given angeltype.
- * @param int $shift_id
- * @param int $angeltype_id
+ *
+ * @param int $shift_id
+ * @param int $angeltype_id
*/
function ShiftEntries_by_shift_and_angeltype($shift_id, $angeltype_id) {
return sql_select("