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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
<?php
# Lifter010: TODO
/**
* @var Admin_RoleController $controller
* @var string $username
* @var User $currentuser
* @var User[] $users
* @var Role[] $assignedroles
* @var Role[] $roles
* @var Role[] $all_userroles
* @var array $assignedroles_institutes
*/
use Studip\Button, Studip\LinkButton;
?>
<form action="<?= $controller->url_for('admin/role/assign_role') ?>" class="default" method="POST">
<?= CSRFProtection::tokenTag() ?>
<fieldset>
<legend>
<?= _('Rollen für Benutzer verwalten') ?>
</legend>
<? if (empty($users)): ?>
<label>
<?= _('Benutzer') ?>
<input type="text" name="username" value="<?= htmlReady($username) ?>" placeholder="<?= _('Name der Person') ?>">
</label>
</fieldset>
<footer>
<?= Button::create(_('Suchen'), 'search', ['title' => _('Benutzer suchen')])?>
</footer>
<? else: ?>
<label>
<?= _('Benutzer') ?>
<select name="usersel" style="min-width: 300px;">
<? foreach ($users as $user): ?>
<option value="<?= $user->id ?>" <? if ($currentuser && $currentuser->id === $user->id) echo 'selected'; ?>>
<?= htmlReady(sprintf('%s (%s)', $user->getFullName(), $user->username)) ?>
</option>
<? endforeach ?>
</select>
</label>
</fieldset>
<footer>
<?= Button::create(_('Auswählen'), 'select', ['title' => _('Benutzer auswählen')])?>
<?= LinkButton::create(_('Zurücksetzen'), $controller->url_for('admin/role/assign_role'), ['title' => _('Suche zurücksetzen')])?>
</footer>
<? endif ?>
</form>
<? if (isset($currentuser)): ?>
<br>
<form action="<?= $controller->url_for('admin/role/save_role', $currentuser->id) ?>" method="POST">
<?= CSRFProtection::tokenTag() ?>
<input type="hidden" name="studip_ticket" value="<?= get_ticket() ?>">
<table class="default nohover">
<tr>
<th style="text-align: center;">
<? printf(_('Rollen für %s'), htmlReady($currentuser->vorname . ' ' . $currentuser->nachname)) ?>
</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 ($assignedroles 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 Benutzer zuweisen')])->asInput(["type" => "image", "class" => "middle", "name" => "assign_role"]) ?>
<br>
<br>
<?= Icon::create('arr_2right', 'sort', ['title' => _('Markierte Rollen entfernen')])->asInput(["type" => "image", "class" => "middle", "name" => "remove_role"]) ?>
</td>
<td>
<select size="10" name="rolesel[]" multiple 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>
<h3>
<?= _('Einrichtungszuordnungen') ?>
</h3>
<table class="default">
<colgroup>
<col width="50%">
<col>
<col width="24px">
</colgroup>
<thead>
<tr>
<th><?= _('Rolle')?> </th>
<th><?= _('Einrichtungen')?> </th>
<th class="actions"><?= _('Aktionen')?> </th>
</tr>
</thead>
<tbody>
<? foreach ($assignedroles as $assignedrole): ?>
<? if (!$assignedrole->getSystemtype()): ?>
<tr>
<td>
<?= htmlReady($assignedrole->getRolename()) ?>
</td>
<td>
<?= htmlReady(implode(",\n", $assignedroles_institutes[$assignedrole->getRoleid()]))?>
</td>
<td class="actions">
<a href="<?= $controller->action_link('assign_role_institutes/' . $assignedrole->getRoleid() . '/' . $currentuser->id) ?>" data-dialog="size=auto;reload-on-close">
<?= Icon::create('edit')->asSvg(['title' => _('Einrichtungszuordnung bearbeiten')]) ?>
</a>
</td>
</tr>
<? endif; ?>
<? endforeach; ?>
</tbody>
</table>
<h3>
<?= _('Implizit zugewiesene Systemrollen') ?>
</h3>
<? foreach ($all_userroles as $role): ?>
<? if (!in_array($role, $assignedroles)): ?>
<?= htmlReady($role->getRolename()) ?><br>
<? endif ?>
<? endforeach ?>
<? endif ?>
|