summaryrefslogtreecommitdiff
path: root/includes/view
diff options
context:
space:
mode:
Diffstat (limited to 'includes/view')
-rw-r--r--includes/view/AngelTypes_view.php71
-rw-r--r--includes/view/Questions_view.php12
-rw-r--r--includes/view/ShiftCalendarShiftRenderer.php14
-rw-r--r--includes/view/ShiftTypes_view.php34
-rw-r--r--includes/view/Shifts_view.php9
-rw-r--r--includes/view/UserAngelTypes_view.php73
-rw-r--r--includes/view/User_view.php46
7 files changed, 188 insertions, 71 deletions
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[] = '<h3>' . _('Members') . '</h3>';
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[] = '<h3>' . _('Unconfirmed') . '</h3>';
$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'
);
diff --git a/includes/view/Questions_view.php b/includes/view/Questions_view.php
index dee7585c..a44a099d 100644
--- a/includes/view/Questions_view.php
+++ b/includes/view/Questions_view.php
@@ -9,14 +9,22 @@
function Questions_view($open_questions, $answered_questions, $ask_action)
{
foreach ($open_questions as &$question) {
- $question['actions'] = '<a href="' . page_link_to('user_questions') . '&action=delete&id=' . $question['QID'] . '">' . _('delete') . '</a>';
+ $question['actions'] = '<a href="'
+ . page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']])
+ . '">'
+ . _('delete')
+ . '</a>';
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
}
foreach ($answered_questions as &$question) {
$question['Question'] = str_replace("\n", '<br />', $question['Question']);
$question['Answer'] = str_replace("\n", '<br />', $question['Answer']);
- $question['actions'] = '<a href="' . page_link_to('user_questions') . '&action=delete&id=' . $question['QID'] . '">' . _('delete') . '</a>';
+ $question['actions'] = '<a href="'
+ . page_link_to('user_questions', ['action' => 'delete', 'id' => $question['QID']])
+ . '">'
+ . _('delete')
+ . '</a>';
}
return page_with_title(questions_title(), [
diff --git a/includes/view/ShiftCalendarShiftRenderer.php b/includes/view/ShiftCalendarShiftRenderer.php
index 8560d47d..f0488e83 100644
--- a/includes/view/ShiftCalendarShiftRenderer.php
+++ b/includes/view/ShiftCalendarShiftRenderer.php
@@ -125,7 +125,7 @@ class ShiftCalendarShiftRenderer
if (in_array('user_shifts_admin', $privileges)) {
$html .= '<li class="list-group-item">' . button(
- page_link_to('user_shifts') . '&amp;shift_id=' . $shift['SID'],
+ page_link_to('user_shifts', ['shift_id' => $shift['SID']]),
_('Add more angels'),
'btn-xs'
) . '</li>';
@@ -169,11 +169,13 @@ class ShiftCalendarShiftRenderer
case ShiftSignupState::ADMIN:
case ShiftSignupState::FREE:
// When admin or free display a link + button for sign up
- $entry_list[] = '<a href="' . page_link_to('user_shifts') . '&amp;shift_id=' . $shift['SID'] . '&amp;type_id=' . $angeltype['id'] . '">'
+ $entry_list[] = '<a href="'
+ . page_link_to('user_shifts', ['shift_id' => $shift['SID'], 'type_id' => $angeltype['id']])
+ . '">'
. $inner_text
. '</a> '
. button(
- page_link_to('user_shifts') . '&amp;shift_id=' . $shift['SID'] . '&amp;type_id=' . $angeltype['id'],
+ page_link_to('user_shifts', ['shift_id' => $shift['SID'], 'type_id' => $angeltype['id']]),
_('Sign up'), 'btn-xs btn-primary'
);
break;
@@ -191,7 +193,7 @@ class ShiftCalendarShiftRenderer
// Add link to join the angeltype first
$entry_list[] = $inner_text . '<br />'
. 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'
);
@@ -232,8 +234,8 @@ class ShiftCalendarShiftRenderer
$header_buttons = '';
if (in_array('admin_shifts', $privileges)) {
$header_buttons = '<div class="pull-right">' . 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')
]) . '</div>';
}
$shift_heading = date('H:i', $shift['start']) . ' &dash; '
diff --git a/includes/view/ShiftTypes_view.php b/includes/view/ShiftTypes_view.php
index e0750617..74e0d7c0 100644
--- a/includes/view/ShiftTypes_view.php
+++ b/includes/view/ShiftTypes_view.php
@@ -24,7 +24,10 @@ function ShiftType_delete_view($shifttype)
buttons([
button(page_link_to('shifttypes'), _('cancel'), 'cancel'),
button(
- page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'] . '&confirmed',
+ page_link_to(
+ 'shifttypes',
+ ['action' => 'delete', 'shifttype_id' => $shifttype['id'], 'confirmed' => 1]
+ ),
_('delete'),
'ok btn-danger'
)
@@ -81,12 +84,16 @@ function ShiftType_view($shifttype, $angeltype)
buttons([
button(page_link_to('shifttypes'), shifttypes_title(), 'back'),
$angeltype ? button(
- page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'],
+ page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
$angeltype['name']
) : '',
- button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'edit'),
button(
- page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'],
+ page_link_to('shifttypes', ['action' => 'edit', 'shifttype_id' => $shifttype['id']]),
+ _('edit'),
+ 'edit'
+ ),
+ button(
+ page_link_to('shifttypes', ['action' => 'delete', 'shifttype_id' => $shifttype['id']]),
_('delete'),
'delete'
)
@@ -103,11 +110,22 @@ function ShiftType_view($shifttype, $angeltype)
function ShiftTypes_list_view($shifttypes)
{
foreach ($shifttypes as &$shifttype) {
- $shifttype['name'] = '<a href="' . page_link_to('shifttypes') . '&action=view&shifttype_id=' . $shifttype['id'] . '">' . $shifttype['name'] . '</a>';
+ $shifttype['name'] = '<a href="'
+ . page_link_to('shifttypes', ['action' => 'view', 'shifttype_id' => $shifttype['id']])
+ . '">'
+ . $shifttype['name']
+ . '</a>';
$shifttype['actions'] = table_buttons([
- button(page_link_to('shifttypes') . '&action=edit&shifttype_id=' . $shifttype['id'], _('edit'), 'btn-xs'),
button(
- page_link_to('shifttypes') . '&action=delete&shifttype_id=' . $shifttype['id'],
+ page_link_to(
+ 'shifttypes',
+ ['action' => 'edit', 'shifttype_id' => $shifttype['id']]
+ ),
+ _('edit'),
+ 'btn-xs'
+ ),
+ button(
+ page_link_to('shifttypes', ['action' => 'delete', 'shifttype_id' => $shifttype['id']]),
_('delete'),
'btn-xs'
)
@@ -117,7 +135,7 @@ function ShiftTypes_list_view($shifttypes)
return page_with_title(shifttypes_title(), [
msg(),
buttons([
- button(page_link_to('shifttypes') . '&action=edit', _('New shifttype'), 'add')
+ button(page_link_to('shifttypes', ['action' => 'edit']), _('New shifttype'), 'add')
]),
table([
'name' => _('Name'),
diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php
index 094af7ad..bc905f39 100644
--- a/includes/view/Shifts_view.php
+++ b/includes/view/Shifts_view.php
@@ -1,4 +1,5 @@
<?php
+
use Engelsystem\ShiftSignupState;
/**
@@ -41,12 +42,12 @@ function Shift_signup_button_render($shift, $angeltype, $user_angeltype = null)
if ($angeltype['shift_signup_state']->isSignupAllowed()) {
return button(
- page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $angeltype['id'],
+ page_link_to('user_shifts', ['shift_id' => $shift['SID'], 'type_id' => $angeltype['id']]),
_('Sign up')
);
} elseif ($user_angeltype == null) {
return button(
- page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'],
+ page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
sprintf(_('Become %s'),
$angeltype['name'])
);
@@ -207,12 +208,12 @@ function Shift_view_render_shift_entry($shift_entry, $user_shift_admin, $angelty
$entry .= ' <div class="btn-group">';
if ($user_shift_admin) {
$entry .= button_glyph(
- page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'],
+ page_link_to('user_myshifts', ['edit' => $shift_entry['id'], 'id' => $shift_entry['UID']]),
'pencil',
'btn-xs'
);
}
- $entry .= button_glyph(page_link_to('user_shifts') . '&entry_id=' . $shift_entry['id'], 'trash', 'btn-xs');
+ $entry .= button_glyph(page_link_to('user_shifts', ['entry_id' => $shift_entry['id']]), 'trash', 'btn-xs');
$entry .= '</div>';
}
return $entry;
diff --git a/includes/view/UserAngelTypes_view.php b/includes/view/UserAngelTypes_view.php
index 15d99961..98f6c3e9 100644
--- a/includes/view/UserAngelTypes_view.php
+++ b/includes/view/UserAngelTypes_view.php
@@ -19,12 +19,18 @@ function UserAngelType_update_view($user_angeltype, $user, $angeltype, $supporte
User_Nick_render($user)
), true),
buttons([
- button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _('cancel'), 'cancel'),
button(
- page_link_to('user_angeltypes')
- . '&action=update&user_angeltype_id=' . $user_angeltype['id']
- . '&supporter=' . ($supporter ? '1' : '0')
- . '&confirmed',
+ page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
+ _('cancel'),
+ 'cancel'
+ ),
+ button(
+ page_link_to('user_angeltypes', [
+ 'action' => 'update',
+ 'user_angeltype_id' => $user_angeltype['id'],
+ 'supporter' => ($supporter ? '1' : '0'),
+ 'confirmed' => 1,
+ ]),
_('yes'),
'ok'
)
@@ -42,9 +48,19 @@ function UserAngelTypes_delete_all_view($angeltype)
msg(),
info(sprintf(_('Do you really want to deny all users for %s?'), $angeltype['name']), true),
buttons([
- button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _('cancel'), 'cancel'),
button(
- page_link_to('user_angeltypes') . '&action=delete_all&angeltype_id=' . $angeltype['id'] . '&confirmed',
+ page_link_to(
+ 'angeltypes',
+ ['action' => 'view', 'angeltype_id' => $angeltype['id']]
+ ),
+ _('cancel'),
+ 'cancel'
+ ),
+ button(
+ page_link_to(
+ 'user_angeltypes',
+ ['action' => 'delete_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]
+ ),
_('yes'),
'ok'
)
@@ -62,9 +78,11 @@ function UserAngelTypes_confirm_all_view($angeltype)
msg(),
info(sprintf(_('Do you really want to confirm all users for %s?'), $angeltype['name']), true),
buttons([
- button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _('cancel'), 'cancel'),
+ button(page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]), _('cancel'),
+ 'cancel'),
button(
- page_link_to('user_angeltypes') . '&action=confirm_all&angeltype_id=' . $angeltype['id'] . '&confirmed',
+ page_link_to('user_angeltypes',
+ ['action' => 'confirm_all', 'angeltype_id' => $angeltype['id'], 'confirmed' => 1]),
_('yes'),
'ok'
)
@@ -84,9 +102,16 @@ function UserAngelType_confirm_view($user_angeltype, $user, $angeltype)
msg(),
info(sprintf(_('Do you really want to confirm %s for %s?'), User_Nick_render($user), $angeltype['name']), true),
buttons([
- button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _('cancel'), 'cancel'),
button(
- page_link_to('user_angeltypes') . '&action=confirm&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed',
+ page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
+ _('cancel'),
+ 'cancel'
+ ),
+ button(
+ page_link_to(
+ 'user_angeltypes',
+ ['action' => 'confirm', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]
+ ),
_('yes'),
'ok'
)
@@ -106,9 +131,14 @@ function UserAngelType_delete_view($user_angeltype, $user, $angeltype)
msg(),
info(sprintf(_('Do you really want to delete %s from %s?'), User_Nick_render($user), $angeltype['name']), true),
buttons([
- button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _('cancel'), 'cancel'),
button(
- page_link_to('user_angeltypes') . '&action=delete&user_angeltype_id=' . $user_angeltype['id'] . '&confirmed',
+ page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
+ _('cancel'),
+ 'cancel'
+ ),
+ button(
+ page_link_to('user_angeltypes',
+ ['action' => 'delete', 'user_angeltype_id' => $user_angeltype['id'], 'confirmed' => 1]),
_('yes'),
'ok'
)
@@ -132,7 +162,11 @@ function UserAngelType_add_view($angeltype, $users_source, $user_id)
return page_with_title(_('Add user to angeltype'), [
msg(),
buttons([
- button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _('back'), 'back')
+ button(
+ page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
+ _('back'),
+ 'back'
+ )
]),
form([
form_info(_('Angeltype'), $angeltype['name']),
@@ -153,9 +187,16 @@ function UserAngelType_join_view($user, $angeltype)
msg(),
info(sprintf(_('Do you really want to add %s to %s?'), User_Nick_render($user), $angeltype['name']), true),
buttons([
- button(page_link_to('angeltypes') . '&action=view&angeltype_id=' . $angeltype['id'], _('cancel'), 'cancel'),
button(
- page_link_to('user_angeltypes') . '&action=add&angeltype_id=' . $angeltype['id'] . '&user_id=' . $user['UID'] . '&confirmed',
+ page_link_to('angeltypes', ['action' => 'view', 'angeltype_id' => $angeltype['id']]),
+ _('cancel'),
+ 'cancel'
+ ),
+ button(
+ page_link_to(
+ 'user_angeltypes',
+ ['action' => 'add', 'angeltype_id' => $angeltype['id'], 'user_id' => $user['UID'], 'confirmed' => 1]
+ ),
_('save'),
'ok'
)
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index 932614a7..c1e6f49e 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -127,7 +127,7 @@ function User_registration_success_view($event_welcome_message)
'<h2>' . _('What can I do?') . '</h2>',
'<p>' . _('Please read about the jobs you can do to help us.') . '</p>',
buttons([
- button(page_link_to('angeltypes') . '&action=about', _('Teams/Job description') . ' &raquo;')
+ button(page_link_to('angeltypes', ['action' => 'about']), _('Teams/Job description') . ' &raquo;')
])
])
])
@@ -172,10 +172,13 @@ function User_edit_vouchers_view($user)
button(user_link($user), glyph('chevron-left') . _('back'))
]),
info(sprintf(_('Angel should receive at least %d vouchers.'), User_get_eligable_voucher_count($user)), true),
- form([
- form_spinner('vouchers', _('Number of vouchers given out'), $user['got_voucher']),
- form_submit('submit', _('Save'))
- ], page_link_to('users') . '&action=edit_vouchers&user_id=' . $user['UID'])
+ form(
+ [
+ form_spinner('vouchers', _('Number of vouchers given out'), $user['got_voucher']),
+ form_submit('submit', _('Save'))
+ ],
+ page_link_to('users', ['action' => 'edit_vouchers', 'user_id' => $user['UID']])
+ )
]);
}
@@ -208,7 +211,7 @@ function Users_view(
$user['Tshirt'] = glyph_bool($user['Tshirt']);
$user['lastLogIn'] = date(_('m/d/Y h:i a'), $user['lastLogIn']);
$user['actions'] = table_buttons([
- button_glyph(page_link_to('admin_user') . '&id=' . $user['UID'], 'edit', 'btn-xs')
+ button_glyph(page_link_to('admin_user', ['id' => $user['UID']]), 'edit', 'btn-xs')
]);
}
$users[] = [
@@ -253,7 +256,11 @@ function Users_view(
*/
function Users_table_header_link($column, $label, $order_by)
{
- return '<a href="' . page_link_to('users') . '&OrderBy=' . $column . '">' . $label . ($order_by == $column ? ' <span class="caret"></span>' : '') . '</a>';
+ return '<a href="'
+ . page_link_to('users', ['OrderBy' => $column])
+ . '">'
+ . $label . ($order_by == $column ? ' <span class="caret"></span>' : '')
+ . '</a>';
}
/**
@@ -347,7 +354,7 @@ function User_view_myshift($shift, $user_source, $its_me)
];
if ($its_me || in_array('user_shifts_admin', $privileges)) {
$myshift['actions'][] = button(
- page_link_to('user_myshifts') . '&edit=' . $shift['id'] . '&id=' . $user_source['UID'],
+ page_link_to('user_myshifts', ['edit' => $shift['id'], 'id' => $user_source['UID']]),
glyph('edit') . _('edit'),
'btn-xs'
);
@@ -356,8 +363,15 @@ function User_view_myshift($shift, $user_source, $its_me)
($shift['start'] > time() + config('last_unsubscribe') * 3600)
|| in_array('user_shifts_admin', $privileges)
) {
+ $parameters = [
+ 'cancel' => $shift['id'],
+ 'id' => $user_source['UID'],
+ ];
+ if ($its_me) {
+ $parameters['id'] = '';
+ }
$myshift['actions'][] = button(
- page_link_to('user_myshifts') . ((!$its_me) ? '&id=' . $user_source['UID'] : '') . '&cancel=' . $shift['id'],
+ page_link_to('user_myshifts', $parameters),
glyph('trash') . _('sign off'),
'btn-xs'
);
@@ -427,7 +441,7 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
div('col-md-12', [
buttons([
$admin_user_privilege ? button(
- page_link_to('admin_user') . '&id=' . $user_source['UID'],
+ page_link_to('admin_user', ['id' => $user_source['UID']]),
glyph('edit') . _('edit')
) : '',
$admin_user_privilege ? button(
@@ -435,24 +449,24 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
glyph('road') . _('driving license')
) : '',
($admin_user_privilege && !$user_source['Gekommen']) ? button(
- page_link_to('admin_arrive') . '&arrived=' . $user_source['UID'],
+ page_link_to('admin_arrive', ['arrived' => $user_source['UID']]),
_('arrived')
) : '',
$admin_user_privilege ? button(
- page_link_to('users') . '&action=edit_vouchers&user_id=' . $user_source['UID'],
+ page_link_to('users', ['action' => 'edit_vouchers', 'user_id' => $user_source['UID']]),
glyph('cutlery') . _('Edit vouchers')
) : '',
$its_me ? button(page_link_to('user_settings'), glyph('list-alt') . _('Settings')) : '',
$its_me ? button(
- page_link_to('ical') . '&key=' . $user_source['api_key'],
+ page_link_to('ical', ['key' => $user_source['api_key']]),
glyph('calendar') . _('iCal Export')
) : '',
$its_me ? button(
- page_link_to('shifts_json_export') . '&key=' . $user_source['api_key'],
+ page_link_to('shifts_json_export', ['key' => $user_source['api_key']]),
glyph('export') . _('JSON Export')
) : '',
$its_me ? button(
- page_link_to('user_myshifts') . '&reset',
+ page_link_to('user_myshifts', ['reset' => 1]),
glyph('repeat') . _('Reset API key')
) : ''
])
@@ -607,7 +621,7 @@ function User_groups_render($user_groups)
function User_Nick_render($user_source)
{
return '<a class="' . ($user_source['Gekommen'] ? '' : 'text-muted') . '" href="'
- . page_link_to('users') . '&amp;action=view&amp;user_id=' . $user_source['UID']
+ . page_link_to('users', ['action' => 'view', 'user_id' => $user_source['UID']])
. '"><span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . '</a>';
}