diff options
author | msquare <msquare@notrademark.de> | 2017-12-10 15:02:37 +0100 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2017-12-10 15:02:37 +0100 |
commit | 4143680297808dd23fe03b121f28ad5183601b8b (patch) | |
tree | 75d8c819afd4590d0d792200a6d906c7957b63dc /includes/view/Rooms_view.php | |
parent | ef0dbe8a1bd80fb9bec0400e84550df02f138dbd (diff) |
remove room number and visible flag, rename pentabarf to frab and introduce map/c3nav integration as well as markdown description for rooms
Diffstat (limited to 'includes/view/Rooms_view.php')
-rw-r--r-- | includes/view/Rooms_view.php | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/includes/view/Rooms_view.php b/includes/view/Rooms_view.php index bd6138e1..1f0f9954 100644 --- a/includes/view/Rooms_view.php +++ b/includes/view/Rooms_view.php @@ -1,35 +1,60 @@ <?php - use Engelsystem\ShiftCalendarRenderer; use Engelsystem\ShiftsFilterRenderer; /** - * @param array $room - * @param ShiftsFilterRenderer $shiftsFilterRenderer - * @param ShiftCalendarRenderer $shiftCalendarRenderer + * + * @param array $room + * @param ShiftsFilterRenderer $shiftsFilterRenderer + * @param ShiftCalendarRenderer $shiftCalendarRenderer * @return string */ function Room_view($room, ShiftsFilterRenderer $shiftsFilterRenderer, ShiftCalendarRenderer $shiftCalendarRenderer) { global $user; - + $assignNotice = ''; - if (config('signup_requires_arrival') && !$user['Gekommen']) { + if (config('signup_requires_arrival') && ! $user['Gekommen']) { $assignNotice = info(render_user_arrived_hint(), true); } - - return page_with_title(glyph('map-marker') . $room['Name'], [ + + $description = ''; + if (! empty($room['description'])) { + $description = '<h3>' . _('Description') . '</h3>'; + $parsedown = new Parsedown(); + $description .= '<div class="well">' . $parsedown->parse($room['description']) . '</div>'; + } + + $tabs = []; + $selected = 0; + if (! empty($room['map_url'])) { + $tabs[_('Map')] = '<div class="map"><iframe style="width: 100%; min-height: 400px; border: 0px none;" src="' . $room['map_url'] . '"></iframe></div>'; + } + + $tabs[_('Shifts')] = div('first', [ $shiftsFilterRenderer->render(page_link_to('rooms', [ - 'action' => 'view', - 'room_id' => $room['RID'] + 'action' => 'view', + 'room_id' => $room['RID'] ])), - $assignNotice, $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 + * + * @param array $room * @return string */ function Room_name_render($room) |