aboutsummaryrefslogtreecommitdiff
path: root/app/views/admin/lockrules/_form.php
blob: c4ef11143bd7f87d4fb339d6449964e4d5dd1392 (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
<?php
# Lifter010:

/**
 * @var string $action
 * @var string $lock_rule_type
 * @var LockRule $lock_rule
 * @var array $rule_type_names
 * @var array $lock_rule_permissions
 * @var array $lock_config
 */
use Studip\Button;

?>
<form action="<?= $action ?>" method="post" class="default">
    <?= CSRFProtection::tokenTag(); ?>
    <fieldset>
        <legend>
            <? if ($lock_rule->name) : ?>
                <?= sprintf(_('Sperrebene "%s" ändern'), htmlready($lock_rule["name"])) ?>
            <? else : ?>
                <?= _('Neue Sperrebene eingeben für den Bereich:') ?> <?= $rule_type_names[$lock_rule_type]; ?>
            <? endif ?>
        </legend>

        <label>
            <?= _("Name") ?>

            <input type="text" style="width:90%" required name="lockdata_name"
                   value="<?= htmlReady($lock_rule['name']) ?>">
       </label>

       <label>
            <?= _('Beschreibung') ?>
            <?= tooltipIcon(_('Dieser Text wird auf allen Seiten mit gesperrtem Inhalt angezeigt')) ?>

            <textarea name="lockdata_description" rows="5"
                      style="width:90%"><?= htmlReady($lock_rule["description"]) ?></textarea>
      </label>

      <label>
            <?= _('Nutzerstatus') ?>
            <?= tooltipIcon(_('Die Einstellungen dieser Sperrebene gelten für Nutzer bis zu dieser Berechtigung')) ?>

            <select name="lockdata_permission">
                <? foreach ($lock_rule_permissions as $p) : ?>
                    <option <?= ($lock_rule['permission'] == $p ? 'selected' : '') ?>><?= $p ?></option>
                <? endforeach; ?>
            </select>
        </label>
    </fieldset>

    <footer>
        <?= Button::create(_('Übernehmen'), 'ok', ['title' => _('Einstellungen übernehmen')]) ?>
    </footer>


    <? foreach ($lock_config['groups'] as $group => $group_title) : ?>
        <? $attributes = array_filter(array_map(function ($a) use ($group) {
            return $a['group'] == $group ? $a['name'] : null;
        }, $lock_config['attributes'])); ?>
        <? if (count($attributes)) : ?>
            <br>
            <table class="default">
                <caption>
                    <?= htmlready($group_title) ?>
                </caption>
                <colgroup>
                    <col style="width: 70%">
                    <col style="width: 15%">
                    <col style="width: 15%">
                </colgroup>
                <thead>
                <tr>
                    <th></th>
                    <th><?= _('gesperrt') ?></th>
                    <th><?= _('nicht gesperrt') ?></th>
                </tr>
                </thead>
                <tbody>
                <? foreach ($attributes as $attr => $attr_name) : ?>
                    <tr>
                        <td>
                            <?= htmlready($attr_name) ?>
                        </td>
                        <td>
                            <input type="radio"
                                   name="lockdata_attributes[<?= $attr ?>]" <?= ($lock_rule['attributes'][$attr] ? 'checked' : '') ?>
                                   value="1"/>
                        </td>
                        <td>
                            <input type="radio"
                                   name="lockdata_attributes[<?= $attr ?>]" <?= (!$lock_rule['attributes'][$attr] ? 'checked' : '') ?>
                                   value="0"/>
                        </td>
                    </tr>
                <? endforeach ?>
                </tbody>
            </table>

        <footer>
            <?= Button::create(_('Übernehmen'), 'ok', ['title' => _('Einstellungen übernehmen')]) ?>
        </footer>
        <? endif ?>

    <? endforeach ?>
</form>