summaryrefslogtreecommitdiff
path: root/includes/controller/shifts_controller.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-11-15 17:22:15 +0100
committermsquare <msquare@notrademark.de>2016-11-15 17:22:15 +0100
commit15243f15fcccfd1f671050144faf2269863df8fc (patch)
tree299f067654d00f62c9d63e3167f0249b1c44de86 /includes/controller/shifts_controller.php
parentec40e10ebd3c343f393a11d8120d197996e4bd69 (diff)
fix shift view
Diffstat (limited to 'includes/controller/shifts_controller.php')
-rw-r--r--includes/controller/shifts_controller.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php
index be0cf127..01a7a2f6 100644
--- a/includes/controller/shifts_controller.php
+++ b/includes/controller/shifts_controller.php
@@ -200,17 +200,19 @@ function shift_controller() {
$angeltypes = AngelTypes();
$user_shifts = Shifts_by_user($user);
- $signed_up = false;
- foreach ($user_shifts as $user_shift) {
- if ($user_shift['SID'] == $shift['SID']) {
- $signed_up = true;
- break;
+ $shift_signup_state = null;
+ foreach ($angeltypes as $angeltype) {
+ $angeltype_signup_state = Shift_signup_allowed($user, $shift, $angeltype, null, $user_shifts);
+ if ($shift_signup_state == null) {
+ $shift_signup_state = $angeltype_signup_state;
+ } else {
+ $shift_signup_state = $shift_signup_state->combineWith($angeltype_signup_state);
}
}
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), $user_shifts, $signed_up)
+ Shift_view($shift, $shifttype, $room, $angeltypes, $user_shifts, $shift_signup_state)
];
}