aboutsummaryrefslogtreecommitdiff
path: root/app/views/settings/categories.php
blob: 663b54f6147feff432b298165a32c5e945e48333 (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
<? 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): ?>
        <fieldset>
            <legend><?= htmlReady($category->name) ?></legend>

            <table style="width: 100%">
                <colgroup>
                    <col>
                    <col width="100px">
                </colgroup>
                <tbody>
                    <tr>
                        <td>
                            <div>
                                (<?= $visibilities[$category->id] ?>)
                            </div>

                            <label>
                                <?= _('Name') ?>
                                <input required type="text" name="categories[<?= $category->id ?>][name]" id="name<?= $index ?>"
                                       aria-label="<?= _('Name der Kategorie') ?>" style="width: 100%"
                                       value="<?= htmlReady($category->name) ?>">
                            </label>

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

                                <textarea id="content<?= $index ?>" name="categories[<?= $category->id ?>][content]"
                                          class="resizable add_toolbar wysiwyg size-l" style="width: 100%; height: 200px;"
                                          aria-label="<?= _('Inhalt der Kategorie:') ?>"
                                ><?= wysiwygReady($category->content) ?></textarea>
                            </label>
                        </td>
                        <td style="vertical-align: top">
                            <? if ($index > 0): ?>
                                <a href="<?= $controller->url_for('settings/categories/swap', $category->id, $last->id) ?>">
                                    <?= Icon::create('arr_2up', 'sort')->asImg(['class' => 'text-top', 'title' =>_('Kategorie nach oben verschieben')]) ?>
                                </a>
                            <? else: ?>
                                <?= Icon::create('arr_2up', 'inactive')->asImg(['class' => 'text-top']) ?>
                            <? endif; ?>

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

                            <a href="<?= $controller->url_for('settings/categories/delete', $category->id) ?>">
                                <?= Icon::create('trash')->asImg(['class' => 'text-top', 'title' => _('Kategorie löschen')]) ?>
                            </a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </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; ?>