summaryrefslogtreecommitdiff
path: root/includes/model
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-12-07 17:41:40 +0100
committerPhilip Häusler <msquare@notrademark.de>2014-12-07 17:41:40 +0100
commitd26f8aa12cd71cd5301e6747fbedf6bfbe2ac37f (patch)
tree8e3d783bb6433a1ead0864ae87551d1ed697ce84 /includes/model
parentfa0e38ebff81a02f89bd4493627c49bbc48bc93b (diff)
add shift update model
Diffstat (limited to 'includes/model')
-rw-r--r--includes/model/Shifts_model.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index a9a9244e..a1d7967f 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -1,7 +1,35 @@
<?php
/**
+ * Update a shift.
+ */
+function Shift_update($shift) {
+ return sql_query("UPDATE `Shifts` SET
+ `start`=" . sql_escape($shift['start']) . ",
+ `end`=" . sql_escape($shift['end']) . ",
+ `RID`=" . sql_escape($shift['RID']) . ",
+ `name`=" . sql_null($shift['name']) . ",
+ `URL`=" . sql_null($shift['URL']) . ",
+ `PSID`=" . sql_null($shift['PSID']) . "
+ WHERE `SID`=" . sql_escape($shift['SID']));
+}
+
+/**
+ * Update a shift by its external id.
+ */
+function Shift_update_by_psid($shift) {
+ return sql_query("UPDATE `Shifts` SET
+ `start`=" . sql_escape($shift['start']) . ",
+ `end`=" . sql_escape($shift['end']) . ",
+ `RID`=" . sql_escape($shift['RID']) . ",
+ `name`=" . sql_null($shift['name']) . ",
+ `URL`=" . sql_null($shift['URL']) . "
+ WHERE `PSID`=" . sql_escape($shift['PSID']));
+}
+
+/**
* Create a new shift.
+ *
* @return new shift id or false
*/
function Shift_create($shift) {