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/AngelTypes_view.php | 85 ++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 38 deletions(-) (limited to 'includes/view/AngelTypes_view.php') diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index a5c10a38..6cefbb24 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -1,7 +1,8 @@ ' . ($angeltype['restricted'] ? glyph('lock') : '') . $angeltype['name'] . ''; + return '' + . ($angeltype['restricted'] ? glyph('lock') : '') . $angeltype['name'] + . ''; } /** @@ -92,7 +95,10 @@ function AngelType_edit_view($angeltype, $supporter_mode) ? form_info(_('No Self Sign Up'), $angeltype['no_self_signup'] ? _('Yes') : _('No')) : form_checkbox('no_self_signup', _('No Self Sign Up'), $angeltype['no_self_signup']), $supporter_mode - ? form_info(_('Requires driver license'), $angeltype['requires_driver_license'] ? _('Yes') : _('No')) + ? form_info(_('Requires driver license'), + $angeltype['requires_driver_license'] + ? _('Yes') + : _('No')) : form_checkbox( 'requires_driver_license', _('Requires driver license'), @@ -133,7 +139,10 @@ function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, ]; if ($angeltype['requires_driver_license']) { - $buttons[] = button(user_driver_license_edit_link($user), glyph('road') . _('my driving license')); + $buttons[] = button( + user_driver_license_edit_link($user), + glyph('road') . _('my driving license') + ); } if ($user_angeltype == null) { @@ -336,45 +345,45 @@ function AngelType_view( AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $supporter, $user_driver_license, $user), msg(), tabs([ - _('Info') => AngelType_view_info( + _('Info') => AngelType_view_info( $angeltype, $members, $admin_user_angeltypes, $admin_angeltypes, $supporter - ), + ), _('Shifts') => AngelType_view_shifts( $angeltype, $shiftsFilterRenderer, $shiftCalendarRenderer - ) - ], $tab) + ) + ], $tab) ]); } /** - * @param Angeltype $angeltype - * @param ShiftsFilterRenderer $shiftsFilterRenderer + * @param array $angeltype + * @param ShiftsFilterRenderer $shiftsFilterRenderer * @param ShiftCalendarRenderer $shiftCalendarRenderer * @return string HTML */ function AngelType_view_shifts($angeltype, $shiftsFilterRenderer, $shiftCalendarRenderer) { - $shifts = $shiftsFilterRenderer->render(page_link_to('angeltypes', [ - 'action' => 'view', + $shifts = $shiftsFilterRenderer->render(page_link_to('angeltypes', [ + 'action' => 'view', 'angeltype_id' => $angeltype['id'] ])); $shifts .= $shiftCalendarRenderer->render(); - + return div('first', $shifts); } /** - * @param Angeltype $angeltype + * @param array $angeltype * @param array $members - * @param bool $admin_user_angeltypes - * @param bool $admin_angeltypes - * @param bool $supporter + * @param bool $admin_user_angeltypes + * @param bool $admin_angeltypes + * @param bool $supporter * @return string HTML */ function AngelType_view_info( @@ -385,29 +394,29 @@ function AngelType_view_info( $supporter ) { $info = []; - if(AngelType_has_contact_info($angeltype)) { + if (AngelType_has_contact_info($angeltype)) { $info[] = AngelTypes_render_contact_info($angeltype); } - + $info[] = '

' . _('Description') . '

'; $parsedown = new Parsedown(); if ($angeltype['description'] != '') { $info[] = '
' . $parsedown->parse($angeltype['description']) . '
'; } - + list($supporters, $members_confirmed, $members_unconfirmed) = AngelType_view_members( $angeltype, $members, $admin_user_angeltypes, $admin_angeltypes - ); + ); $table_headers = AngelType_view_table_headers($angeltype, $supporter, $admin_angeltypes); - + if (count($supporters) > 0) { $info[] = '

' . _('Supporters') . '

'; $info[] = table($table_headers, $supporters); } - + if (count($members_confirmed) > 0) { $members_confirmed[] = [ 'Nick' => _('Sum'), @@ -415,7 +424,7 @@ function AngelType_view_info( 'actions' => '' ]; } - + if (count($members_unconfirmed) > 0) { $members_unconfirmed[] = [ 'Nick' => _('Sum'), @@ -423,7 +432,7 @@ function AngelType_view_info( 'actions' => '' ]; } - + $info[] = '

' . _('Members') . '

'; if ($admin_user_angeltypes) { $info[] = buttons([ @@ -431,45 +440,45 @@ function AngelType_view_info( page_link_to( 'user_angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype['id']] - ), + ), _('Add'), 'add' - ) + ) ]); } $info[] = table($table_headers, $members_confirmed); - + if ($admin_user_angeltypes && $angeltype['restricted'] && count($members_unconfirmed) > 0) { $info[] = '

' . _('Unconfirmed') . '

'; $info[] = buttons([ button( page_link_to('user_angeltypes', ['action' => 'confirm_all', 'angeltype_id' => $angeltype['id']]), glyph('ok') . _('confirm all') - ), + ), button( page_link_to('user_angeltypes', ['action' => 'delete_all', 'angeltype_id' => $angeltype['id']]), glyph('remove') . _('deny all') - ) + ) ]); $info[] = table($table_headers, $members_unconfirmed); } - + return join($info); } /** * Renders the contact info - * - * @param Anteltype $angeltype + * + * @param array $angeltype * @return string HTML */ function AngelTypes_render_contact_info($angeltype) { return heading(_('Contact'), 3) . description([ - _('Name') => $angeltype['contact_name'], - _('DECT') => $angeltype['contact_dect'], - _('E-Mail') => $angeltype['contact_email'] - ]); + _('Name') => $angeltype['contact_name'], + _('DECT') => $angeltype['contact_dect'], + _('E-Mail') => $angeltype['contact_email'] + ]); } /** @@ -511,7 +520,7 @@ function AngelTypes_about_view_angeltype($angeltype) $html = '

' . $angeltype['name'] . '

'; - if(AngelType_has_contact_info($angeltype)) { + if (AngelType_has_contact_info($angeltype)) { $html .= AngelTypes_render_contact_info($angeltype); } -- cgit v1.2.3-70-g09d2