summaryrefslogtreecommitdiff
path: root/includes/model/Shifts_model.php
diff options
context:
space:
mode:
authorPhilip Häusler <msquare@notrademark.de>2015-08-15 23:36:38 +0200
committerPhilip Häusler <msquare@notrademark.de>2015-08-15 23:36:38 +0200
commita7189482e92556c33b5a320989faa97be98c82bc (patch)
tree814e5dd9b0958685a5d974de0a46c59f72e5ca1f /includes/model/Shifts_model.php
parentcac86ef509de8543d473db421898b80ca3b8f8e3 (diff)
add shift creator and editor
Diffstat (limited to 'includes/model/Shifts_model.php')
-rw-r--r--includes/model/Shifts_model.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index c12d3e01..d32de0cb 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -101,6 +101,7 @@ function Shift_delete($shift_id) {
* Update a shift.
*/
function Shift_update($shift) {
+ global $user;
$shift['name'] = ShiftType($shift['shifttype_id'])['name'];
mail_shift_change(Shift($shift['SID']), $shift);
@@ -111,7 +112,9 @@ function Shift_update($shift) {
`RID`='" . sql_escape($shift['RID']) . "',
`title`=" . sql_null($shift['title']) . ",
`URL`=" . sql_null($shift['URL']) . ",
- `PSID`=" . sql_null($shift['PSID']) . "
+ `PSID`=" . sql_null($shift['PSID']) . ",
+ `edited_by_user_id`='" . sql_escape($user['UID']) . "',
+ `edited_at_timestamp`=" . time() . "
WHERE `SID`='" . sql_escape($shift['SID']) . "'");
}
@@ -134,6 +137,7 @@ function Shift_update_by_psid($shift) {
* @return new shift id or false
*/
function Shift_create($shift) {
+ global $user;
$result = sql_query("INSERT INTO `Shifts` SET
`shifttype_id`='" . sql_escape($shift['shifttype_id']) . "',
`start`='" . sql_escape($shift['start']) . "',
@@ -141,7 +145,9 @@ function Shift_create($shift) {
`RID`='" . sql_escape($shift['RID']) . "',
`title`=" . sql_null($shift['title']) . ",
`URL`=" . sql_null($shift['URL']) . ",
- `PSID`=" . sql_null($shift['PSID']));
+ `PSID`=" . sql_null($shift['PSID']) . ",
+ `created_by_user_id`='" . sql_escape($user['UID']) . "',
+ `created_at_timestamp`=" . time());
if ($result === false)
return false;
return sql_id();