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.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php
index 008531ff..6324c3bf 100644
--- a/includes/model/ShiftEntry_model.php
+++ b/includes/model/ShiftEntry_model.php
@@ -85,6 +85,23 @@ function ShiftEntries_upcoming_for_user($user) {
}
/**
+ * Returns shifts completed by the given user.
+ *
+ * @param User $user
+ */
+function ShiftEntries_finished_by_user($user){
+ return sql_select("
+ SELECT *
+ FROM `ShiftEntry`
+ JOIN `Shifts` ON (`Shifts`.`SID` = `ShiftEntry`.`SID`)
+ JOIN `ShiftTypes` ON `ShiftTypes`.`id` = `Shifts`.`shifttype_id`
+ 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