aboutsummaryrefslogtreecommitdiff
path: root/app/views/resources/room_planning/booking_plan.php
blob: 52b98ade6bcf037b4e401ef7c2172064cde39292 (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<? if ($resource): ?>
    <? if (Request::get("allday")) {
        $min_time = '00:00:00';
        $max_time = '24:00:00';
    } else {
        $min_time = Config::get()->RESOURCES_BOOKING_PLAN_START_HOUR . ':00';
        $max_time = Config::get()->RESOURCES_BOOKING_PLAN_END_HOUR . ':00';
    } ?>

    <section id="booking_plan_header"
             class="studip-fullcalendar-header booking-plan-header">
            <span id="booking-plan-header-resource-name-line">
                <? if ($resource instanceof Room) : ?>
                    <?= htmlReady($resource->name) ?>
                    <span id="booking-plan-header-seats">
                        <?= htmlReady(sprintf(_('%d Sitzplätze'), $resource->seats)) ?>
                    </span>
                <? else : ?>
                    <?= htmlReady($resource->name) ?>
                <? endif ?>
                <span id="booking-plan-header-semrow">
                    <strong><span id="booking-plan-header-semname"></span> </strong>
                    <span id="booking-plan-header-semweek-part">
                        <span id="booking-plan-header-semweek"></span>
                    </span>
                </span>
            </span>
            <? if ($resource->getProperty('room_administrator')): ?>
                <div id="booking-plan-header-room_administrator-line">
                    <a href="<?= $resource->getProperty('room_administrator');?>">
                        <?= Icon::create('person', Icon::ROLE_CLICKABLE, ['class' => 'text-bottom']); ?>
                        <?= $resource->getPropertyObject('room_administrator')->display_name; ?>
                    </a>
                </div>
            <? endif; ?>
            <? if ($resource->getProperty('administration_url')): ?>
                <div id="booking-plan-header-administration_url-line">
                    <a href="<?= $resource->getProperty('administration_url');?>">
                        <?= Icon::create('link-extern', Icon::ROLE_CLICKABLE, ['class' => 'text-bottom']); ?>
                        <?= $resource->getPropertyObject('administration_url')->display_name; ?>
                    </a>
                </div>
            <? endif; ?>
        </section>
    <?= \Studip\Fullcalendar::create(
        _('Belegungsplan'),
        [
            'editable'    => true,
            'selectable'  => !empty($fullcalendar_studip_urls['add']),
            'studip_urls' => $fullcalendar_studip_urls,
            'slotMinTime' => $min_time,
            'slotMaxTime' => $max_time,
            'allDaySlot'  => false,
            'headerToolbar' => [
                'start' => implode(
                    ',',
                    [\Studip\Fullcalendar::VIEW_MONTH, \Studip\Fullcalendar::VIEW_WEEK, \Studip\Fullcalendar::VIEW_DAY]
                ),
                'end' => 'prev,next'
            ],
            'weekNumbers' => true,
            'views' => [
                \Studip\Fullcalendar::VIEW_MONTH => [
                    'eventTimeFormat' => ['hour' => 'numeric', 'minute' => '2-digit'],
                    'displayEventEnd' => true
                ],
                \Studip\Fullcalendar::VIEW_WEEK => [
                    'dayHeaderFormat' => ['weekday' => 'short', 'year' => 'numeric', 'month' => '2-digit', 'day' => '2-digit', 'omitCommas' => true]
                ],
                \Studip\Fullcalendar::VIEW_DAY => [
                    'dayHeaderFormat' => ['weekday' => 'long', 'year' => 'numeric', 'month' => '2-digit', 'day' => '2-digit', 'omitCommas' => true]
                ]
            ],
            'initialView' =>
                in_array(
                    Request::get("defaultView"),
                    [\Studip\Fullcalendar::VIEW_MONTH, \Studip\Fullcalendar::VIEW_WEEK, \Studip\Fullcalendar::VIEW_DAY]
                )
                ? Request::get("defaultView")
                : \Studip\Fullcalendar::VIEW_WEEK,
            'initialDate' => $date->format('Y-m-d'),
            'eventSources' => [
                [
                    'url' => URLHelper::getURL(
                        'dispatch.php/resources/ajax/get_booking_plan/' . $resource->id
                    ),
                    'method' => 'GET',
                    'extraParams' => [
                        'booking_types' => $booking_types,
                        'display_requests' => $anonymous_view ? 0 : 1,
                        'display_all_requests' => $display_all_requests ? 1 : 0
                    ]
                ]
            ],
            'confirm' => (
                UserConfig::get($GLOBALS['user']->id)->RESOURCES_CONFIRM_PLAN_DRAG_AND_DROP
                ? [
                    'drop' => _('Wollen Sie die Buchung wirklich ändern?')
                ]
                : []
            )
        ],
        ['class' => 'resource-plan'],
        'resources-fullcalendar'
    ) ?>
    <ul class="map-key-list">
        <? foreach ($table_keys as $key): ?>
            <li class="map-key">
                <span style="background-color:<?= $key['colour'] ?>">
                    &nbsp;
                </span>
                <?= htmlReady($key['text']) ?>
            </li>
        <? endforeach ?>
        <li class="map-key">
            <?= Icon::create('refresh', Icon::ROLE_INFO, ['class' => 'text-bottom']); ?>
            <?= _('Wiederholungstermin') ?>
        </li>
        <li class="map-key">
            <?= Icon::create('chat2', Icon::ROLE_INFO, ['class' => 'text-bottom']); ?>
            <?= _('Kommentar') ?>
        </li>
    </ul>
<? else: ?>
    <? if ($rooms): ?>
        <?= $this->render_partial(
            'resources/_common/_grouped_room_list.php',
            [
                'grouped_rooms' => RoomManager::groupRooms($rooms),
                'link_template' => $selection_link_template,
                'show_in_dialog' => false,
                'show_global_admin_actions' => $show_global_admin_actions,
            ]
        ) ?>
    <? else: ?>
        <?= MessageBox::error(
            _('Es wurde kein Raum ausgewählt und Sie haben keine Berechtigungen an Räumen!')
        ) ?>
    <? endif ?>
<? endif ?>