0) {
$shift_panels = [
'
'
];
foreach ($free_shifts as $shift) {
$shift_panels[] = public_dashboard_shift_render($shift);
if(count($shift_panels) % 4 == 0) {
$shift_panels[] = '
';
}
}
$shift_panels[] = '
';
$needed_angels = div('first', [
div('col-md-12', [
heading(_('Needed angels:'), 1)
]),
join($shift_panels)
]);
}
return page([
div('public-dashboard', [
div('first', [
stats(_('Angels needed in the next 3 hrs'), $stats['needed-3-hours']),
stats(_('Angels needed for nightshifts'), $stats['needed-night']),
stats(_('Angels currently working'), $stats['angels-working'], 'default'),
stats(_('Hours to be worked'), $stats['hours-to-work'], 'default'),
''
], 'statistics'),
$needed_angels
], 'public-dashboard'),
div('first col-md-12 text-center', [
buttons([
button_js('
$(\'#navbar-collapse-1,#footer,#fullscreen-button\').remove();
$(\'.navbar-brand\').append(\' ' . _('Public Dashboard') . '\');
', glyph('fullscreen') . _('Fullscreen'))
])
], 'fullscreen-button')
]);
}
/**
* Renders a single shift panel for a dashboard shift with needed angels
*
* @param array $shift
* @return string
*/
function public_dashboard_shift_render($shift)
{
$panel_body = glyph('time') . $shift['start'] . ' - ' . $shift['end'];
$panel_body .= ' (' . $shift['duration'] . ' h)';
$panel_body .= '
' . glyph('tasks') . $shift['shifttype_name'];
if (!empty($shift['title'])) {
$panel_body .= ' (' . $shift['title'] . ')';
}
$panel_body .= '
' . glyph('map-marker') . $shift['room_name'];
foreach ($shift['needed_angels'] as $needed_angels) {
$panel_body .= '
' . glyph('user')
. ''
. $needed_angels['need'] . ' × ' . $needed_angels['angeltype_name']
. '';
}
return div('col-md-3', [
div('dashboard-panel panel panel-' . $shift['style'], [
div('panel-body', [
'',
$panel_body
])
])
]);
}