aboutsummaryrefslogtreecommitdiff
path: root/app/views/consultation/admin/create.php
blob: 6511d79105250eae0f1763ba7a48535b7a2c072f (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
<?php
$days_of_the_week = [
    _('Montag')     => 1,
    _('Dienstag')   => 2,
    _('Mittwoch')   => 3,
    _('Donnerstag') => 4,
    _('Freitag')    => 5,
    _('Samstag')    => 6,
    _('Sonntag')    => 0
];
$intervals = [
    _('wöchentlich')     => 1,
    _('zweiwöchentlich') => 2,
    _('dreiwöchentlich') => 3,
    _('monatlich')       => 4,
];
?>

<form action="<?= $controller->store() ?>" method="post" class="default" data-dialog>
    <?= CSRFProtection::tokenTag() ?>

<? if ($flash['confirm-many']): ?>
    <?= MessageBox::info(
        _('Sie erstellen eine sehr große Anzahl an Terminen.') . ' ' .
        _('Bitte bestätigen Sie diese Aktion.'),
        [
            '<label><input type="checkbox" name="confirmed" value="1">' .
            sprintf(
                _('Ja, ich möchte wirklich %s Termine erstellen.'),
                number_format($flash['confirm-many'], 0, ',', '.')
            ) .
            '</label>'
        ]
    )->hideClose() ?>
<? endif; ?>

    <fieldset>
        <legend>
            <?= _('Ort und Zeit') ?>
        </legend>

        <label>
            <span class="required"><?= _('Ort') ?></span>

            <input required type="text" name="room"
                   value="<?= htmlReady(Request::get('room', $room)) ?>"
                   placeholder="<?= _('Ort') ?>">
        </label>

        <label class="col-3">
            <span class="required"><?= _('Beginn') ?></span>

            <input required type="text" name="start-date" id="start-date"
                   value="<?= htmlReady(Request::get('start-date', strftime('%d.%m.%Y', strtotime('+7 days'))))  ?>"
                   placeholder="<?= _('tt.mm.jjjj') ?>"
                   data-date-picker='{">=":"today"}'>
        </label>

        <label class="col-3">
            <span class="required"><?= _('Ende') ?></span>

            <input required type="text" name="end-date" id="end-date"
                   value="<?= htmlReady(Request::get('end-date', strftime('%d.%m.%Y', strtotime('+4 weeks'))))  ?>"
                   placeholder="<?= _('tt.mm.jjjj') ?>"
                   data-date-picker='{">=":"#start-date"}'>
        </label>

        <label class="col-3">
            <span class="required"><?= _('Am Wochentag') ?></span>

            <select required name="day-of-week">
            <? foreach ($days_of_the_week as $day => $value): ?>
                <option value="<?= $value ?>" <? if (Request::get('day-of-week', strftime('%w')) == $value) echo 'selected'; ?>>
                    <?= htmlReady($day) ?>
                </option>
            <? endforeach; ?>
            </select>
        </label>

        <label class="col-3">
            <span class="required"><?= _('Intervall') ?></span>
            <select required name="interval">
            <? foreach ($intervals as $interval => $value): ?>
                <option value="<?= $value ?>" <? if (Request::int('interval') == $value) echo 'selected'; ?>>
                    <?= htmlReady($interval) ?>
                </option>
            <? endforeach; ?>
            </select>
        </label>

        <label for="start-time" class="col-3">
            <span class="required"><?= _('Von') ?></span>

            <input required type="text" name="start-time" id="start-time"
                   value="<?= htmlReady(Request::get('start-time', '08:00')) ?>"
                   placeholder="<?= _('HH:mm') ?>"
                   data-time-picker='{"<":"#end-time"}'>
        </label>

        <label for="ende_hour" class="col-3">
            <span class="required"><?= _('Bis') ?></span>

            <input required type="text" name="end-time" id="end-time"
                   value="<?= htmlReady(Request::get('end-time', '09:00')) ?>"
                   placeholder="<?= _('HH:mm') ?>"
                   data-time-picker='{">":"#start-time"}'>
        </label>

        <label class="col-3">
            <span class="required"><?= _('Dauer eines Termins in Minuten') ?></span>
            <input required type="text" name="duration"
                   value="<?= htmlReady(Request::int('duration', 15)) ?>"
                   maxlength="3" pattern="^\d+$">
        </label>

        <label class="col-3">
            <?= _('Maximale Teilnehmerzahl') ?>
            <?= tooltipIcon(_('Falls Sie mehrere Personen zulassen wollen (wie z.B. zu einer Klausureinsicht), so geben Sie hier die maximale Anzahl an Personen an, die sich anmelden dürfen.')) ?>
            <input required type="text" name="size" id="size"
                   min="1" max="50" value="<?= Request::int('size', 1) ?>">
        </label>
    </fieldset>

<? if ($responsible): ?>
    <fieldset>
        <legend><?= _('Durchführende Personen, Gruppen oder Einrichtungen') ?></legend>

        <?= $this->render_partial('consultation/admin/block-responsibilities.php', compact('responsible')) ?>
    </fieldset>
<? endif; ?>

    <fieldset>
        <legend><?= _('Weitere Einstellungen') ?></legend>

        <label>
            <?= _('Information zu den Terminen in diesem Block') ?>
            <textarea name="note"><?= htmlReady(Request::get('note')) ?></textarea>
        </label>

        <label>
            <input type="checkbox" name="calender-events" value="1"
                    <? if (Request::bool('calender-events')) echo 'checked'; ?>>
            <?= _('Die freien Termine auch im Kalender markieren') ?>
        </label>

        <label>
            <input type="checkbox" name="show-participants" value="1"
                    <? if (Request::bool('show-participants')) echo 'checked'; ?>>
            <?= _('Namen der buchenden Personen sind öffentlich sichtbar') ?>
        </label>

        <label>
            <?= _('Grund der Buchung abfragen') ?>
        </label>
        <div class="hgroup">
            <label>
                <input type="radio" name="require-reason" value="yes"
                       <? if (Request::get('require-reason') === 'yes') echo 'checked'; ?>>
                <?= _('Ja, zwingend erforderlich') ?>
            </label>

            <label>
                <input type="radio" name="require-reason" value="optional"
                       <? if (Request::get('require-reason', 'optional') === 'optional') echo 'checked'; ?>>
                <?= _('Ja, optional') ?>
            </label>

            <label>
                <input type="radio" name="require-reason" value="no"
                       <? if (Request::get('require-reason') === 'no') echo 'checked'; ?>>
                <?= _('Nein') ?>
            </label>
        </div>

        <label>
            <?= _('Bestätigung für folgenden Text einholen') ?>
            (<?= _('optional') ?>)
            <?= tooltipIcon(_('Wird hier ein Text eingegeben, so müssen Buchende bestätigen, dass sie diesen Text gelesen haben.')) ?>
            <textarea name="confirmation-text"><?= htmlReady(Request::get('confirmation-text')) ?></textarea>
        </label>
    </fieldset>

    <footer data-dialog-button>
        <?= Studip\Button::createAccept(_('Termin speichern')) ?>
        <?= Studip\LinkButton::createCancel(
            _('Abbrechen'),
            $controller->indexURL()
        ) ?>
    </footer>
</form>