summaryrefslogtreecommitdiff
path: root/includes/view
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2017-12-27 12:24:55 +0100
committermsquare <msquare@notrademark.de>2017-12-27 12:24:55 +0100
commit1e8f0c484588882e01bc173f7f60e2cf1376f790 (patch)
tree92a039f8449c55109e4e1832deef4fe56177ae4d /includes/view
parentabf4b1da30e7fabebfa5e36cfc5c1fe691320a1e (diff)
fixes #208, fixes #310: T-Shirt Score™ should be shown on the user view page below your shifts
Diffstat (limited to 'includes/view')
-rw-r--r--includes/view/User_view.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/includes/view/User_view.php b/includes/view/User_view.php
index a80eb096..7a36aafe 100644
--- a/includes/view/User_view.php
+++ b/includes/view/User_view.php
@@ -401,16 +401,14 @@ function User_view_myshift($shift, $user_source, $its_me)
* @param bool $its_me
* @return array
*/
-function User_view_myshifts($shifts, $user_source, $its_me)
+function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshirt_admin)
{
$myshifts_table = [];
$timesum = 0;
foreach ($shifts as $shift) {
$myshifts_table[] = User_view_myshift($shift, $user_source, $its_me);
- if ($shift['freeloaded']) {
- $timesum += (-2 * ($shift['end'] - $shift['start']));
- } else {
+ if (!$shift['freeloaded']) {
$timesum += ($shift['end'] - $shift['start']);
}
}
@@ -418,12 +416,22 @@ function User_view_myshifts($shifts, $user_source, $its_me)
if (count($myshifts_table) > 0) {
$myshifts_table[] = [
'date' => '<b>' . _('Sum:') . '</b>',
- 'time' => '<b>' . round($timesum / 3600, 1) . ' h</b>',
+ 'time' => '<b>' . round($timesum / 3600, 2) . ' h</b>',
'room' => '',
'shift_info' => '',
'comment' => '',
'actions' => ''
];
+ if($its_me || $tshirt_admin) {
+ $myshifts_table[] = [
+ 'date' => '<b>' . _('Your t-shirt score') . '&trade;:</b>',
+ 'time' => '<b>' . round($tshirt_score, 2) . ' h</b>',
+ 'room' => '',
+ 'shift_info' => '',
+ 'comment' => '',
+ 'actions' => ''
+ ];
+ }
}
return $myshifts_table;
}
@@ -438,12 +446,14 @@ function User_view_myshifts($shifts, $user_source, $its_me)
* @param array[] $user_groups
* @param array[] $shifts
* @param bool $its_me
+ * @param int $tshirt_score
+ * @param bool $tshirt_admin
* @return string
*/
-function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me)
+function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me, $tshirt_score, $tshirt_admin)
{
$user_name = htmlspecialchars($user_source['Vorname']) . ' ' . htmlspecialchars($user_source['Name']);
- $myshifts_table = User_view_myshifts($shifts, $user_source, $its_me);
+ $myshifts_table = User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshirt_admin);
return page_with_title(
'<span class="icon-icon_angel"></span> '