From 14584b96114d2fcb0dabe49a9c857ff241421cc8 Mon Sep 17 00:00:00 2001 From: msquare Date: Fri, 29 Dec 2017 13:18:28 +0100 Subject: [PATCH] small improvements of user view --- includes/view/User_view.php | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/includes/view/User_view.php b/includes/view/User_view.php index 2b92923e..fff2952e 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -439,8 +439,6 @@ function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshi 'actions' => '' ]; } - } elseif($user_source['force_active']) { - $myshifts_table[] = success(_('You have done enough to get a t-shirt.'), true); } return $myshifts_table; } @@ -471,7 +469,22 @@ function User_view( $tshirt_admin ) { $user_name = htmlspecialchars($user_source['Vorname']) . ' ' . htmlspecialchars($user_source['Name']); - $myshifts_table = User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshirt_admin); + $myshifts_table = ''; + if($its_me || $admin_user_privilege) { + $my_shifts = User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshirt_admin); + if(count($my_shifts) > 0) { + $myshifts_table = table([ + 'date' => _('Day & time'), + 'duration' => _('Duration'), + 'room' => _('Location'), + 'shift_info' => _('Name & workmates'), + 'comment' => _('Comment'), + 'actions' => _('Action') + ], $my_shifts); + } elseif($user_source['force_active']) { + $myshifts_table = success(_('You have done enough to get a t-shirt.'), true); + } + } return page_with_title( ' ' @@ -529,14 +542,7 @@ function User_view( User_groups_render($user_groups) ]), ($its_me || $admin_user_privilege) ? '

' . _('Shifts') . '

' : '', - ($its_me || $admin_user_privilege) ? table([ - 'date' => _('Day & time'), - 'duration' => _('Duration'), - 'room' => _('Location'), - 'shift_info' => _('Name & workmates'), - 'comment' => _('Comment'), - 'actions' => _('Action') - ], $myshifts_table) : '', + $myshifts_table, $its_me ? info( glyph('info-sign') . _('Your night shifts between 2 and 8 am count twice.'), true