From 89e62c95a7ffd71a8e860f59378ecd13d6cbb196 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Tue, 9 Oct 2018 21:47:31 +0200 Subject: Changed more functions :tada: --- includes/controller/shifts_controller.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'includes/controller/shifts_controller.php') diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index 63d2d4c7..5454c648 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -272,15 +272,15 @@ function shift_controller() $shifttype = ShiftType($shift['shifttype_id']); $room = Room($shift['RID']); $angeltypes = AngelTypes(); - $user_shifts = Shifts_by_user($user); + $user_shifts = Shifts_by_user($user['UID']); $shift_signup_state = new ShiftSignupState(ShiftSignupState::OCCUPIED, 0); foreach ($angeltypes as &$angeltype) { $needed_angeltype = NeededAngeltype_by_Shift_and_Angeltype($shift, $angeltype); - if(empty($needed_angeltype)) { + if (empty($needed_angeltype)) { continue; } - + $shift_entries = ShiftEntries_by_shift_and_angeltype($shift['SID'], $angeltype['id']); $angeltype_signup_state = Shift_signup_allowed( @@ -330,13 +330,14 @@ function shifts_controller() */ function shift_next_controller() { - global $user, $privileges; + global $privileges; + $user = auth()->user(); if (!in_array('user_shifts', $privileges)) { redirect(page_link_to('/')); } - $upcoming_shifts = ShiftEntries_upcoming_for_user($user); + $upcoming_shifts = ShiftEntries_upcoming_for_user($user->id); if (!empty($upcoming_shifts)) { redirect(shift_link($upcoming_shifts[0])); @@ -381,7 +382,5 @@ function shifts_json_export_controller() */ function load_ical_shifts() { - global $user; - - return Shifts_by_user($user); + return Shifts_by_user(auth()->user()->id); } -- cgit v1.2.3-70-g09d2