diff options
author | Philip Häusler <msquare@notrademark.de> | 2014-12-25 22:23:18 +0100 |
---|---|---|
committer | Philip Häusler <msquare@notrademark.de> | 2014-12-25 22:23:18 +0100 |
commit | 34e2f4987558a887ab3bc66b47306ec70cdfbd17 (patch) | |
tree | 0bacd0717aabf2ac51840d2b740f786065219d06 /includes/controller | |
parent | 74b98b8c3e37c2ff578617d3c3b4ab2b02cb06b9 (diff) |
shift signup improvements for shift view
Diffstat (limited to 'includes/controller')
-rw-r--r-- | includes/controller/shifts_controller.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php index 126678a7..90753217 100644 --- a/includes/controller/shifts_controller.php +++ b/includes/controller/shifts_controller.php @@ -41,11 +41,20 @@ function shift_controller() { if ($angeltypes === false) engelsystem_error('Unable to load angeltypes.'); - User_angeltypes($user); + $user_shifts = Shifts_by_user($user); + if ($user_shifts === false) + engelsystem_error('Unable to load users shifts.'); + + $signed_up = false; + foreach ($user_shifts as $user_shift) + if ($user_shift['SID'] == $shift['SID']) { + $signed_up = true; + break; + } return [ $shift['name'], - Shift_view($shift, $shifttype, $room, in_array('admin_shifts', $privileges), $angeltypes, in_array('user_shifts_admin', $privileges), in_array('admin_rooms', $privileges), in_array('shifttypes', $privileges)) + Shift_view($shift, $shifttype, $room, in_array('admin_shifts', $privileges), $angeltypes, in_array('user_shifts_admin', $privileges), in_array('admin_rooms', $privileges), in_array('shifttypes', $privileges), $user_shifts, $signed_up) ]; } |