From 02b775684d643850e4a4ea3d9ac7028b6af3b469 Mon Sep 17 00:00:00 2001 From: msquare Date: Wed, 27 Dec 2017 12:45:48 +0100 Subject: some beauty for the my shifts table --- includes/view/User_view.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'includes') diff --git a/includes/view/User_view.php b/includes/view/User_view.php index 7a36aafe..198897f3 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -351,9 +351,10 @@ function User_view_myshift($shift, $user_source, $its_me) } $myshift = [ - 'date' => date('Y-m-d', $shift['start']), - 'time' => date('H:i', $shift['start']) . ' - ' . date('H:i', $shift['end']), - 'room' => $shift['Name'], + 'date' => glyph('calendar') . date('Y-m-d', $shift['start']) . '
' + . glyph('time') . date('H:i', $shift['start']) . ' - ' . date('H:i', $shift['end']), + 'duration' => round(($shift['end'] - $shift['start']) / 3600, 2) . ' h', + 'room' => Room_name_render($shift), 'shift_info' => $shift_info, 'comment' => '' ]; @@ -363,11 +364,12 @@ function User_view_myshift($shift, $user_source, $its_me) } if ($shift['freeloaded']) { + $myshift['duration'] = '

' . round(-($shift['end'] - $shift['start']) / 3600 * 2, 2) . ' h' . '

'; if (in_array('user_shifts_admin', $privileges)) { $myshift['comment'] .= '
' - . '

' . _('Freeloaded') . ': ' . $shift['freeload_comment'] . '

'; + . '

' . _('Freeloaded') . ': ' . $shift['freeload_comment'] . '

'; } else { - $myshift['comment'] .= '

' . _('Freeloaded') . '

'; + $myshift['comment'] .= '

' . _('Freeloaded') . '

'; } } @@ -416,7 +418,7 @@ function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshi if (count($myshifts_table) > 0) { $myshifts_table[] = [ 'date' => '' . _('Sum:') . '', - 'time' => '' . round($timesum / 3600, 2) . ' h', + 'duration' => '' . round($timesum / 3600, 2) . ' h', 'room' => '', 'shift_info' => '', 'comment' => '', @@ -425,7 +427,7 @@ function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshi if($its_me || $tshirt_admin) { $myshifts_table[] = [ 'date' => '' . _('Your t-shirt score') . '™:', - 'time' => '' . round($tshirt_score, 2) . ' h', + 'duration' => '' . round($tshirt_score, 2) . ' h', 'room' => '', 'shift_info' => '', 'comment' => '', @@ -512,8 +514,8 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel ]), ($its_me || $admin_user_privilege) ? '

' . _('Shifts') . '

' : '', ($its_me || $admin_user_privilege) ? table([ - 'date' => _('Day'), - 'time' => _('Time'), + 'date' => _('Day & time'), + 'duration' => _('Duration'), 'room' => _('Location'), 'shift_info' => _('Name & workmates'), 'comment' => _('Comment'), -- cgit v1.2.3-54-g00ecf