summaryrefslogtreecommitdiff
path: root/includes/model/Shifts_model.php
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2014-12-07 17:34:29 +0100
committerPhilip Häusler <msquare@notrademark.de>2014-12-07 17:34:29 +0100
commitfa0e38ebff81a02f89bd4493627c49bbc48bc93b (patch)
treee29baae5ea6d4ca5888125063a0ea6da9a6c0ddf /includes/model/Shifts_model.php
parent156db1eadd905c7ee4c7c37dc246c8c689ae2396 (diff)
add shift create model
Diffstat (limited to 'includes/model/Shifts_model.php')
-rw-r--r--includes/model/Shifts_model.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index c66cfb83..a9a9244e 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -1,5 +1,25 @@
<?php
+/**
+ * Create a new shift.
+ * @return new shift id or false
+ */
+function Shift_create($shift) {
+ $result = sql_query("INSERT INTO `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']));
+ if ($result === false)
+ return false;
+ return sql_id();
+}
+
+/**
+ * Return users shifts.
+ */
function Shifts_by_user($user) {
return sql_select("
SELECT *