|
|
@ -406,10 +406,21 @@ function User_view_myshift($shift, $user_source, $its_me)
|
|
|
|
* @param array[] $shifts
|
|
|
|
* @param array[] $shifts
|
|
|
|
* @param array $user_source
|
|
|
|
* @param array $user_source
|
|
|
|
* @param bool $its_me
|
|
|
|
* @param bool $its_me
|
|
|
|
|
|
|
|
* @param int $tshirt_score
|
|
|
|
|
|
|
|
* @param bool $tshirt_admin
|
|
|
|
|
|
|
|
* @param array[] $user_worklogs
|
|
|
|
|
|
|
|
* @param $admin_user_worklog_privilege
|
|
|
|
* @return array
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshirt_admin, $user_worklogs, $admin_user_worklog_privilege)
|
|
|
|
function User_view_myshifts(
|
|
|
|
{
|
|
|
|
$shifts,
|
|
|
|
|
|
|
|
$user_source,
|
|
|
|
|
|
|
|
$its_me,
|
|
|
|
|
|
|
|
$tshirt_score,
|
|
|
|
|
|
|
|
$tshirt_admin,
|
|
|
|
|
|
|
|
$user_worklogs,
|
|
|
|
|
|
|
|
$admin_user_worklog_privilege
|
|
|
|
|
|
|
|
) {
|
|
|
|
$myshifts_table = [];
|
|
|
|
$myshifts_table = [];
|
|
|
|
$timesum = 0;
|
|
|
|
$timesum = 0;
|
|
|
|
foreach ($shifts as $shift) {
|
|
|
|
foreach ($shifts as $shift) {
|
|
|
@ -420,8 +431,8 @@ function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if($its_me || $admin_user_worklog_privilege) {
|
|
|
|
if ($its_me || $admin_user_worklog_privilege) {
|
|
|
|
foreach($user_worklogs as $worklog) {
|
|
|
|
foreach ($user_worklogs as $worklog) {
|
|
|
|
$myshifts_table[$worklog['work_timestamp']] = User_view_worklog($worklog, $admin_user_worklog_privilege);
|
|
|
|
$myshifts_table[$worklog['work_timestamp']] = User_view_worklog($worklog, $admin_user_worklog_privilege);
|
|
|
|
$timesum += $worklog['work_hours'] * 3600;
|
|
|
|
$timesum += $worklog['work_hours'] * 3600;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -453,12 +464,15 @@ function User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshi
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Renders table entry for user work log
|
|
|
|
* Renders table entry for user work log
|
|
|
|
* @param UserWorkLog $worklog
|
|
|
|
*
|
|
|
|
* @param bool $admin_user_worklog_privilege
|
|
|
|
* @param array $worklog
|
|
|
|
|
|
|
|
* @param bool $admin_user_worklog_privilege
|
|
|
|
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function User_view_worklog($worklog, $admin_user_worklog_privilege) {
|
|
|
|
function User_view_worklog($worklog, $admin_user_worklog_privilege)
|
|
|
|
|
|
|
|
{
|
|
|
|
$actions = '';
|
|
|
|
$actions = '';
|
|
|
|
if($admin_user_worklog_privilege) {
|
|
|
|
if ($admin_user_worklog_privilege) {
|
|
|
|
$actions = table_buttons([
|
|
|
|
$actions = table_buttons([
|
|
|
|
button(
|
|
|
|
button(
|
|
|
|
user_worklog_edit_link($worklog),
|
|
|
|
user_worklog_edit_link($worklog),
|
|
|
@ -479,11 +493,11 @@ function User_view_worklog($worklog, $admin_user_worklog_privilege) {
|
|
|
|
'room' => '',
|
|
|
|
'room' => '',
|
|
|
|
'shift_info' => _('Work log entry'),
|
|
|
|
'shift_info' => _('Work log entry'),
|
|
|
|
'comment' => $worklog['comment'] . '<br>'
|
|
|
|
'comment' => $worklog['comment'] . '<br>'
|
|
|
|
. sprintf(
|
|
|
|
. sprintf(
|
|
|
|
_('Added by %s at %s'),
|
|
|
|
_('Added by %s at %s'),
|
|
|
|
User_Nick_render(User($worklog['created_user_id'])),
|
|
|
|
User_Nick_render(User($worklog['created_user_id'])),
|
|
|
|
date('Y-m-d H:i', $worklog['created_timestamp'])
|
|
|
|
date('Y-m-d H:i', $worklog['created_timestamp'])
|
|
|
|
),
|
|
|
|
),
|
|
|
|
'actions' => $actions
|
|
|
|
'actions' => $actions
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -500,6 +514,8 @@ function User_view_worklog($worklog, $admin_user_worklog_privilege) {
|
|
|
|
* @param bool $its_me
|
|
|
|
* @param bool $its_me
|
|
|
|
* @param int $tshirt_score
|
|
|
|
* @param int $tshirt_score
|
|
|
|
* @param bool $tshirt_admin
|
|
|
|
* @param bool $tshirt_admin
|
|
|
|
|
|
|
|
* @param bool $admin_user_worklog_privilege
|
|
|
|
|
|
|
|
* @param array[] $user_worklogs
|
|
|
|
* @return string
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
function User_view(
|
|
|
|
function User_view(
|
|
|
@ -517,9 +533,17 @@ function User_view(
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
$user_name = htmlspecialchars($user_source['Vorname']) . ' ' . htmlspecialchars($user_source['Name']);
|
|
|
|
$user_name = htmlspecialchars($user_source['Vorname']) . ' ' . htmlspecialchars($user_source['Name']);
|
|
|
|
$myshifts_table = '';
|
|
|
|
$myshifts_table = '';
|
|
|
|
if($its_me || $admin_user_privilege) {
|
|
|
|
if ($its_me || $admin_user_privilege) {
|
|
|
|
$my_shifts = User_view_myshifts($shifts, $user_source, $its_me, $tshirt_score, $tshirt_admin, $user_worklogs, $admin_user_worklog_privilege);
|
|
|
|
$my_shifts = User_view_myshifts(
|
|
|
|
if(count($my_shifts) > 0) {
|
|
|
|
$shifts,
|
|
|
|
|
|
|
|
$user_source,
|
|
|
|
|
|
|
|
$its_me,
|
|
|
|
|
|
|
|
$tshirt_score,
|
|
|
|
|
|
|
|
$tshirt_admin,
|
|
|
|
|
|
|
|
$user_worklogs,
|
|
|
|
|
|
|
|
$admin_user_worklog_privilege
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
if (count($my_shifts) > 0) {
|
|
|
|
$myshifts_table = table([
|
|
|
|
$myshifts_table = table([
|
|
|
|
'date' => _('Day & time'),
|
|
|
|
'date' => _('Day & time'),
|
|
|
|
'duration' => _('Duration'),
|
|
|
|
'duration' => _('Duration'),
|
|
|
@ -528,7 +552,7 @@ function User_view(
|
|
|
|
'comment' => _('Comment'),
|
|
|
|
'comment' => _('Comment'),
|
|
|
|
'actions' => _('Action')
|
|
|
|
'actions' => _('Action')
|
|
|
|
], $my_shifts);
|
|
|
|
], $my_shifts);
|
|
|
|
} elseif($user_source['force_active']) {
|
|
|
|
} elseif ($user_source['force_active']) {
|
|
|
|
$myshifts_table = success(_('You have done enough to get a t-shirt.'), true);
|
|
|
|
$myshifts_table = success(_('You have done enough to get a t-shirt.'), true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|