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/ShiftEntry_view.php | 153 +++++++++++++++++++++++--------------- 1 file changed, 95 insertions(+), 58 deletions(-) (limited to 'includes/view/ShiftEntry_view.php') diff --git a/includes/view/ShiftEntry_view.php b/includes/view/ShiftEntry_view.php index da99e9d8..1b646557 100644 --- a/includes/view/ShiftEntry_view.php +++ b/includes/view/ShiftEntry_view.php @@ -13,7 +13,14 @@ function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_user) { return page_with_title(ShiftEntry_delete_title(), [ - info(sprintf(_('Do you want to sign off %s from shift %s from %s to %s as %s?'), User_Nick_render($signoff_user), $shift['name'], date('Y-m-d H:i', $shift['start']), date('Y-m-d H:i', $shift['end']), $angeltype['name']), true), + info(sprintf( + _('Do you want to sign off %s from shift %s from %s to %s as %s?'), + User_Nick_render($signoff_user), + $shift['name'], + date('Y-m-d H:i', $shift['start']), + date('Y-m-d H:i', $shift['end']), + $angeltype['name'] + ), true), buttons([ button(user_link($signoff_user), glyph('remove') . _('cancel')), button(shift_entry_delete_link($shiftEntry, [ @@ -26,17 +33,23 @@ function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_ /** * Sign off from a shift, asking for ack. * - * @param array $shiftEntry - * @param array $shift - * @param array $angeltype - * @param array $signoff_user + * @param array $shiftEntry + * @param array $shift + * @param array $angeltype + * @param array $signoff_user * * @return string HTML */ function ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signoff_user) { return page_with_title(ShiftEntry_delete_title(), [ - info(sprintf(_('Do you want to sign off from your shift %s from %s to %s as %s?'), $shift['name'], date('Y-m-d H:i', $shift['start']), date('Y-m-d H:i', $shift['end']), $angeltype['name']), true), + info(sprintf( + _('Do you want to sign off from your shift %s from %s to %s as %s?'), + $shift['name'], + date('Y-m-d H:i', $shift['start']), + date('Y-m-d H:i', $shift['end']), + $angeltype['name'] + ), true), buttons([ button(user_link($signoff_user), glyph('remove') . _('cancel')), button(shift_entry_delete_link($shiftEntry, [ @@ -57,65 +70,76 @@ function ShiftEntry_delete_title() /** * Admin puts user into shift. * - * @param array $shift - * @param array $room - * @param array $angeltype - * @param array $angeltypes_select - * @param array $signup_user - * @param array $users_select + * @param array $shift + * @param array $room + * @param array $angeltype + * @param array $angeltypes_select + * @param array $signup_user + * @param array $users_select + * @return string */ function ShiftEntry_create_view_admin($shift, $room, $angeltype, $angeltypes_select, $signup_user, $users_select) { - return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name'] . ' %c', [ - Shift_view_header($shift, $room), - info(_('Do you want to sign up the following user for this shift?'), true), - form([ - form_select('angeltype_id', _('Angeltype'), $angeltypes_select, $angeltype['id']), - form_select('user_id', _('User'), $users_select, $signup_user['UID']), - form_submit('submit', glyph('ok') . _('Save')) - ]) - ]); + return page_with_title( + ShiftEntry_create_title() . ': ' . $shift['name'] + . ' %c', + [ + Shift_view_header($shift, $room), + info(_('Do you want to sign up the following user for this shift?'), true), + form([ + form_select('angeltype_id', _('Angeltype'), $angeltypes_select, $angeltype['id']), + form_select('user_id', _('User'), $users_select, $signup_user['UID']), + form_submit('submit', glyph('ok') . _('Save')) + ]) + ]); } /** * Supporter puts user into shift. * - * @param array $shift - * @param array $room - * @param array $angeltype - * @param array $signup_user - * @param array $users_select + * @param array $shift + * @param array $room + * @param array $angeltype + * @param array $signup_user + * @param array $users_select + * @return string */ function ShiftEntry_create_view_supporter($shift, $room, $angeltype, $signup_user, $users_select) { - return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name'] . ' %c', [ - Shift_view_header($shift, $room), - info(sprintf(_('Do you want to sign up the following user for this shift as %s?'), AngelType_name_render($angeltype)), true), - form([ - form_select('user_id', _('User'), $users_select, $signup_user['UID']), - form_submit('submit', glyph('ok') . _('Save')) - ]) - ]); + return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name'] + . ' %c', + [ + Shift_view_header($shift, $room), + info(sprintf(_('Do you want to sign up the following user for this shift as %s?'), + AngelType_name_render($angeltype)), true), + form([ + form_select('user_id', _('User'), $users_select, $signup_user['UID']), + form_submit('submit', glyph('ok') . _('Save')) + ]) + ]); } /** * User joining a shift. - * - * @param array $shift - * @param array $room - * @param array $angeltype + * + * @param array $shift + * @param array $room + * @param array $angeltype * @param string $comment + * @return string */ function ShiftEntry_create_view_user($shift, $room, $angeltype, $comment) { - return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name'] . ' %c', [ - Shift_view_header($shift, $room), - info(sprintf(_('Do you want to sign up for this shift as %s?'), AngelType_name_render($angeltype)), true), - form([ - form_textarea('comment', _('Comment (for your eyes only):'), $comment), - form_submit('submit', glyph('ok') . _('Save')) - ]) - ]); + return page_with_title(ShiftEntry_create_title() . ': ' . $shift['name'] + . ' %c', + [ + Shift_view_header($shift, $room), + info(sprintf(_('Do you want to sign up for this shift as %s?'), AngelType_name_render($angeltype)), true), + form([ + form_textarea('comment', _('Comment (for your eyes only):'), $comment), + form_submit('submit', glyph('ok') . _('Save')) + ]) + ]); } /** @@ -129,24 +153,37 @@ function ShiftEntry_create_title() /** * Display form for adding/editing a shift entry. * - * @param string $angel - * @param string $date - * @param string $location - * @param string $title - * @param string $type - * @param string $comment - * @param bool $freeloaded - * @param string $freeload_comment - * @param bool $user_admin_shifts + * @param string $angel + * @param string $date + * @param string $location + * @param string $title + * @param string $type + * @param string $comment + * @param bool $freeloaded + * @param string $freeload_comment + * @param bool $user_admin_shifts * @return string */ -function ShiftEntry_edit_view($angel, $date, $location, $title, $type, $comment, $freeloaded, $freeload_comment, $user_admin_shifts = false) -{ +function ShiftEntry_edit_view( + $angel, + $date, + $location, + $title, + $type, + $comment, + $freeloaded, + $freeload_comment, + $user_admin_shifts = false +) { $freeload_form = []; if ($user_admin_shifts) { $freeload_form = [ form_checkbox('freeloaded', _('Freeloaded'), $freeloaded), - form_textarea('freeload_comment', _('Freeload comment (Only for shift coordination):'), $freeload_comment) + form_textarea( + 'freeload_comment', + _('Freeload comment (Only for shift coordination):'), + $freeload_comment + ) ]; } return page_with_title(_('Edit shift entry'), [ -- cgit v1.2.3-70-g09d2