aboutsummaryrefslogtreecommitdiff
path: root/app/views/course/dates/details-edit.php
blob: a2351ed60d82c119f943ee89b57b3c7e033eb7ed (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
<form name="edit_termin" action='<?= $controller->url_for('course/dates/save_details/' . $date->id) ?>' method="post" class="default" data-termin-id="<?= htmlReady($date->id) ?>"
      data-course-id="<?= htmlReady(Context::getID()) ?>">
    <?= CSRFProtection::tokenTag() ?>

    <fieldset>
        <legend><?= _('Termin bearbeiten') ?></legend>

        <label>
            <?= _('Art des Termins') ?>
            <select name="dateType" <?=$metadata_locked ? 'disabled' : ''?>>>
            <? foreach ($GLOBALS['TERMIN_TYP'] as $key => $val): ?>
                <option value="<?= htmlReady($key) ?>" <? if ($date->date_typ == $key) echo 'selected'; ?>>
                    <?= htmlReady($val['name']) ?>
                </option>
            <? endforeach; ?>
            </select>
        </label>

        <label for="new_topic">
            <?= _('Themen') ?>
        </label>

        <ul class="themen-list">
            <li class="list-placeholder"><?= _('Keine Themen zugeordnet') ?></li>
        <? foreach ($date->topics as $topic) : ?>
            <?= $this->render_partial('course/dates/_topic_li', compact('topic')) ?>
        <? endforeach ?>
        </ul>

        <section class="hgroup">
            <input type="text" name="new_topic" id="new_topic"
                   placeholder="<?= _('Thema suchen oder neu anlegen') ?>">

            <?= Studip\Button::create(
                _('Thema hinzufügen'), 'add_topic',
                ['onclick' => 'STUDIP.Dates.addTopic(); return false;']
            ) ?>
        </section>

    </fieldset>

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

        <div class="studip-selection <?= $metadata_locked ? 'disabled' : ''?>" data-attribute-name="assigned_teachers">
            <section class="studip-selection-selected">
                <h2><?= _('Zugewiesene Lehrende') ?></h2>

                <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">
                <h2><?= _('Lehrende der Veranstaltung') ?></h2>

                <ul>
            <? foreach ($teachers as $teacher): ?>
                <? if (!$assigned_teachers->find($teacher->user_id)): ?>
                    <li data-selection-id="<?= htmlReady($teacher->id) ?>" >
                        <span class="studip-selection-image">
                            <?= Avatar::getAvatar($teacher->id)->getImageTag(Avatar::SMALL) ?>
                        </span>
                        <span class="studip-selection-label">
                            <?= htmlReady($teacher->getFullName()) ?>
                        </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 (!empty($date->room_booking->resource)) : ?>
    <? $room = $date->room_booking->resource->getDerivedClassInstance() ?>
    <? if ($room instanceof Resource) : ?>
        <fieldset>
            <legend><?= _('Raum') ?></legend>
            <section>
                <?= htmlReady($room->getFullName()) ?>
            </section>
        </fieldset>
    <? endif ?>
<? endif ?>

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

        <div class="studip-selection <?= $metadata_locked ? 'disabled' : ''?>" data-attribute-name="assigned_groups">
            <section class="studip-selection-selected">
                <h2><?= _('Zugewiesene Gruppen') ?></h2>

                <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">
                <h2><?= _('Gruppen der Veranstaltung') ?></h2>

                <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" name="number_of_participants" value="<?= htmlReady($date->number_of_participants) ?>">
        </label>
    </fieldset>
<? endif ?>

    <footer data-dialog-button>
        <? if (!$metadata_locked): ?>
            <?= Studip\Button::createAccept(_('Speichern')); ?>
        <? endif; ?>
        <? if (!$dates_locked): ?>
            <?= Studip\LinkButton::create(
                _('Termin bearbeiten'),
                $controller->url_for('course/timesrooms', ['raumzeitFilter' => 'all'])
            ) ?>
        <? endif; ?>
        <? if (!$cancelled_dates_locked): ?>
            <?= Studip\LinkButton::create(
                _('Ausfallen lassen'),
                $controller->url_for('course/cancel_dates', ['termin_id' => $date->id]),
                ['data-dialog' => '']
            ) ?>
        <? endif ?>
        <? if (Request::submitted('extra_buttons')) : ?>
            <?= Studip\LinkButton::create(
                _('Zur Veranstaltung'),
                $controller->url_for('course/details', ['cid' => $date->range_id])
            ) ?>
        <? endif ?>
    </footer>
</form>

<script>
jQuery(function ($) {
    $('#new_topic').autocomplete({
        source: <?= json_encode(Course::findCurrent()->topics->pluck('title')) ?>
    });
});
</script>