From 9176261762648668b14778c5e8480a93909936b9 Mon Sep 17 00:00:00 2001 From: Philip Häusler Date: Sun, 7 Dec 2014 16:45:09 +0100 Subject: add shift entry create model --- includes/model/ShiftEntry_model.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'includes/model/ShiftEntry_model.php') diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php index c7895f17..72c1d6d2 100644 --- a/includes/model/ShiftEntry_model.php +++ b/includes/model/ShiftEntry_model.php @@ -7,9 +7,25 @@ function ShiftEntries_freeleaded_count() { return sql_select_single_cell("SELECT COUNT(*) FROM `ShiftEntry` WHERE `freeloaded` = 1"); } +/** + * Create a new shift entry. + * + * @param ShiftEntry $shift_entry + */ +function ShiftEntry_create($shift_entry) { + return sql_query("INSERT INTO `ShiftEntry` SET + `SID`=" . sql_escape($shift_entry['SID']) . ", + `TID`=" . sql_escape($shift_entry['TID']) . ", + `UID`=" . sql_escape($shift_entry['UID']) . ", + `Comment`='" . sql_escape($shift_entry['Comment']) . "', + `freeload_comment`='" . sql_escape($shift_entry['freeload_comment']) . "', + `freeloaded`=" . sql_escape($shift_entry['freeloaded'] ? 'TRUE' : 'FALSE')); +} + /** * Returns next (or current) shifts of given user. - * @param User $user + * + * @param User $user */ function ShiftEntries_upcoming_for_user($user) { return sql_select(" -- cgit v1.2.3-54-g00ecf