aboutsummaryrefslogtreecommitdiff
path: root/app/views/calendar/date/_add_edit_form.php
blob: 74dc955382cc710a16845d49defb80189f82d0d9 (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
<?php
/**
 * @var Calendar_DateController $controller
 * @var string $form_post_link
 * @var string|null $user_id
 * @var string|null $group_id
 * @var array $form_errors
 * @var CalendarDate $date
 * @var bool $all_day_event
 * @var array<int, string> $category_options
 * @var string[] $exceptions
 * @var string $user_quick_search_type
 * @var array $calendar_assignment_items
 * @var string $owner_id
 */
?>
<form class="default new-calendar-date-form" method="post" action="<?= $form_post_link ?>"
      data-dialog="reload-on-close">
    <?= CSRFProtection::tokenTag() ?>

    <? if ($return_path = Request::get('return_path')) : ?>
        <input type="hidden" name="return_path" value="<?= htmlReady($return_path) ?>">
    <? endif ?>

    <? if ($user_id) : ?>
        <input type="hidden" name="user_id" value="<?= htmlReady($user_id) ?>">
    <? endif ?>
    <? if ($group_id) : ?>
        <input type="hidden" name="group_id" value="<?= htmlReady($group_id) ?>">
    <? endif ?>

    <article aria-live="assertive"
             class="validation_notes studip">
        <header>
            <h1>
                <?= Icon::create('info-circle', Icon::ROLE_INFO)->asImg(['class' => 'text-bottom validation_notes_icon']) ?>
                <?= _('Hinweise zum Ausfüllen des Formulars') ?>
            </h1>
        </header>
        <div class="required_note">
            <div aria-hidden="true">
                <?= _('Pflichtfelder sind mit Sternchen gekennzeichnet.') ?>
            </div>
            <div class="sr-only">
                <?= _('Dieses Formular enthält Pflichtfelder.') ?>
            </div>
        </div>
        <? if ($form_errors) : ?>
            <div>
                <?= _('Folgende Angaben müssen korrigiert werden, um das Formular abschicken zu können:') ?>
                <ul>
                    <? foreach ($form_errors as $field => $error) : ?>
                        <li><?= htmlReady($field) ?>: <?= htmlReady($error) ?></li>
                    <? endforeach ?>
                </ul>
            </div>
        <? endif ?>
    </article>

    <fieldset>
        <legend><?= _('Grunddaten') ?></legend>
        <label class="studiprequired">
            <?= _('Titel') ?>
            <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
            <input type="text" name="title" required="required"
                   value="<?= htmlReady($date->title) ?>">
        </label>
        <div class="hgroup">
            <label class="studiprequired">
                <?= _('Beginn') ?>
                <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
                <input type="text" name="begin_str" class="begin-input" data-datetime-picker
                       required="required" value="<?= date('d.m.Y H:i', $date->begin) ?>">
            </label>
            <label class="studiprequired">
                <?= _('Ende') ?>
                <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
                <input type="text" name="end_str" class="end-input" data-datetime-picker
                       required="required" value="<?= date('d.m.Y H:i', $date->end) ?>">
            </label>
        </div>
        <label>
            <input type="checkbox" name="all_day" value="1" <?= $all_day_event ? 'checked' : '' ?>>
            <?= _('Ganztägiger Termin') ?>
        </label>
        <label>
            <?= _('Zugriff') ?>
            <?= tooltipIcon(
                _('Öffentliche Termine sind systemweit sichtbar. Private Termine sind für Personen, denen der Kalender freigegeben wurde, sichtbar. Vertrauliche Termine sind hingegen nur für Sie selbst sichtbar.')
            ) ?>
            <div class="flex-row">
                <select name="access">
                    <option value="PUBLIC" <?= $date->access === 'PUBLIC' ? 'selected' : '' ?>>
                        <?= _('Öffentlich zugänglich') ?>
                    </option>
                    <option value="PRIVATE" <?= $date->access === 'PRIVATE' ? 'selected' : '' ?>>
                        <?= _('Privat') ?>
                    </option>
                    <option value="CONFIDENTIAL" <?= $date->access === 'CONFIDENTIAL' ? 'selected' : '' ?>>
                        <?= _('Vertraulich') ?>
                    </option>
                </select>
            </div>
        </label>
        <label>
            <?= _('Beschreibung') ?>
            <textarea name="description"><?= htmlReady($date->description) ?></textarea>
        </label>
        <label class="studiprequired">
            <?= _('Kategorie') ?>
            <span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
            <select class="" name="category" required>
                <? foreach ($category_options as $key => $option) : ?>
                    <option value="<?= htmlReady($key) ?>" <?= $key === intval($date->category) ? 'selected' : '' ?>>
                        <?= htmlReady($option) ?>
                    </option>
                <? endforeach ?>
            </select>
        </label>
        <label>
            <?= _('Eigene Kategorie') ?>
            <input type="text" name="user_category" value="<?= htmlReady($date->user_category) ?>">
        </label>
        <label>
            <?= _('Ort') ?>
            <input type="text" name="location" value="<?= htmlReady($date->location) ?>">
        </label>
    </fieldset>
    <fieldset class="simplevue">
        <legend><?= _('Wiederholung') ?></legend>
        <?= $date->getRepetitionInputHtml('repetition') ?>
    </fieldset>
    <fieldset class="simplevue">
        <legend><?= _('Ausnahmen') ?></legend>
        <date-list-input name="exceptions" :selected_dates="<?= htmlReady(json_encode($exceptions)) ?>"></date-list-input>
    </fieldset>
    <? if (Config::get()->CALENDAR_GROUP_ENABLE && isset($user_quick_search_type)) : ?>
        <fieldset class="simplevue">
            <legend><?= _('Teilnehmende Personen') ?></legend>
            <editable-list
                name="assigned_calendar_ids"
                quicksearch="<?= htmlReady($user_quick_search_type) ?>"
                :items="<?= htmlReady(json_encode($calendar_assignment_items)) ?>"
            ></editable-list>
        </fieldset>
    <? elseif ($calendar_assignment_items) : ?>
       <? foreach ($calendar_assignment_items as $item) : ?>
            <input type="hidden" name="assigned_calendar_ids[]" value="<?= htmlReady($item['value']) ?>">
       <? endforeach ?>
    <? elseif ($owner_id): ?>
        <input type="hidden" name="assigned_calendar_ids[]" value="<?= htmlReady($owner_id) ?>">
    <? endif ?>

    <footer data-dialog-button>
        <? if ($date->isNew()) : ?>
            <?= \Studip\Button::create(_('Anlegen'), 'save') ?>
        <? else : ?>
            <?= \Studip\Button::create(_('Speichern'), 'save') ?>
        <? endif ?>
        <? if (!$date->isNew()) : ?>
            <?= \Studip\LinkButton::create(
                _('Löschen'),
                $controller->url_for('calendar/date/delete/' . $date->id),
                ['data-dialog' => 'reload-on-close']
            ) ?>
        <? endif ?>
        <?= \Studip\LinkButton::createCancel(_('Abbrechen'), $controller->url_for('calendar/calendar')) ?>
    </footer>
</form>