Removed some short ifs from Shifts_view.php

main
Igor Scheller 7 years ago
parent b9bbcb9360
commit f1b7946975

@ -122,28 +122,30 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
$needed_angels .= Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin); $needed_angels .= Shift_view_render_needed_angeltype($needed_angeltype, $angeltypes, $shift, $user_shift_admin);
} }
return page_with_title( $content = [msg()];
$shift['name'] . ' <small class="moment-countdown" data-timestamp="' . $shift['start'] . '">%c</small>',
[ if ($shift_signup_state->getState() == ShiftSignupState::COLLIDES) {
msg(), $content[] = info(_('This shift collides with one of your shifts.'), true);
$shift_signup_state->getState() == ShiftSignupState::COLLIDES }
? info(_('This shift collides with one of your shifts.'), true)
: '', if ($shift_signup_state->getState() == ShiftSignupState::SIGNED_UP) {
$shift_signup_state->getState() == ShiftSignupState::SIGNED_UP $content[] = info(_('You are signed up for this shift.'), true);
? info(_('You are signed up for this shift.'), true) }
: '',
buttons( $buttons = [];
($shift_admin || $admin_shifttypes || $admin_rooms) ? [ if ($shift_admin || $admin_shifttypes || $admin_rooms) {
$buttons = [
$shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '', $shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '',
$shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '', $shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '',
$admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '', $admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '',
$admin_rooms ? button(room_link($room), glyph('map-marker') . $room['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')) $buttons[] = button(user_link($user), '<span class="icon-icon_angel"></span> ' . _('My shifts'));
]), $content[] = buttons($buttons);
Shift_view_header($shift, $room),
div('row', [ $content[] = Shift_view_header($shift, $room);
$content[] = div('row', [
div('col-sm-6', [ div('col-sm-6', [
'<h2>' . _('Needed angels') . '</h2>', '<h2>' . _('Needed angels') . '</h2>',
'<div class="list-group">' . $needed_angels . '</div>' '<div class="list-group">' . $needed_angels . '</div>'
@ -152,9 +154,15 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
'<h2>' . _('Description') . '</h2>', '<h2>' . _('Description') . '</h2>',
$parsedown->parse($shifttype['description']) $parsedown->parse($shifttype['description'])
]) ])
]), ]);
$shift_admin ? Shift_editor_info_render($shift) : ''
] 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>',
$content
); );
} }

Loading…
Cancel
Save