aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/search/rooms.php
blob: 1149a1927be5372500d8ae73349a83e546b16a18 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<? if (is_array($rooms) && count($rooms)): ?>
    <table class="default sortable-table">
        <colgroup>
            <col style="width: 20px">
            <col style="width: 30%">
            <col style="width: 30%">
        </colgroup>
        <thead>
            <tr>
                <th data-sort="text" colspan="2"><?= _('Name')?></th>
                <th><?= _('Beschreibung')?></th>
                <th data-sort="number" ><?= _('Sitzplätze')?></th>
                <th class="actions"><?= _('Aktion')?></th>
            </tr>
        </thead>
        <tbody>
            <? foreach ($rooms as $room): ?>
                <tr>
                    <td class="drag-handle clipboard-draggable-item"
                        data-id="<?= $room->id ?>" data-range_type="Room" data-name="<?= htmlReady($room->name) ?>">
                    </td>
                    <td>
                        <? if ($room->bookingPlanVisibleForUser($current_user)): ?>
                            <a href="<?= $room->getActionLink('booking_plan', $booking_plan_action_params) ?>" data-dialog="size=big">
                                <?= htmlReady($room->name) ?>
                            </a>
                        <? else : ?>
                            <?= htmlReady($room->name) ?>
                        <? endif ?>
                    </td>
                    <td>
                        <? if ($room->description): ?>
                            <?= htmlReady($room->description) ?>
                        <? endif ?>
                    </td>
                    <td>
                        <? if ($room->seats): ?>
                            <?= htmlReady($room->seats) ?>
                        <? endif ?>
                    </td>
                    <td class="actions">
                        <?
                        $actions = ActionMenu::get();
                        $actions->addLink(
                            $room->getActionURL('show'),
                            _('Raumdetails anzeigen'),
                            Icon::create('info-circle'),
                            ['data-dialog' => '']
                        );
                        if ($room->bookingPlanVisibleForUser($current_user)) {
                            $actions->addLink(
                                $room->getActionURL('booking_plan', $booking_plan_action_params),
                                (
                                    $room->userHasPermission($current_user, 'autor')
                                        ? _('Wochenbelegung')
                                        : _('Belegungsplan')
                                ),
                                Icon::create('timetable'),
                                ['target' => '_blank']
                            );
                            $actions->addLink(
                                $room->getActionURL('semester_plan'),
                                _('Semesterbelegung'),
                                Icon::create('timetable'),
                                ['target' => '_blank']
                            );
                        }
                        if ($room->requestable && $room->userHasRequestRights($current_user)) {
                            $actions->addLink(
                                $room->getActionURL('request'),
                                _('Raum anfragen'),
                                Icon::create('room-request'),
                                ['data-dialog' => 'size=auto']
                            );
                        }
                        if ($room->building) {
                            $geo_coordinates_object = $room->building->getPropertyObject('geo_coordinates');
                            if ($geo_coordinates_object instanceof ResourceProperty) {
                                $actions->addLink(
                                    ResourceManager::getMapUrlForResourcePosition(
                                        $room->building->getPropertyObject('geo_coordinates')
                                    ),
                                    _('Zum Lageplan'),
                                    Icon::create('globe'),
                                    ['target' => '_blank']
                                );
                            }
                        }
                        if ($clipboard_widget_id) {
                            $actions->addLink(
                                '#',
                                _('Zur Raumgruppe hinzufügen'),
                                IcoN::create('add'),
                                [
                                    'class'             => 'clipboard-add-item-button',
                                    'data-range_type'   => 'Room',
                                    'data-range_id'     => $room->id,
                                    'data-clipboard_id' => $clipboard_widget_id
                                ]
                            );
                        }
                        echo $actions->render();
                        ?>
                    </td>
                </tr>
            <? endforeach ?>
        </tbody>
    </table>
<? else: ?>
    <? if ($form_submitted && !$has_errors): ?>
        <?= MessageBox::info(
            _('Es wurden keine Räume gefunden, die zu den angegebenen Suchkriterien passen!')
        ) ?>
    <? endif ?>
    <? if (!$form_submitted): ?>
        <?= MessageBox::info(
            _('Wählen Sie Suchkriterien oder ein Element im Ressourcenbaum, um Räume zu finden.')
        ) ?>
    <? endif ?>
<? endif ?>