summaryrefslogtreecommitdiff
path: root/includes/view/Rooms_view.php
blob: adb58a9acf6ea3defbd629f02e5abe4008989450 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

use Engelsystem\ShiftCalendarRenderer;
use Engelsystem\ShiftsFilterRenderer;

/**
 * @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']) {
        $assignNotice = info(render_user_arrived_hint(), true);
    }

    return page_with_title(glyph('map-marker') . $room['Name'], [
        $shiftsFilterRenderer->render($room),
        $assignNotice,
        $shiftCalendarRenderer->render()
    ]);
}

/**
 * @param array $room
 * @return string
 */
function Room_name_render($room)
{
    global $privileges;
    if (in_array('view_rooms', $privileges)) {
        return '<a href="' . room_link($room) . '">' . glyph('map-marker') . $room['Name'] . '</a>';
    }
    return glyph('map-marker') . $room['Name'];
}