diff options
author | msquare <msquare@notrademark.de> | 2016-12-24 17:29:12 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2016-12-24 17:29:12 +0100 |
commit | 99c7e8ce1a668f567afed2a40d994961b2da0578 (patch) | |
tree | cd4357bb24b73826af15475db5e40c3adf8d82b0 /includes/view | |
parent | 0c15964e6b32745096b7f650445823c8f2f3be88 (diff) |
fixes #298 allow a shift supporter to remove a user from shift
Diffstat (limited to 'includes/view')
-rw-r--r-- | includes/view/Shifts_view.php | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php index fbd71d54..bd4f19c3 100644 --- a/includes/view/Shifts_view.php +++ b/includes/view/Shifts_view.php @@ -99,6 +99,11 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt } function Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin) { + global $user; + + $angeltype = $angeltypes[$needed_angeltype['TID']]; + $angeltype_supporter = User_is_AngelType_supporter($user, $angeltype); + $needed_angels = ''; $class = 'progress-bar-warning'; @@ -110,17 +115,17 @@ function Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shi } $needed_angels .= '<div class="list-group-item">'; - $needed_angels .= '<div class="pull-right">' . Shift_signup_button_render($shift, $angeltypes[$needed_angeltype['TID']]) . '</div>'; + $needed_angels .= '<div class="pull-right">' . Shift_signup_button_render($shift, $angeltype) . '</div>'; - $needed_angels .= '<h3>' . AngelType_name_render($angeltypes[$needed_angeltype['TID']]) . '</h3>'; - $bar_max = max($needed_angeltype['count']*10, $needed_angeltype['taken']*10, 10); + $needed_angels .= '<h3>' . AngelType_name_render($angeltype) . '</h3>'; + $bar_max = max($needed_angeltype['count'] * 10, $needed_angeltype['taken'] * 10, 10); $bar_value = max(1, $needed_angeltype['taken'] * 10); $needed_angels .= progress_bar(0, $bar_max, $bar_value, $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']); $angels = []; foreach ($shift['ShiftEntry'] as $shift_entry) { if ($shift_entry['TID'] == $needed_angeltype['TID']) { - $angels[] = Shift_view_render_shift_entry($shift_entry, $user_shift_admin); + $angels[] = Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angeltype_supporter); } } @@ -130,14 +135,16 @@ function Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shi return $needed_angels; } -function Shift_view_render_shift_entry($shift_entry, $user_shift_admin) { +function Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angeltype_supporter) { $entry = User_Nick_render(User($shift_entry['UID'])); if ($shift_entry['freeloaded']) { $entry = '<strike>' . $entry . '</strike>'; } - if ($user_shift_admin) { + if ($user_shift_admin || $angeltype_supporter) { $entry .= ' <div class="btn-group">'; - $entry .= button_glyph(page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'], 'pencil', 'btn-xs'); + if ($user_shift_admin) { + $entry .= button_glyph(page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'], 'pencil', 'btn-xs'); + } $entry .= button_glyph(page_link_to('user_shifts') . '&entry_id=' . $shift_entry['id'], 'trash', 'btn-xs'); $entry .= '</div>'; } |