aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/timesrooms/editDate.php
blob: f17c52aef50e05fb4b10585df12c26d9fba0b57c (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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<?php
/**
 * @var Course_TimesroomsController $controller
 * @var CourseDate $date
 * @var Room[] $selectable_rooms
 * @var QuickSearch|null $room_search
 * @var bool $only_bookable_rooms
 * @var int $preparation_time
 * @var int $max_preparation_time
 * @var CourseMember[] $teachers
 * @var User[] $assigned_teachers
 * @var Statusgruppen[] $groups
 * @var Statusgruppen[] $assigned_groups
 */
?>
<form action="<?= $controller->link_for('course/timesrooms/saveDate/' . $date->termin_id) ?>"
      method="post" class="default collapsable" <?= Request::int('fromDialog') ? 'data-dialog="size=big"' : '' ?>>
    <?= CSRFProtection::tokenTag() ?>
    <fieldset style="margin-top: 1ex">
        <legend><?= _('Zeitangaben') ?></legend>
        <label id="course_type" class=col-6>
            <?= _('Art') ?>
            <select name="course_type" id="course_type" class="size-s">
                <? foreach ($GLOBALS['TERMIN_TYP'] as $id => $value) : ?>
                    <option value="<?= $id ?>"
                        <?= $date->date_typ == $id ? 'selected' : '' ?>>
                        <?= htmlReady($value['name']) ?>
                    </option>
                <? endforeach ?>
            </select>
        </label>
        <label class="col-2">
            <?= _('Datum') ?>
            <input class="has-date-picker size-s" type="text" name="date" required
                   value="<?= $date->date ? strftime('%d.%m.%Y', $date->date) : '' ?>">
        </label>
        <label class="col-2">
            <?= _('Startzeit') ?>
            <input class="studip-timepicker size-s" type="text" name="start_time" required placeholder="HH:mm"
                   value="<?= $date->date ? strftime('%H:%M', $date->date) : '' ?>">
        </label>
        <label class="col-2">
            <?= _('Endzeit') ?>
            <input class="studip-timepicker size-s" type="text" name="end_time" required placeholder="HH:mm"
                   value="<?= $date->end_time ? strftime('%H:%M', $date->end_time) : '' ?>">
        </label>
    </fieldset>
    <fieldset>
        <legend><?= _('Raumangaben') ?></legend>
        <? if (Config::get()->RESOURCES_ENABLE
               && ($selectable_rooms || $room_search)): ?>
            <label>
                <input style="display: inline;" type="radio" name="room" value="room"
                       id="room" <? if ($date->room_booking) echo 'checked'; ?>
                       data-activates="input.preparation-time[name='preparation_time'],input.preparation-time[name='subsequent_time']">
                <?= _('Raum direkt buchen') ?>
                <span class="flex-row">
                    <? if ($room_search && !$only_bookable_rooms): ?>
                        <?= $room_search
                            ->setAttributes(['onFocus' => "jQuery('input[type=radio][name=room][value=room]').prop('checked', 'checked')"])
                            ->setMinLength(2)
                            ->render() ?>
                    <? else: ?>
                        <? $selected_room_id = $date->room_booking->resource_id ?? ''; ?>
                        <select name="room_id" onFocus="jQuery('input[type=radio][name=room][value=room]').prop('checked', 'checked')">
                            <? foreach ($selectable_rooms as $room): ?>
                                <option value="<?= htmlReady($room->id) ?>"
                                    <?= $selected_room_id == $room->id
                                      ? 'selected="selected"'
                                      : '' ?>>
                                    <?= htmlReady($room->name) ?>
                                    <? if ($room->seats > 1) : ?>
                                        <?= sprintf(_('(%d Sitzplätze)'), $room->seats) ?>
                                    <? endif ?>
                                </option>
                            <? endforeach ?>
                        </select>
                    <? endif ?>
                    <? if (!$only_bookable_rooms) : ?>
                        <a href="<?= $controller->url_for(
                                 'course/timesrooms/editDate/' . $date->termin_id,
                                 ['only_bookable_rooms' => '1']
                                 ) ?>" <?= Request::isDialog() ? 'data-dialog="size=normal"' : '' ?>
                           title="<?= _('Nur buchbare Räume anzeigen') ?>">
                            <?= Icon::create('room-request')->asSvg([
                                'class' => 'text-bottom',
                                'style' => 'margin-left: 0.2em; margin-top: 0.6em;',
                            ]) ?>
                        </a>
                    <? endif ?>
                </span>
            </label>
            <section class="indented">
                <label class="col-2">
                    <?= _('Rüstzeit vor dem Termin (in Minuten)') ?>
                    <input type="number" name="preparation_time"
                           class="preparation-time"
                           value="<?= htmlReady($preparation_time) ?>"
                           min="0" max="<?= htmlReady($max_preparation_time) ?>">
                </label>
                <label class="col-2">
                    <?= _('Rüstzeit nach dem Termin (in Minuten)') ?>
                    <input type="number" name="subsequent_time"
                           class="preparation-time"
                           value="<?= htmlReady($subsequent_time) ?>"
                           min="0" max="<?= htmlReady($max_preparation_time) ?>">
                </label>
            </section>
        <? endif ?>
        <label class="horizontal">
            <input type="radio" name="room" value="freetext" <?= $date->raum ? 'checked' : '' ?>
                   data-deactivates="input.preparation-time[name='preparation_time'],input.preparation-time[name='subsequent_time']">
            <?= _('Freie Ortsangabe (keine Raumbuchung)') ?>
            <input type="text"
                   name="freeRoomText_sd"
                   placeholder="<?= _('Freie Ortsangabe (keine Raumbuchung)') ?>"
                   value="<?= $date->raum ? htmlReady($date->raum) : '' ?>">
        </label>

        <label>
            <input type="radio" name="room" value="noroom"
                   <?= (!empty($date->room_booking->resource_id) || !empty($date->raum) ? '' : 'checked') ?>
                   data-deactivates="input.preparation-time[name='preparation_time'],input.preparation-time[name='subsequent_time']">
            <span style="display: inline-block;"><?= _('Kein Raum') ?></span>
        </label>
        <label>
            <input type="radio" name="room" value="nochange" checked="checked"
                   data-deactivates="input.preparation-time[name='preparation_time'],input.preparation-time[name='subsequent_time']">
            <?= _('Keine Änderungen an den Raumangaben vornehmen') ?>
            <? if ($date->room_booking) :?>
                <?=sprintf(_('(gebucht: %s)'), htmlReady($date->room_booking->room_name))?>
            <? endif ?>
        </label>

    </fieldset>

