aboutsummaryrefslogtreecommitdiff
path: root/app/views/admin/configuration/edit_configuration.php
blob: aa4c574a6aa05e9dc3df9400ec47b8073cb9bb01 (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
<?php
/**
 * @var Admin_ConfigurationController $controller
 * @var array $config
 * @var array $allconfigs
 */
?>
<form action="<?= $controller->link_for('admin/configuration/edit_configuration', ['field' => $config['field']]) ?>"
      method="post" data-dialog="size=auto" class="default">
    <?= CSRFProtection::tokenTag() ?>

    <fieldset>
        <legend>
            <?= _('Konfigurationsparameter editieren') ?>
        </legend>

        <? if ($config['description']): ?>
            <p><?= htmlReady($config['description']) ?></p>
        <? endif ?>

        <?= $this->render_partial('admin/configuration/type-edit.php', $config) ?>

        <label for="comment">
            <?= _('Kommentar') ?>
            <textarea cols="80" rows="2" name="comment" id="comment"><?= htmlReady($config['comment']) ?></textarea>
        </label>
        <label>
            <?= _('Standard') ?>

            <? if ($config['is_default'] === '1'): ?>
                <?= Icon::create('checkbox-checked', Icon::ROLE_INFO)->asImg(['title' => _('Ja')]) ?>
            <? elseif ($config['is_default'] === '0'): ?>
                <?= Icon::create('checkbox-unchecked', Icon::ROLE_INFO)->asImg(['title' => _('Nein')]) ?>
            <? elseif ($config['is_default'] === null): ?>
                <em>- <?= _('kein Eintrag vorhanden') ?> -</em>
            <? endif ?>
        </label>
        <div>
            <label class="col-3">
                <?= _('Typ') ?>
                <input name="type" type="text" readonly value="<?= htmlReady($config['type']) ?>">
            </label>
            <label class="col-3">
                <?= _('Bereich') ?>
                <input type="text" name="range" readonly value="<?= htmlReady($config['range']) ?>">
            </label>
        </div>
        <div>
            <label class="col-3">
                <?= _('Kategorie') ?>
                <select name="section" onchange="jQuery(this).next('input').val( jQuery(this).val() );">
                    <? foreach (array_keys($allconfigs) as $section): ?>
                        <option <? if ($config['section'] === $section) echo 'selected'; ?>>
                            <?= htmlReady($section) ?>
                        </option>
                    <? endforeach; ?>
                </select>
            </label>
            <label class="col-3">
                (<em><?= _('Bitte die neue Kategorie eingeben') ?></em>)
                <input type="text" name="section_new" id="section">
            </label>
        </div>
    </fieldset>
    <footer data-dialog-button>
        <?= Studip\Button::createAccept(_('Übernehmen')) ?>
        <?= Studip\LinkButton::createCancel(
            _('Abbrechen'),
            $controller->url_for("admin/configuration/configuration/{$config['section']}")
        ) ?>
    </footer>
</form>