= $needed_angeltype['count'])
$class = 'progress-bar-success';
$needed_angels .= '
';
$needed_angels .= '
' . Shift_signup_button_render($shift, $angeltypes[$needed_angeltype['TID']]) . '
';
$needed_angels .= '
' . AngelType_name_render($angeltypes[$needed_angeltype['TID']]) . '
';
$needed_angels .= progress_bar(0, $needed_angeltype['count'], min($needed_angeltype['taken'], $needed_angeltype['count']), $class, $needed_angeltype['taken'] . ' / ' . $needed_angeltype['count']);
$angels = [];
foreach ($shift['ShiftEntry'] as $shift_entry) {
if ($shift_entry['TID'] == $needed_angeltype['TID']) {
$entry = User_Nick_render(User($shift_entry['UID']));
if ($shift_entry['freeloaded'])
$entry = '
' . $entry . '';
if ($user_shift_admin) {
$entry .= '
';
$entry .= button_glyph(page_link_to('user_myshifts') . '&edit=' . $shift_entry['id'] . '&id=' . $shift_entry['UID'], 'pencil', 'btn-xs');
$entry .= button_glyph(page_link_to('user_shifts') . '&entry_id=' . $shift_entry['id'], 'trash', 'btn-xs');
$entry .= '
';
}
$angels[] = $entry;
}
}
$needed_angels .= join(', ', $angels);
$needed_angels .= '
';
}
return page_with_title($shift['name'] . ' %c', [
msg(),
Shift_collides($shift, $user_shifts) ? info(_('This shift collides with one of your shifts.'), true) : '',
$signed_up ? info(_('You are signed up for this shift.'), true) : '',
($shift_admin || $admin_shifttypes || $admin_rooms) ? buttons([
$shift_admin ? button(shift_edit_link($shift), glyph('pencil') . _('edit')) : '',
$shift_admin ? button(shift_delete_link($shift), glyph('trash') . _('delete')) : '',
$admin_shifttypes ? button(shifttype_link($shifttype), $shifttype['name']) : '',
$admin_rooms ? button(room_link($room), glyph('map-marker') . $room['Name']) : ''
]) : '',
div('row', [
div('col-sm-3 col-xs-6', [
'' . _('Title') . '
',
'' . ($shift['URL'] != '' ? '' . $shift['title'] . '' : $shift['title']) . '
'
]),
div('col-sm-3 col-xs-6', [
'' . _('Start') . '
',
'',
glyph('calendar') . date('y-m-d', $shift['start']),
'
',
glyph('time') . date('H:i', $shift['start']),
'
'
]),
div('col-sm-3 col-xs-6', [
'' . _('End') . '
',
'',
glyph('calendar') . date('y-m-d', $shift['end']),
'
',
glyph('time') . date('H:i', $shift['end']),
'
'
]),
div('col-sm-3 col-xs-6', [
'' . _('Location') . '
',
'' . glyph('map-marker') . $room['Name'] . '
'
])
]),
div('row', [
div('col-sm-6', [
'' . _('Needed angels') . '
',
'' . $needed_angels . '
'
]),
div('col-sm-6', [
'' . _('Description') . '
',
$parsedown->parse($shifttype['description'])
])
])
]);
}
/**
* Calc shift length in format 12:23h.
*
* @param Shift $shift
*/
function shift_length($shift) {
$length = floor(($shift['end'] - $shift['start']) / (60 * 60)) . ":";
$length .= str_pad((($shift['end'] - $shift['start']) % (60 * 60)) / 60, 2, "0", STR_PAD_LEFT) . "h";
return $length;
}
?>