From d34b160b5c6200a24d9bbe1235b44e1c300ef1f0 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 19 Nov 2017 16:29:51 +0100 Subject: [PATCH] Added links to notifications, closes #357 --- includes/view/User_view.php | 38 +++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/includes/view/User_view.php b/includes/view/User_view.php index c1e6f49e..fb8715b7 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -620,9 +620,32 @@ function User_groups_render($user_groups) */ function User_Nick_render($user_source) { - return ' ' . htmlspecialchars($user_source['Nick']) . ''; + return render_profile_link( + ' ' . htmlspecialchars($user_source['Nick']) . '', + $user_source['UID'], + ($user_source['Gekommen'] ? '' : 'text-muted') + ); +} + +/** + * @param string $text + * @param int $user_id + * @param string $class + * @return string + */ +function render_profile_link($text, $user_id = null, $class = '') +{ + $profile_link = page_link_to('user-settings'); + if (!is_null($user_id)) { + $profile_link = page_link_to('users', ['action' => 'view', 'user_id' => $user_id]); + } + + return sprintf( + '%s', + $class, + $profile_link, + $text + ); } /** @@ -633,7 +656,8 @@ function render_user_departure_date_hint() global $user; if (!isset($user['planned_departure_date']) || $user['planned_departure_date'] == null) { - return _('Please enter your planned date of departure on your settings page to give us a feeling for teardown capacities.'); + $text = _('Please enter your planned date of departure on your settings page to give us a feeling for teardown capacities.'); + return render_profile_link($text); } return null; @@ -680,7 +704,8 @@ function render_user_tshirt_hint() global $user; if (config('enable_tshirt_size') && $user['Size'] == '') { - return _('You need to specify a tshirt size in your settings!'); + $text = _('You need to specify a tshirt size in your settings!'); + return render_profile_link($text); } return null; @@ -694,7 +719,8 @@ function render_user_dect_hint() global $user; if ($user['DECT'] == '') { - return _('You need to specify a DECT phone number in your settings! If you don\'t have a DECT phone, just enter \'-\'.'); + $text = _('You need to specify a DECT phone number in your settings! If you don\'t have a DECT phone, just enter \'-\'.'); + return render_profile_link($text); } return null;