Changed user_link and some other user functions to use the user id
This commit is contained in:
parent
2dcb7cc2de
commit
b069a938c6
|
@ -17,7 +17,7 @@ function shift_entries_controller()
|
|||
|
||||
$action = strip_request_item('action');
|
||||
if (empty($action)) {
|
||||
redirect(user_link($user));
|
||||
redirect(user_link($user['UID']));
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
|
@ -44,7 +44,7 @@ function shift_entry_create_controller()
|
|||
|
||||
$shift = Shift($request->input('shift_id'));
|
||||
if (empty($shift)) {
|
||||
redirect(user_link($user));
|
||||
redirect(user_link($user['UID']));
|
||||
}
|
||||
|
||||
$angeltype = AngelType($request->input('angeltype_id'));
|
||||
|
@ -54,7 +54,7 @@ function shift_entry_create_controller()
|
|||
}
|
||||
|
||||
if (empty($angeltype)) {
|
||||
redirect(user_link($user));
|
||||
redirect(user_link($user['UID']));
|
||||
}
|
||||
|
||||
if (User_is_AngelType_supporter($user, $angeltype)) {
|
||||
|
@ -345,7 +345,7 @@ function shift_entry_delete_controller()
|
|||
$signout_user = User($shiftEntry['UID']);
|
||||
if (!Shift_signout_allowed($shift, $angeltype, $signout_user)) {
|
||||
error(__('You are not allowed to remove this shift entry. If necessary, ask your supporter or heaven to do so.'));
|
||||
redirect(user_link($signout_user));
|
||||
redirect(user_link($signout_user['UID']));
|
||||
}
|
||||
|
||||
if ($request->has('continue')) {
|
||||
|
|
|
@ -130,7 +130,7 @@ function user_driver_license_edit_controller()
|
|||
}
|
||||
engelsystem_log('Driver license information updated.');
|
||||
success(__('Your driver license information has been saved.'));
|
||||
redirect(user_link($user_source));
|
||||
redirect(user_link($user_source['UID']));
|
||||
} else {
|
||||
error(__('Please select at least one driving license.'));
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ function user_driver_license_edit_controller()
|
|||
UserDriverLicenses_delete($user_source['UID']);
|
||||
engelsystem_log('Driver license information removed.');
|
||||
success(__('Your driver license information has been removed.'));
|
||||
redirect(user_link($user_source));
|
||||
redirect(user_link($user_source['UID']));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ function user_worklog_delete_controller()
|
|||
$request = request();
|
||||
$userWorkLog = UserWorkLog($request->input('user_worklog_id'));
|
||||
if (empty($userWorkLog)) {
|
||||
redirect(user_link($user));
|
||||
redirect(user_link($user['UID']));
|
||||
}
|
||||
$user_source = User($userWorkLog['user_id']);
|
||||
|
||||
|
@ -20,7 +20,7 @@ function user_worklog_delete_controller()
|
|||
UserWorkLog_delete($userWorkLog);
|
||||
|
||||
success(__('Work log entry deleted.'));
|
||||
redirect(user_link($user_source));
|
||||
redirect(user_link($user_source['UID']));
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -41,7 +41,7 @@ function user_worklog_edit_controller()
|
|||
$request = request();
|
||||
$userWorkLog = UserWorkLog($request->input('user_worklog_id'));
|
||||
if (empty($userWorkLog)) {
|
||||
redirect(user_link($user));
|
||||
redirect(user_link($user['UID']));
|
||||
}
|
||||
$user_source = User($userWorkLog['user_id']);
|
||||
|
||||
|
@ -52,7 +52,7 @@ function user_worklog_edit_controller()
|
|||
UserWorkLog_update($userWorkLog);
|
||||
|
||||
success(__('Work log entry updated.'));
|
||||
redirect(user_link($user_source));
|
||||
redirect(user_link($user_source['UID']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ function user_worklog_add_controller()
|
|||
$request = request();
|
||||
$user_source = User($request->input('user_id'));
|
||||
if (empty($user_source)) {
|
||||
redirect(user_link($user));
|
||||
redirect(user_link($user['UID']));
|
||||
}
|
||||
|
||||
$userWorkLog = UserWorkLog_new($user_source);
|
||||
|
@ -125,7 +125,7 @@ function user_worklog_add_controller()
|
|||
UserWorkLog_create($userWorkLog);
|
||||
|
||||
success(__('Work log entry created.'));
|
||||
redirect(user_link($user_source));
|
||||
redirect(user_link($user_source['UID']));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,13 +189,13 @@ function user_worklog_controller()
|
|||
global $user, $privileges;
|
||||
|
||||
if (!in_array('admin_user_worklog', $privileges)) {
|
||||
redirect(user_link($user));
|
||||
redirect(user_link($user['UID']));
|
||||
}
|
||||
|
||||
$request = request();
|
||||
$action = $request->input('action');
|
||||
if (!$request->has('action')) {
|
||||
redirect(user_link($user));
|
||||
redirect(user_link($user['UID']));
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
|
|
|
@ -59,7 +59,7 @@ function user_delete_controller()
|
|||
// You cannot delete yourself
|
||||
if ($user['UID'] == $user_source['UID']) {
|
||||
error(__('You cannot delete yourself.'));
|
||||
redirect(user_link($user));
|
||||
redirect(user_link($user['UID']));
|
||||
}
|
||||
|
||||
if ($request->has('submit')) {
|
||||
|
@ -101,30 +101,30 @@ function users_link()
|
|||
}
|
||||
|
||||
/**
|
||||
* @param array $user
|
||||
* @param int $userId
|
||||
* @return string
|
||||
*/
|
||||
function user_edit_link($user)
|
||||
function user_edit_link($userId)
|
||||
{
|
||||
return page_link_to('admin_user', ['user_id' => $user['UID']]);
|
||||
return page_link_to('admin_user', ['user_id' => $userId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $user
|
||||
* @param int $userId
|
||||
* @return string
|
||||
*/
|
||||
function user_delete_link($user)
|
||||
function user_delete_link($userId)
|
||||
{
|
||||
return page_link_to('users', ['action' => 'delete', 'user_id' => $user['UID']]);
|
||||
return page_link_to('users', ['action' => 'delete', 'user_id' => $userId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $user
|
||||
* @param int $userId
|
||||
* @return string
|
||||
*/
|
||||
function user_link($user)
|
||||
function user_link($userId)
|
||||
{
|
||||
return page_link_to('users', ['action' => 'view', 'user_id' => $user['UID']]);
|
||||
return page_link_to('users', ['action' => 'view', 'user_id' => $userId]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -169,7 +169,7 @@ function user_edit_vouchers_controller()
|
|||
engelsystem_log(User_Nick_render($user_source) . ': ' . sprintf('Got %s vouchers',
|
||||
$user_source['got_voucher']));
|
||||
|
||||
redirect(user_link($user_source));
|
||||
redirect(user_link($user_source['UID']));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ function admin_arrive()
|
|||
', [$user_id]);
|
||||
engelsystem_log('User set to not arrived: ' . User_Nick_render($user_source));
|
||||
success(__('Reset done. Angel has not arrived.'));
|
||||
redirect(user_link($user_source));
|
||||
redirect(user_link($user_source['UID']));
|
||||
} else {
|
||||
$msg = error(__('Angel not found.'), true);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ function admin_arrive()
|
|||
', [time(), $user_id]);
|
||||
engelsystem_log('User set has arrived: ' . User_Nick_render($user_source));
|
||||
success(__('Angel has been marked as arrived.'));
|
||||
redirect(user_link($user_source));
|
||||
redirect(user_link($user_source['UID']));
|
||||
} else {
|
||||
$msg = error(__('Angel not found.'), true);
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ function admin_user()
|
|||
}
|
||||
|
||||
$html .= buttons([
|
||||
button(user_delete_link($user_source), glyph('lock') . __('delete'), 'btn-danger')
|
||||
button(user_delete_link($user_source['UID']), glyph('lock') . __('delete'), 'btn-danger')
|
||||
]);
|
||||
|
||||
$html .= "<hr />";
|
||||
|
|
|
@ -22,7 +22,7 @@ function ShiftEntry_delete_view_admin($shiftEntry, $shift, $angeltype, $signoff_
|
|||
$angeltype['name']
|
||||
), true),
|
||||
buttons([
|
||||
button(user_link($signoff_user), glyph('remove') . __('cancel')),
|
||||
button(user_link($signoff_user['UID']), glyph('remove') . __('cancel')),
|
||||
button(shift_entry_delete_link($shiftEntry, [
|
||||
'continue' => 1
|
||||
]), glyph('ok') . __('delete'), 'btn-danger')
|
||||
|
@ -51,7 +51,7 @@ function ShiftEntry_delete_view($shiftEntry, $shift, $angeltype, $signoff_user)
|
|||
$angeltype['name']
|
||||
), true),
|
||||
buttons([
|
||||
button(user_link($signoff_user), glyph('remove') . __('cancel')),
|
||||
button(user_link($signoff_user['UID']), glyph('remove') . __('cancel')),
|
||||
button(shift_entry_delete_link($shiftEntry, [
|
||||
'continue' => 1
|
||||
]), glyph('ok') . __('delete'), 'btn-danger')
|
||||
|
|
|
@ -141,7 +141,7 @@ function Shift_view($shift, $shifttype, $room, $angeltypes_source, ShiftSignupSt
|
|||
$admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : '',
|
||||
];
|
||||
}
|
||||
$buttons[] = button(user_link($user), '<span class="icon-icon_angel"></span> ' . __('My shifts'));
|
||||
$buttons[] = button(user_link($user['UID']), '<span class="icon-icon_angel"></span> ' . __('My shifts'));
|
||||
$content[] = buttons($buttons);
|
||||
|
||||
$content[] = Shift_view_header($shift, $room);
|
||||
|
|
|
@ -12,7 +12,7 @@ function UserDriverLicense_edit_view($user_source, $wants_to_drive, $user_driver
|
|||
{
|
||||
return page_with_title(sprintf(__('Edit %s driving license information'), User_Nick_render($user_source)), [
|
||||
buttons([
|
||||
button(user_link($user_source), __('Back to profile'), 'back')
|
||||
button(user_link($user_source['UID']), __('Back to profile'), 'back')
|
||||
]),
|
||||
msg(),
|
||||
form([
|
||||
|
|
|
@ -15,7 +15,7 @@ function UserWorkLog_delete_view($user_source, $userWorkLog)
|
|||
User_Nick_render($user_source)
|
||||
), true),
|
||||
buttons([
|
||||
button(user_link($user_source), glyph('remove') . __('cancel')),
|
||||
button(user_link($user_source['UID']), glyph('remove') . __('cancel')),
|
||||
button(user_worklog_delete_link($userWorkLog, [
|
||||
'confirmed' => 1
|
||||
]), glyph('ok') . __('delete'), 'btn-danger')
|
||||
|
@ -60,7 +60,7 @@ function UserWorkLog_edit_view($user_source, $userWorkLog)
|
|||
{
|
||||
return page_with_title(UserWorkLog_edit_title(), [
|
||||
buttons([
|
||||
button(user_link($user_source), __('back'))
|
||||
button(user_link($user_source['UID']), __('back'))
|
||||
]),
|
||||
msg(),
|
||||
UserWorkLog_edit_form($user_source, $userWorkLog)
|
||||
|
@ -78,7 +78,7 @@ function UserWorkLog_add_view($user_source, $userWorkLog)
|
|||
{
|
||||
return page_with_title(UserWorkLog_add_title(), [
|
||||
buttons([
|
||||
button(user_link($user_source), __('back'))
|
||||
button(user_link($user_source['UID']), __('back'))
|
||||
]),
|
||||
msg(),
|
||||
UserWorkLog_edit_form($user_source, $userWorkLog)
|
||||
|
|
|
@ -153,7 +153,7 @@ function User_delete_view($user)
|
|||
return page_with_title(sprintf(__('Delete %s'), User_Nick_render($user)), [
|
||||
msg(),
|
||||
buttons([
|
||||
button(user_edit_link($user), glyph('chevron-left') . __('back'))
|
||||
button(user_edit_link($user['UID']), glyph('chevron-left') . __('back'))
|
||||
]),
|
||||
error(
|
||||
__('Do you really want to delete the user including all his shifts and every other piece of his data?'),
|
||||
|
@ -177,7 +177,7 @@ function User_edit_vouchers_view($user)
|
|||
return page_with_title(sprintf(__('%s\'s vouchers'), User_Nick_render($user)), [
|
||||
msg(),
|
||||
buttons([
|
||||
button(user_link($user), glyph('chevron-left') . __('back'))
|
||||
button(user_link($user['UID']), glyph('chevron-left') . __('back'))
|
||||
]),
|
||||
info(sprintf(
|
||||
__('Angel should receive at least %d vouchers.'),
|
||||
|
|
Loading…
Reference in New Issue