= $needed_angeltype['count'])
$class = 'progress-bar-success';
$needed_angels .= '
';
$needed_angels .= '
' . button(page_link_to('user_shifts') . '&shift_id=' . $shift['SID'] . '&type_id=' . $needed_angeltype['TID'], _('Sign up')) . '
';
$needed_angels .= '
' . $angeltypes[$needed_angeltype['TID']]['name'] . '
';
$needed_angels .= progress_bar(0, $needed_angeltype['count'], $needed_angeltype['taken'], $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['SID'] . '&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_admin ? buttons([
button(shift_edit_link($shift), glyph('pencil') . _('edit')),
button(shift_delete_link($shift), glyph('trash') . _('delete'))
]) : '',
div('row', [
div('col-sm-3', [
'' . _('Start') . '
',
'',
date('y-m-d', $shift['start']),
'
',
date('H:i', $shift['start']),
'
'
]),
div('col-sm-3', [
'' . _('End') . '
',
'',
date('y-m-d', $shift['end']),
'
',
date('H:i', $shift['end']),
'
'
]),
div('col-sm-3', [
'' . _('Location') . '
',
'' . $room['Name'] . '
'
]),
div('col-sm-3', [
'' . _('More info') . '
',
$shift['URL'] != '' ? '' . $shift['URL'] . '' : ''
])
]),
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;
}
?>