<? if (count($teachers) > 1): ?>
    <fieldset class="collapsed">
        <legend><?= _('Durchführende Lehrende') ?></legend>

        <div class="studip-selection" data-attribute-name="assigned_teachers">
            <section class="studip-selection-selected">
                <p><strong><?= _('Zugewiesene Lehrende') ?></strong></p>
                <ul>
                <? foreach ($assigned_teachers as $teacher): ?>
                    <li data-selection-id="<?= htmlReady($teacher->user_id) ?>">
                        <input type="hidden" name="assigned_teachers[]"
                               value="<?= htmlReady($teacher->user_id) ?>">

                        <span class="studip-selection-image">
                            <?= Avatar::getAvatar($teacher->user_id)->getImageTag(Avatar::SMALL) ?>
                        </span>
                        <span class="studip-selection-label">
                            <?= htmlReady($teacher->getFullName()) ?>
                        </span>
                    </li>
                <? endforeach ?>
                    <li class="empty-placeholder">
                        <?= _('Kein spezieller Lehrender zugewiesen') ?>
                    </li>
                </ul>
            </section>

            <section class="studip-selection-selectable">
                <p><strong><?= _('Lehrende der Veranstaltung') ?></strong></p>
                <ul>
                <? foreach ($teachers as $teacher): ?>
                    <? if (!$assigned_teachers->find($teacher->user_id)): ?>
                        <li data-selection-id="<?= htmlReady($teacher->user_id) ?>" >
                            <span class="studip-selection-image">
                                <?= Avatar::getAvatar($teacher->user_id)->getImageTag(Avatar::SMALL) ?>
                            </span>
                            <span class="studip-selection-label">
                                <?= htmlReady($teacher->getUserFullname()) ?>
                            </span>
                        </li>
                    <? endif ?>
                <? endforeach ?>
                    <li class="empty-placeholder">
                        <?= sprintf(
                                _('Ihre Auswahl entspricht dem Zustand "%s" und wird beim Speichern zurückgesetzt'),
                                _('Kein spezieller Lehrender zugewiesen')
                        ) ?>
                    </li>
                </ul>
            </section>
        </div>
    </fieldset>
<? endif ?>

<? if (count($groups) > 0): ?>
    <fieldset class="collapsed">
        <legend><?= _('Beteiligte Gruppen') ?></legend>

        <div class="studip-selection" data-attribute-name="assigned-groups">
            <section class="studip-selection-selected">
                <p><strong><?= _('Zugewiesene Gruppen') ?></strong></p>
                <ul>
                    <? foreach ($assigned_groups as $group) : ?>
                        <li data-selection-id="<?= htmlReady($group->id) ?>">
                            <input type="hidden" name="assigned-groups[]"
                                   value="<?= htmlReady($group->id) ?>">

                            <span class="studip-selection-label">
                                <?= htmlReady($group->name) ?>
                            </span>
                        </li>
                    <? endforeach ?>
                    <li class="empty-placeholder">
                        <?= _('Keine spezielle Gruppe zugewiesen') ?>
                    </li>
                </ul>
            </section>

            <section class="studip-selection-selectable">
                <p><strong><?= _('Gruppen der Veranstaltung') ?></strong></p>
                <ul>
                    <? foreach ($groups as $group): ?>
                        <? if (!$assigned_groups->find($group->id)): ?>
                            <li data-selection-id="<?= htmlReady($group->id) ?>" >
                                <span class="studip-selection-label">
                                    <?= htmlReady($group->name) ?>
                                </span>
                            </li>
                        <? endif ?>
                    <? endforeach ?>
                    <li class="empty-placeholder">
                        <?= _('Alle Gruppen wurden dem Termin zugewiesen') ?>
                    </li>
                </ul>
            </section>
        </div>
    </fieldset>
<? endif ?>
<? if (Config::get()->ENABLE_NUMBER_OF_PARTICIPANTS) : ?>
    <fieldset>
        <legend><?= _('Teilnehmende') ?></legend>
        <label>
            <?=_('Anzahl der Teilnehmenden')?>
            <input type="number" min="0" name="number_of_participants" value="<?= htmlReady($date->number_of_participants) ?>">
        </label>
    </fieldset>
<? endif ?>

    <footer data-dialog-button>
        <?= Studip\Button::createAccept(_('Speichern'), 'save_dates') ?>
        <? if (Request::int('fromDialog')) : ?>
            <?= Studip\LinkButton::create(
                _('Zurück zur Übersicht'),
                $controller->url_for(
                    'course/timesrooms',
                    ['fromDialog' => 1, 'contentbox_open' => $date->metadate_id]
                ),
              ['data-dialog' => 'size=big']) ?>
        <? endif ?>
    </footer>
</form>