From 952c7892f3ac7bfadf8419062e44ff1af66ecc57 Mon Sep 17 00:00:00 2001 From: Bot Date: Mon, 25 Dec 2017 23:12:52 +0100 Subject: Formatting & Docstrings --- includes/view/ShiftCalendarShiftRenderer.php | 44 +++++++++++++++++++++------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'includes/view/ShiftCalendarShiftRenderer.php') diff --git a/includes/view/ShiftCalendarShiftRenderer.php b/includes/view/ShiftCalendarShiftRenderer.php index 2940306d..8bfb18ea 100644 --- a/includes/view/ShiftCalendarShiftRenderer.php +++ b/includes/view/ShiftCalendarShiftRenderer.php @@ -33,10 +33,14 @@ class ShiftCalendarShiftRenderer $blocks = ceil(($shift['end'] - $shift['start']) / ShiftCalendarRenderer::SECONDS_PER_ROW); $blocks = max(1, $blocks); + return [ $blocks, div( - 'shift panel panel-' . $class . '" style="height: ' . ($blocks * ShiftCalendarRenderer::BLOCK_HEIGHT - ShiftCalendarRenderer::MARGIN) . 'px"', + 'shift panel panel-' . $class . '" ' + . 'style="height: ' + . ($blocks * ShiftCalendarRenderer::BLOCK_HEIGHT - ShiftCalendarRenderer::MARGIN) + . 'px"', [ $this->renderShiftHead($shift), div('panel-body', [ @@ -127,9 +131,9 @@ class ShiftCalendarShiftRenderer if (in_array('user_shifts_admin', $privileges)) { $html .= '
  • '; $html .= button(shift_entry_create_link_admin($shift), - glyph('plus') . _('Add more angels'), - 'btn-xs' - ); + glyph('plus') . _('Add more angels'), + 'btn-xs' + ); $html .= '
  • '; } if ($html != '') { @@ -138,6 +142,7 @@ class ShiftCalendarShiftRenderer '' ]; } + return [ $shift_signup_state, '' @@ -161,7 +166,15 @@ class ShiftCalendarShiftRenderer $style = $entry['freeloaded'] ? ' text-decoration: line-through;' : ''; $entry_list[] = '' . User_Nick_render($entry) . ''; } - $shift_signup_state = Shift_signup_allowed($user, $shift, $angeltype, null, null, $angeltype, $shift_entries); + $shift_signup_state = Shift_signup_allowed( + $user, + $shift, + $angeltype, + null, + null, + $angeltype, + $shift_entries + ); $inner_text = sprintf( ngettext('%d helper needed', '%d helpers needed', $shift_signup_state->getFreeEntries()), $shift_signup_state->getFreeEntries() @@ -181,12 +194,12 @@ class ShiftCalendarShiftRenderer _('Sign up'), 'btn-xs btn-primary' ); break; - + case ShiftSignupState::SHIFT_ENDED: // No link and add a text hint, when the shift ended $entry_list[] = $inner_text . ' (' . _('ended') . ')'; break; - + case ShiftSignupState::NOT_ARRIVED: // No link and add a text hint, when the shift ended $entry_list[] = $inner_text . ' (' . _('please arrive for signup') . ')'; @@ -200,7 +213,10 @@ class ShiftCalendarShiftRenderer // Add link to join the angeltype first $entry_list[] = $inner_text . '
    ' . button( - page_link_to('user_angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype['id']]), + page_link_to( + 'user_angeltypes', + ['action' => 'add', 'angeltype_id' => $angeltype['id']] + ), sprintf(_('Become %s'), $angeltype['name']), 'btn-xs' ); @@ -241,8 +257,16 @@ class ShiftCalendarShiftRenderer $header_buttons = ''; if (in_array('admin_shifts', $privileges)) { $header_buttons = '
    ' . table_buttons([ - button(page_link_to('user_shifts', ['edit_shift' => $shift['SID']]), glyph('edit'), 'btn-xs'), - button(page_link_to('user_shifts', ['delete_shift' => $shift['SID']]), glyph('trash'), 'btn-xs') + button( + page_link_to('user_shifts', ['edit_shift' => $shift['SID']]), + glyph('edit'), + 'btn-xs' + ), + button( + page_link_to('user_shifts', ['delete_shift' => $shift['SID']]), + glyph('trash'), + 'btn-xs' + ) ]) . '
    '; } $shift_heading = date('H:i', $shift['start']) . ' ‐ ' -- cgit v1.2.3-54-g00ecf