summaryrefslogtreecommitdiff
path: root/includes/model/Shifts_model.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-10-09 21:47:31 +0200
committermsquare <msquare@notrademark.de>2018-10-31 13:43:23 +0100
commit89e62c95a7ffd71a8e860f59378ecd13d6cbb196 (patch)
treea26965030177112a0d54a232c81ffd21d48529de /includes/model/Shifts_model.php
parentb069a938c6721ab5adddcbec4cff858ded6f0e1e (diff)
Changed more functions :tada:
Diffstat (limited to 'includes/model/Shifts_model.php')
-rw-r--r--includes/model/Shifts_model.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/includes/model/Shifts_model.php b/includes/model/Shifts_model.php
index 30ce5a97..e03ca0bf 100644
--- a/includes/model/Shifts_model.php
+++ b/includes/model/Shifts_model.php
@@ -326,7 +326,7 @@ function Shift_signup_allowed_angel(
}
if (empty($user_shifts)) {
- $user_shifts = Shifts_by_user($user);
+ $user_shifts = Shifts_by_user($user['UID']);
}
$signed_up = false;
@@ -352,7 +352,7 @@ function Shift_signup_allowed_angel(
}
if (empty($user_angeltype)) {
- $user_angeltype = UserAngelType_by_User_and_AngelType($user, $angeltype);
+ $user_angeltype = UserAngelType_by_User_and_AngelType($user['UID'], $angeltype);
}
if (
@@ -577,7 +577,7 @@ function Shift_update_by_psid($shift)
*/
function Shift_create($shift)
{
- global $user;
+ $user = auth()->user();
DB::insert('
INSERT INTO `Shifts` (
`shifttype_id`,
@@ -601,7 +601,7 @@ function Shift_create($shift)
$shift['title'],
$shift['URL'],
$shift['PSID'],
- $user['UID'],
+ $user->id,
time(),
time(),
]
@@ -613,11 +613,11 @@ function Shift_create($shift)
/**
* Return users shifts.
*
- * @param array $user
+ * @param int $userId
* @param bool $include_freeload_comments
* @return array[]
*/
-function Shifts_by_user($user, $include_freeload_comments = false)
+function Shifts_by_user($userId, $include_freeload_comments = false)
{
return DB::select('
SELECT
@@ -640,7 +640,7 @@ function Shifts_by_user($user, $include_freeload_comments = false)
ORDER BY `start`
',
[
- $user['UID']
+ $userId
]
);
}