aboutsummaryrefslogtreecommitdiff
path: root/app/views/calendar/schedule/entry.php
blob: fe723c0c874908ae42bd9b29d333bcdb1f8f320e (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
<?php
/**
 * @var AuthenticatedController $controller
 * @var ScheduleEntry $entry The schedule entry to be created/modified.
 */
?>
<form class="default schedule-entry" method="post"
      action="<?= $controller->link_for('calendar/schedule/entry/' . ($entry->isNew() ? 'add' : $entry->id)) ?>"
      data-dialog="reload-on-close">
    <?= CSRFProtection::tokenTag() ?>
    <fieldset>
        <legend><?= _('Farbe') ?></legend>
        <?= Studip\VueApp::create('ColourSelector')
            ->withProps([
                'autofocus' => true,
                'colours' => collect($GLOBALS['PERS_TERMIN_KAT'])->map(
                    fn($data, $id) => ['id' => $id, 'colour' => $data['bgcolor']]
                )->values(),
                'model-value' => $entry->colour_id,
            ]) ?>
    </fieldset>
    <fieldset>
        <legend><?= _('Zeit') ?></legend>
        <section class="hgroup nowrap">
            <label>
                <?= _('Wochentag') ?>
                <select name="dow" class="size-s">
                    <? foreach (range(1, 7) as $dow): ?>
                        <option value="<?= $dow ?>" <?= $entry->dow == $dow ? 'selected' : '' ?>>
                            <?= getWeekday($dow, false) ?>
                        </option>
                    <? endforeach ?>
                </select>
            </label>
            <label>
                <?= _('Anfang') ?>
                <input type="text" class="has-time-picker size-s" name="start"
                       value="<?= htmlReady($entry->getFormattedStart()) ?>">
            </label>
            <label>
                <?= _('Ende') ?>
                <input type="text" class="has-time-picker size-s" name="end"
                       value="<?= htmlReady($entry->getFormattedEnd()) ?>">
            </label>
        </section>
    </fieldset>
    <fieldset>
        <legend><?= _('Inhalt') ?></legend>
        <label>
            <?= _('Titel') ?>
            <input type="text" name="label" value="<?= htmlReady($entry->label) ?>">
        </label>
        <label>
            <?= _('Beschreibung') ?>
            <textarea name="content"><?= htmlReady($entry->content) ?></textarea>
        </label>
    </fieldset>
    <div data-dialog-button>
        <?= \Studip\Button::createAccept(
            _('Speichern'),
            'save',
            ['formaction' => $controller->url_for('calendar/schedule/save_entry/' . ($entry->isNew() ? 'add' : $entry->id))]
        ) ?>
        <? if (!$entry->isNew()) : ?>
            <?= \Studip\Button::create(
                _('Löschen'),
                'delete',
                ['formaction' => $controller->url_for('calendar/schedule/delete_entry/' . $entry->id)]
            ) ?>
        <? endif ?>
        <?= \Studip\Button::createCancel(_('Abbrechen')) ?>
    </div>
</form>