You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.9 KiB
PHTML

<?php
use Engelsystem\ShiftCalendarRenderer;
8 years ago
use Engelsystem\ShiftsFilterRenderer;
/**
*
* @param array $room
* @param ShiftsFilterRenderer $shiftsFilterRenderer
* @param ShiftCalendarRenderer $shiftCalendarRenderer
* @return string
*/
8 years ago
function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer)
{
$user = Auth()->user();
$assignNotice = '';
if (config('signup_requires_arrival') && !$user->state->arrived) {
$assignNotice = info(render_user_arrived_hint(), true);
}
$description = '';
if (!empty($room['description'])) {
$description = '<h3>' . __('Description') . '</h3>';
$parsedown = new Parsedown();
$description .= '<div class="well">' . $parsedown->parse($room['description']) . '</div>';
}
$tabs = [];
if (!empty($room['map_url'])) {
$tabs[__('Map')] = sprintf(
'<div class="map">'
7 years ago
. '<iframe style="width: 100%%; min-height: 400px; border: 0 none;" src="%s"></iframe>'
. '</div>',
$room['map_url']
);
}
$tabs[__('Shifts')] = div('first', [
$shiftsFilterRenderer->render(page_link_to('rooms', [
'action' => 'view',
'room_id' => $room['RID']
])),
8 years ago
$shiftCalendarRenderer->render()
]);
$selected_tab = 0;
$request = request();
if ($request->has('shifts_filter_day')) {
$selected_tab = count($tabs) - 1;
}
return page_with_title(glyph('map-marker') . $room['Name'], [
$assignNotice,
$description,
tabs($tabs, $selected_tab)
]);
}
/**
*
* @param array $room
* @return string
*/
8 years ago
function Room_name_render($room)
{
global $privileges;
8 years ago
if (in_array('view_rooms', $privileges)) {
return '<a href="' . room_link($room) . '">' . glyph('map-marker') . $room['Name'] . '</a>';
}
8 years ago
return glyph('map-marker') . $room['Name'];
}