From 73175e2b64c85c7a8c528c76452cd82ffa99f925 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Mon, 28 Aug 2017 16:21:10 +0200 Subject: #337: Added routing --- includes/view/AngelTypes_view.php | 71 ++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 19 deletions(-) (limited to 'includes/view/AngelTypes_view.php') diff --git a/includes/view/AngelTypes_view.php b/includes/view/AngelTypes_view.php index f74b0eb1..32f58d4b 100644 --- a/includes/view/AngelTypes_view.php +++ b/includes/view/AngelTypes_view.php @@ -50,7 +50,10 @@ function AngelType_delete_view($angeltype) buttons([ button(page_link_to('angeltypes'), _('cancel'), 'cancel'), button( - page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'] . '&confirmed', + page_link_to( + 'angeltypes', + ['action' => 'delete', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1] + ), _('delete'), 'ok' ) @@ -67,7 +70,6 @@ function AngelType_delete_view($angeltype) */ function AngelType_edit_view($angeltype, $supporter_mode) { - $contact_info = AngelType_contact_info($angeltype); return page_with_title(sprintf(_('Edit %s'), $angeltype['name']), [ buttons([ button(page_link_to('angeltypes'), _('Angeltypes'), 'back') @@ -127,7 +129,7 @@ function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, if ($user_angeltype == null) { $buttons[] = button( - page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], + page_link_to('user_angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype['id']]), _('join'), 'add' ); @@ -142,20 +144,22 @@ function AngelType_view_buttons($angeltype, $user_angeltype, $admin_angeltypes, $angeltype['name'] )); } - $buttons[] = button(page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'], - _('leave'), 'cancel'); + $buttons[] = button( + page_link_to('user_angeltypes', ['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id']]), + _('leave'), 'cancel' + ); } if ($admin_angeltypes || $supporter) { $buttons[] = button( - page_link_to('angeltypes') . '&action=edit&angeltype_id=' . $angeltype['id'], + page_link_to('angeltypes', ['action' => 'edit', 'angeltype_id' => $angeltype['id']]), _('edit'), 'edit' ); } if ($admin_angeltypes) { $buttons[] = button( - page_link_to('angeltypes') . '&action=delete&angeltype_id=' . $angeltype['id'], + page_link_to('angeltypes', ['action' => 'delete', 'angeltype_id' => $angeltype['id']]), _('delete'), 'delete' ); @@ -194,12 +198,18 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a if ($angeltype['restricted'] && $member['confirm_user_id'] == null) { $member['actions'] = table_buttons([ button( - page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $member['user_angeltype_id'], + page_link_to( + 'user_angeltypes', + ['action' => 'confirm', 'user_angeltype_id' => $member['user_angeltype_id']] + ), _('confirm'), 'btn-xs' ), button( - page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'], + page_link_to( + 'user_angeltypes', + ['action' => 'delete', 'user_angeltype_id' => $member['user_angeltype_id']] + ), _('deny'), 'btn-xs' ) @@ -209,7 +219,11 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a if ($admin_angeltypes) { $member['actions'] = table_buttons([ button( - page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=0', + page_link_to('user_angeltypes', [ + 'action' => 'update', + 'user_angeltype_id' => $member['user_angeltype_id'], + 'supporter' => 0 + ]), _('Remove supporter rights'), 'btn-xs' ) @@ -222,11 +236,18 @@ function AngelType_view_members($angeltype, $members, $admin_user_angeltypes, $a if ($admin_user_angeltypes) { $member['actions'] = table_buttons([ $admin_angeltypes - ? button(page_link_to('user_angeltypes') . '&action=update&user_angeltype_id=' . $member['user_angeltype_id'] . '&supporter=1', + ? button(page_link_to('user_angeltypes', [ + 'action' => 'update', + 'user_angeltype_id' => $member['user_angeltype_id'], + 'supporter' => 1 + ]), _('Add supporter rights'), 'btn-xs') : '', button( - page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $member['user_angeltype_id'], + page_link_to('user_angeltypes', [ + 'action' => 'delete', + 'user_angeltype_id' => $member['user_angeltype_id'] + ]), _('remove'), 'btn-xs' ) @@ -340,7 +361,14 @@ function AngelType_view( $page[] = '

' . _('Members') . '

'; if ($admin_user_angeltypes) { $page[] = buttons([ - button(page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], _('Add'), 'add') + button( + page_link_to( + 'user_angeltypes', + ['action' => 'add', 'angeltype_id' => $angeltype['id']] + ), + _('Add'), + 'add' + ) ]); } $page[] = table($table_headers, $members_confirmed); @@ -349,12 +377,12 @@ function AngelType_view( $page[] = '

' . _('Unconfirmed') . '

'; $page[] = buttons([ button( - page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'], + page_link_to('user_angeltypes', ['action' => 'confirm_all', 'angeltype_id' => $angeltype['id']]), _('confirm all'), 'ok' ), button( - page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'], + page_link_to('user_angeltypes', ['action' => 'delete_all', 'angeltype_id' => $angeltype['id']]), _('deny all'), 'cancel' ) @@ -377,8 +405,10 @@ function AngelTypes_list_view($angeltypes, $admin_angeltypes) return page_with_title(angeltypes_title(), [ msg(), buttons([ - $admin_angeltypes ? button(page_link_to('angeltypes') . '&action=edit', _('New angeltype'), 'add') : '', - button(page_link_to('angeltypes') . '&action=about', _('Teams/Job description')) + $admin_angeltypes + ? button(page_link_to('angeltypes', ['action' => 'edit']), _('New angeltype'), 'add') + : '', + button(page_link_to('angeltypes', ['action' => 'about']), _('Teams/Job description')) ]), table([ 'name' => _('Name'), @@ -406,13 +436,16 @@ function AngelTypes_about_view_angeltype($angeltype) $buttons = []; if ($angeltype['user_angeltype_id'] != null) { $buttons[] = button( - page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $angeltype['user_angeltype_id'], + page_link_to( + 'user_angeltypes', + ['action' => 'delete', 'user_angeltype_id' => $angeltype['user_angeltype_id']] + ), _('leave'), 'cancel' ); } else { $buttons[] = button( - page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'], + page_link_to('user_angeltypes', ['action' => 'add', 'angeltype_id' => $angeltype['id']]), _('join'), 'add' ); -- cgit v1.2.3-54-g00ecf