aboutsummaryrefslogtreecommitdiff
path: root/app/views/settings/categories.php
blob: 14afb8aca86932f90f16d9b5afdde3c14c10b227 (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
<? use Studip\Button, Studip\LinkButton; ?>

<? if (count($categories) === 0): ?>
<p class="info"><?= _('Es existieren zur Zeit keine eigenen Kategorien.') ?></p>
<? else: ?>
<form action="<?= $controller->url_for('settings/categories/store') ?>" method="post" name="main_content" class="default">
    <?= CSRFProtection::tokenTag() ?>
    <input type="hidden" name="studip_ticket" value="<?= get_ticket() ?>">

    <? foreach ($categories as $index => $category): ?>
        <input type="hidden" name="ids[]" value="<?= htmlReady($category->id) ?>">

        <fieldset>
            <legend style="display: flex; flex-wrap: nowrap; justify-content: space-between">
                <span><?= htmlReady($category->name) ?></span>
                <span>
                <? if ($index > 0): ?>
                    <a href="<?= $controller->url_for('settings/categories/swap', $category->id, $last->id) ?>">
                        <?= Icon::create('arr_2up', Icon::ROLE_SORT)->asImg(['class' => 'text-bottom', 'title' =>_('Kategorie nach oben verschieben')]) ?>
                    </a>
                <? else: ?>
                    <?= Icon::create('arr_2up', Icon::ROLE_INACTIVE)->asImg(['class' => 'text-bottom']) ?>
                <? endif; ?>

                <? if ($index < $count - 1): ?>
                    <a href="<?= $controller->url_for('settings/categories/swap', $category->id, $categories[$index + 1]->id) ?>">
                                <?= Icon::create('arr_2down', Icon::ROLE_SORT)->asImg(['class' => 'text-bottom', 'title' =>_('Kategorie nach unten verschieben')]) ?>
                            </a>
                <? else: ?>
                    <?= Icon::create('arr_2down', Icon::ROLE_INACTIVE)->asImg(['class' => 'text-bottom']) ?>
                <? endif; ?>

                    <a href="<?= $controller->url_for('settings/categories/delete', $category->id) ?>">
                        <?= Icon::create('trash')->asImg(['class' => 'text-bottom', 'title' => _('Kategorie löschen')]) ?>
                    </a>
                </span>
            </legend>

            <p>
                (<?= $visibilities[$category->id] ?>)
            </p>

            <label>
                <?= _('Name') ?>
                <?= I18N::input("category-name-{$category->id}", $category->name, [
                    'aria-label' => _('Name der Kategorie'),
                    'class'      => 'size-l',
                    'id'         => "name{$index}",
                    'required'   => '',
                ]) ?>
            </label>

            <label>
                <?= _('Inhalt') ?>

                <?= I18N::textarea("category-content-{$category->id}", $category->content, [
                    'aria-label' => _('Inhalt der Kategorie:'),
                    'class'      => 'resizable wysiwyg size-l',
                    'id'         => "content{$index}",
                ]) ?>
            </label>
        </fieldset>
    <? $last = $category;
       endforeach; ?>

    <? if ($hidden_count > 0): ?>
            <?= sprintf(ngettext('Es existiert zusätzlich eine Kategorie, die Sie nicht einsehen und bearbeiten können.',
                                 'Es existiereren zusätzlich %s Kategorien, die Sie nicht einsehen und bearbeiten können.',
                                 $hidden_count), $hidden_count) ?>
    <? endif; ?>

    <footer>
            <?= Button::create(_('Übernehmen'), 'store') ?>
    </footer>
</form>
<? endif; ?>