aboutsummaryrefslogtreecommitdiff
path: root/app/views/admin/role/assign_plugin_role.php
blob: 28f5561d87ab4b3af013dbf3ba2f00eeb9483983 (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
<?php
# Lifter010: TODO
/**
 * @var Admin_RoleController $controller
 * @var string $pluginid
 * @var array $plugins
 * @var Role[] $roles
 * @var Role[] $assigned
 */
use Studip\Button;
?>

<form action="<?= $controller->url_for('admin/role/assign_plugin_role') ?>" method="POST" class="default">
    <?= CSRFProtection::tokenTag() ?>
    <fieldset>
        <legend>
            <?= _('Rollenverwaltung für Plugins') ?>
        </legend>

        <label>
            <select name="pluginid" style="min-width: 300px;">
                <? foreach ($plugins as $plugin): ?>
                    <option value="<?= $plugin['id'] ?>" <?= $plugin['id'] == $pluginid ? 'selected' : '' ?>>
                        <?= htmlReady($plugin['name']) ?>
                    </option>
                <? endforeach ?>
            </select>
        </label>
    </fieldset>

    <footer>
        <?= Button::create(_('Auswählen'), 'select', ['title' => _('Plugin auswählen')]) ?>
    </footer>
</form>

<? if ($pluginid): ?>
    <br>
    <form action="<?= $controller->url_for('admin/role/save_plugin_role', $pluginid) ?>" method="POST" class="default">
        <?= CSRFProtection::tokenTag() ?>
        <input type="hidden" name="studip_ticket" value="<?= get_ticket() ?>">
        <table class="default nohover">
            <tr>
                <th style="text-align: center;"><?= _('Gegenwärtig zugewiesene Rollen') ?></th>
                <th></th>
                <th><?= _('Verfügbare Rollen') ?></th>
            </tr>
            <tr class="table_row_even">
                <td style="text-align: right;">
                    <select multiple name="assignedroles[]" size="10" style="width: 300px;">
                        <? foreach ($assigned as $assignedrole): ?>
                            <option value="<?= $assignedrole->getRoleid() ?>">
                                <?= htmlReady($assignedrole->getRolename()) ?>
                                <? if ($assignedrole->getSystemtype()): ?>[<?= _('Systemrolle') ?>]<? endif ?>
                            </option>
                        <? endforeach ?>
                    </select>
                </td>
                <td style="text-align: center;">
                    <?= Icon::create('arr_2left', 'sort', ['title' => _('Markierte Rollen dem Plugin zuweisen')])->asInput(["class" => "middle", "name" => "assign_role"]) ?>
                    <br>
                    <br>
                    <?= Icon::create('arr_2right', 'sort', ['title' => _('Markierte Rollen entfernen')])->asInput(["class" => "middle", "name" => "remove_role"]) ?>
                </td>
                <td>
                    <select multiple name="rolesel[]" size="10" style="width: 300px;">
                        <optgroup label="<?= _('Systemrollen') ?>">
                            <? foreach ($roles['system'] as $role): ?>
                                <option value="<?= $role->getRoleid() ?>">
                                    <?= htmlReady($role->getRolename()) ?>
                                </option>
                            <? endforeach ?>
                        </optgroup>
                    <? if (count($roles['other']) > 0): ?>
                        <optgroup label="<?= _('Weitere Rollen') ?>">
                            <? foreach ($roles['other'] as $role): ?>
                                <option value="<?= $role->getRoleid() ?>">
                                    <?= htmlReady($role->getRolename()) ?>
                                </option>
                            <? endforeach ?>
                        </optgroup>
                    <? endif; ?>
                    </select>
                </td>
            </tr>
        </table>
    </form>
<? endif ?>