summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2017-12-26 13:09:44 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2017-12-26 14:35:33 +0100
commitf1b794697579d63a49345e50861b14874419bab5 (patch)
treef6cf08ab2cbe6a36bd5c3842c425eabee5accff1 /includes
parentb9bbcb93603b4416da2fb59b63c7dbcdf4935bba (diff)
Removed some short ifs from Shifts_view.php
Diffstat (limited to 'includes')
-rw-r--r--includes/view/Shifts_view.php70
1 files changed, 39 insertions, 31 deletions
diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php
index 44c879d2..755fab74 100644
--- a/includes/view/Shifts_view.php
+++ b/includes/view/Shifts_view.php
@@ -122,39 +122,47 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
$needed_angels .= Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin);
}
+ $content = [msg()];
+
+ if ($shift_signup_state->getState() == ShiftSignupState::COLLIDES) {
+ $content[] = info(_('This shift collides with one of your shifts.'), true);
+ }
+
+ if ($shift_signup_state->getState() == ShiftSignupState::SIGNED_UP) {
+ $content[] = info(_('You are signed up for this shift.'), true);
+ }
+
+ $buttons = [];
+ if ($shift_admin || $admin_shifttypes || $admin_rooms) {
+ $buttons = [
+ $shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '',
+ $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '',
+ $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '',
+ $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '',
+ ];
+ }
+ $buttons[] = button(user_link($user), '<span class="icon-icon_angel"></span> ' . _('My shifts'));
+ $content[] = buttons($buttons);
+
+ $content[] = Shift_view_header($shift, $room);
+ $content[] = div('row', [
+ div('col-sm-6', [
+ '<h2>' . _('Needed angels') . '</h2>',
+ '<div class="list-group">' . $needed_angels . '</div>'
+ ]),
+ div('col-sm-6', [
+ '<h2>' . _('Description') . '</h2>',
+ $parsedown->parse($shifttype['description'])
+ ])
+ ]);
+
+ if ($shift_admin) {
+ $content[] = Shift_editor_info_render($shift);
+ }
+
return page_with_title(
$shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
- [
- msg(),
- $shift_signup_state->getState() == ShiftSignupState::COLLIDES
- ? info(_('This shift collides with one of your shifts.'), true)
- : '',
- $shift_signup_state->getState() == ShiftSignupState::SIGNED_UP
- ? info(_('You are signed up for this shift.'), true)
- : '',
- buttons(
- ($shift_admin || $admin_shifttypes || $admin_rooms) ? [
- $shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '',
- $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '',
- $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '',
- $admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '',
- button(user_link($user), '<span class="icon-icon_angel"></span> ' . _('My shifts'))
- ] : [
- button(user_link($user), '<span class="icon-icon_angel"></span> ' . _('My shifts'))
- ]),
- Shift_view_header($shift, $room),
- div('row', [
- div('col-sm-6', [
- '<h2>' . _('Needed angels') . '</h2>',
- '<div class="list-group">' . $needed_angels . '</div>'
- ]),
- div('col-sm-6', [
- '<h2>' . _('Description') . '</h2>',
- $parsedown->parse($shifttype['description'])
- ])
- ]),
- $shift_admin ? Shift_editor_info_render($shift) : ''
- ]
+ $content
);
}