|
|
@ -223,20 +223,8 @@ function User_shift_state_render($user) {
|
|
|
|
return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['end'] . '">' . _("Shift ends %c") . '</span>';
|
|
|
|
return '<span class="text-danger moment-countdown" data-timestamp="' . $upcoming_shifts[0]['end'] . '">' . _("Shift ends %c") . '</span>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me) {
|
|
|
|
function User_view_shiftentries($needed_angel_type) {
|
|
|
|
global $LETZTES_AUSTRAGEN, $privileges;
|
|
|
|
$shift_info = '<br><b>' . $needed_angel_type['name'] . ':</b> ';
|
|
|
|
|
|
|
|
|
|
|
|
$user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$myshifts_table = [];
|
|
|
|
|
|
|
|
$timesum = 0;
|
|
|
|
|
|
|
|
foreach ($shifts as $shift) {
|
|
|
|
|
|
|
|
$shift_info = '<a href="' . shift_link($shift) . '">' . $shift['name'] . '</a>';
|
|
|
|
|
|
|
|
if ($shift['title']) {
|
|
|
|
|
|
|
|
$shift_info .= '<br /><a href="' . shift_link($shift) . '">' . $shift['title'] . '</a>';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($shift['needed_angeltypes'] as $needed_angel_type) {
|
|
|
|
|
|
|
|
$shift_info .= '<br><b>' . $needed_angel_type['name'] . ':</b> ';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$shift_entries = [];
|
|
|
|
$shift_entries = [];
|
|
|
|
foreach ($needed_angel_type['users'] as $user_shift) {
|
|
|
|
foreach ($needed_angel_type['users'] as $user_shift) {
|
|
|
@ -248,6 +236,22 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
|
|
|
|
$shift_entries[] = $member;
|
|
|
|
$shift_entries[] = $member;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$shift_info .= join(", ", $shift_entries);
|
|
|
|
$shift_info .= join(", ", $shift_entries);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $shift_info;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Helper that renders a shift line for user view
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function User_view_myshift($shift, $user_source, $its_me) {
|
|
|
|
|
|
|
|
global $LETZTES_AUSTRAGEN, $privileges;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$shift_info = '<a href="' . shift_link($shift) . '">' . $shift['name'] . '</a>';
|
|
|
|
|
|
|
|
if ($shift['title']) {
|
|
|
|
|
|
|
|
$shift_info .= '<br /><a href="' . shift_link($shift) . '">' . $shift['title'] . '</a>';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($shift['needed_angeltypes'] as $needed_angel_type) {
|
|
|
|
|
|
|
|
$shift_info .= User_view_shiftentries($needed_angel_type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$myshift = [
|
|
|
|
$myshift = [
|
|
|
@ -277,13 +281,25 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$myshift['actions'] = table_buttons($myshift['actions']);
|
|
|
|
$myshift['actions'] = table_buttons($myshift['actions']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $myshift;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Helper that prepares the shift table for user view
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function User_view_myshifts($shifts, $user_source, $its_me) {
|
|
|
|
|
|
|
|
$myshifts_table = [];
|
|
|
|
|
|
|
|
$timesum = 0;
|
|
|
|
|
|
|
|
foreach ($shifts as $shift) {
|
|
|
|
|
|
|
|
$myshifts_table[] = User_view_myshift($shift, $user_source, $its_me);
|
|
|
|
|
|
|
|
|
|
|
|
if ($shift['freeloaded']) {
|
|
|
|
if ($shift['freeloaded']) {
|
|
|
|
$timesum += (- 2 * ($shift['end'] - $shift['start']));
|
|
|
|
$timesum += (- 2 * ($shift['end'] - $shift['start']));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$timesum += ($shift['end'] - $shift['start']);
|
|
|
|
$timesum += ($shift['end'] - $shift['start']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$myshifts_table[] = $myshift;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (count($myshifts_table) > 0) {
|
|
|
|
if (count($myshifts_table) > 0) {
|
|
|
|
$myshifts_table[] = [
|
|
|
|
$myshifts_table[] = [
|
|
|
|
'date' => '<b>' . _("Sum:") . '</b>',
|
|
|
|
'date' => '<b>' . _("Sum:") . '</b>',
|
|
|
@ -294,6 +310,15 @@ function User_view($user_source, $admin_user_privilege, $freeloader, $user_angel
|
|
|
|
'actions' => ""
|
|
|
|
'actions' => ""
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $myshifts_table;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Renders view for a single user
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function User_view($user_source, $admin_user_privilege, $freeloader, $user_angeltypes, $user_groups, $shifts, $its_me) {
|
|
|
|
|
|
|
|
$user_name = htmlspecialchars($user_source['Vorname']) . " " . htmlspecialchars($user_source['Name']);
|
|
|
|
|
|
|
|
$myshifts_table = User_view_myshifts($shifts, $user_source, $its_me);
|
|
|
|
|
|
|
|
|
|
|
|
return page_with_title('<span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . ' <small>' . $user_name . '</small>', [
|
|
|
|
return page_with_title('<span class="icon-icon_angel"></span> ' . htmlspecialchars($user_source['Nick']) . ' <small>' . $user_name . '</small>', [
|
|
|
|
msg(),
|
|
|
|
msg(),
|
|
|
|