aboutsummaryrefslogtreecommitdiff
path: root/app/views/admin/user/_results.php
blob: 1541907b58578c8e4664f454ab15612744c55016 (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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<?php
/**
 * @var Admin_UserController $controller
 * @var array $users
 * @var string $sortby
 * @var string $order
 */
?>
<br>

<form action="<?= $controller->link_for('admin/user/bulk') ?>" method="post" data-dialog="size=auto" class="default">
    <?= CSRFProtection::tokenTag() ?>
    <table class="default">
        <caption>
            <?= sprintf(_('Suchergebnis: es wurden %s Personen gefunden'), count($users)) ?>
        </caption>
        <thead>
            <tr class="sortable">
                <th colspan="2" <?= $sortby === 'username' ? 'class="sort' . $order . '"' : '' ?>>
                    <a href="<?= $controller->link_for('admin/user', ['sortby' => 'username', 'order' => $order, 'toggle' => $sortby === 'username']) ?>">
                        <?= _('Benutzername') ?>
                    </a>
                </th>
                <th>&nbsp;</th>
                <th <?= $sortby === 'matriculation_number' ? 'class="sort' . $order . '"' : '' ?>>
                    <a href="<?= $controller->link_for('admin/user', ['sortby' => 'matriculation_number', 'order' => $order, 'toggle' => $sortby === 'matriculation_number']) ?>">
                        <?= _('Matrikelnummer') ?>
                    </a>
                </th>
                <th <?= $sortby === 'perms' ? 'class="sort' . $order . '"' : '' ?>>
                    <a href="<?= $controller->link_for('admin/user',['sortby' =>'perms', 'order'=> $order ,'toggle' => $sortby === 'perms']) ?>">
                        <?= _('Status') ?>
                    </a>
                </th>
                <th <?= $sortby === 'Vorname' ? 'class="sort' . $order . '"' : '' ?>>
                    <a href="<?= $controller->link_for('admin/user', ['sortby' => 'Vorname', 'order' => $order, 'toggle' => $sortby === 'Vorname']) ?>">
                        <?= _('Vorname') ?>
                    </a>
                </th>
                <th <?= $sortby === 'Nachname' ? 'class="sort' . $order . '"' : '' ?>>
                    <a href="<?= $controller->link_for('admin/user', ['sortby' => 'Nachname' , 'order' => $order, 'toggle' => $sortby === 'Nachname']) ?>">
                        <?= _('Nachname') ?>
                    </a>
                </th>
                <th <?= $sortby === 'Email' ? 'class="sort' . $order . '"' : '' ?>>
                    <a href="<?= $controller->link_for('admin/user', ['sortby' => 'Email', 'order' => $order, 'toggle' => $sortby === 'Email']) ?>">
                        <?= _('E-Mail') ?>
                    </a>
                </th>
                <th <?= $sortby === 'changed' ? 'class="sort' . $order . '"' : '' ?>>
                    <a href="<?= $controller->link_for('admin/user', ['sortby' => 'changed', 'order' => $order, 'toggle' => $sortby === 'changed']) ?>">
                        <?= _('inaktiv') ?>
                    </a>
                </th>
                <th <?= $sortby === 'mkdate' ? 'class="sort' . $order . '"' : '' ?>>
                    <a href="<?= $controller->link_for('admin/user', ['sortby' => 'mkdate', 'order' => $order , 'toggle' => $sortby === 'mkdate']) ?>">
                        <?= _('registriert seit') ?>
                    </a>
                </th>
                <th colspan="2" <?= $sortby === 'auth_plugin' ? 'class="sort' . $order . '"' : '' ?>>
                    <a href="<?= $controller->link_for('admin/user', ['sortby'=> 'auth_plugin', 'order' => $order ,'toggle' => $sortby === 'auth_plugin']) ?>">
                        <?= _('Authentifizierung') ?>
                    </a>
                </th>
            </tr>
        </thead>

        <tbody>

            <? foreach ($users as $user) : ?>
                <tr>
                    <td style="white-space:nowrap;">
                        <input class="check_all" type="checkbox" name="user_ids[]" value="<?= htmlReady($user->id) ?>">
                        <a href="<?= $controller->link_for("admin/user/edit/{$user->id}") ?>"
                           title="<?= _('Nutzer bearbeiten') ?>">
                            <?= Avatar::getAvatar($user->id)->getImageTag(Avatar::SMALL) ?>
                        </a>
                    </td>
                    <td>
                        <a href="<?= $controller->link_for("admin/user/edit/{$user->id}") ?>"
                           title="<?= _('Nutzer bearbeiten') ?>">
                            <?= htmlReady($user->username) ?>
                        </a>
                    <? if ($user->locked) : ?>
                        <?= Icon::create('lock-locked', Icon::ROLE_INFO)->asImg(tooltip2(sprintf(_('%s ist gesperrt'), htmlReady($user->getFullName())))) ?>
                    <? endif ?>
                    </td>
                    <td>
                        <?
                        $userdomains = UserDomain::getUserDomainsForUser($user->user_id);
                        $tooltxt     = _('Sichtbarkeit:') . ' ' . $user->visible;
                        if (!empty($userdomains)) {
                            $domains = [];
                            array_walk($userdomains, function ($a) use (&$domains) {
                                if (!in_array($a->name, $domains)) {
                                    $domains[] = $a->name;
                                }
                            });
                            $tooltxt .= "\n" . _('Domänen:') . ' ' . implode(', ', $domains);
                        }
                        if ($user->locked == '1') {
                            $tooltxt .= "\n" . _("Nutzer ist gesperrt!");
                        }
                        ?>
                        <?= tooltipHtmlIcon(htmlReady($tooltxt, true, true)) ?>
                    </td>
                    <td><?= htmlReady($user->matriculation_number) ?></td>
                    <td><?= $user['perms'] ?></td>
                    <td><?= htmlReady($user->Vorname) ?></td>
                    <td><?= htmlReady($user->nachname) ?></td>
                    <td><?= htmlReady($user->email) ?></td>
                    <td>
                        <? if (!empty($user->online->last_lifesign)) :
                            $inactive = time() - $user->online->last_lifesign;
                            if ($inactive < 3600 * 24) {
                                $inactive = gmdate('H:i:s', $inactive);
                            } else {
                                $inactive = floor($inactive / (3600 * 24)) . ' ' . _('Tage');
                            }
                        else :
                            $inactive = _('nie benutzt');
                        endif ?>
                        <?= $inactive ?>
                    </td>
                    <td>
                        <?= $user->mkdate ? strftime('%x', $user->mkdate) : _('unbekannt') ?>
                    </td>
                    <td><?= htmlReady($user['auth_plugin'] === null ? _('vorläufig') : $user->auth_plugin) ?></td>
                    <td class="actions" nowrap>
                    <?
                        $actionMenu = ActionMenu::get()->setContext($user);
                        $actionMenu->addLink(
                            $controller->url_for("admin/user/edit/{$user->id}"),
                            _('Nutzer bearbeiten'),
                            Icon::create('edit')
                        );

                        $actionMenu->addLink(
                            $controller->url_for('profile',['username' => $user->username]),
                            _('Zum Profil'),
                            Icon::create('person')
                        );
                        if ($GLOBALS['perm']->have_perm('root')) {
                            $actionMenu->addLink(
                                $controller->url_for('admin/user/activities/' . $user->user_id, ['from_index' => 1]),
                                _('Datei- und Aktivitätsübersicht'),
                                Icon::create('vcard'),
                                ['data-dialog' => 'size=auto']
                            );
                            $actionMenu->addLink(
                                $controller->show_user_coursesURL($user, ['from_index' => 1]),
                                _('Veranstaltungsübersicht'),
                                Icon::create('seminar'),
                                ['data-dialog' => 'size=auto']
                            );
                            if (Config::get()->LOG_ENABLE) {
                                $actionMenu->addLink(
                                    $controller->url_for('event_log/show', ['search' => $user->username, 'type' => 'user', 'object_id' => $user->id]),
                                    _('Personeneinträge im Log'),
                                    Icon::create('log')
                                );
                            }
                        }

                        $actionMenu->addLink(
                            $controller->url_for('messages/write', ['rec_uname' => $user->username]),
                            _('Nachricht an Nutzer verschicken'),
                            Icon::create('mail'),
                            ['data-dialog' => 'size=auto']
                        );

                        if ($user->locked) {
                            $actionMenu->addButton(
                                'unlock',
                                _('Nutzeraccount entsperren'),
                                Icon::create('lock-unlocked'),
                                [
                                    'formaction' => $controller->url_for("admin/user/unlock/{$user->id}", ['from_index' => 1])
                                ]
                            );
                        } else {
                            $actionMenu->addLink(
                                $controller->url_for("admin/user/lock_comment/{$user->id}", ['from_index' => 1]),
                                _('Nutzeraccount sperren'),
                                Icon::create('lock-locked'),
                                ['data-dialog' => 'size=auto']
                            );
                        }

                        if ($user->auth_plugin !== 'preliminary' && ($GLOBALS['perm']->have_perm('root') || $GLOBALS['perm']->is_fak_admin() || !in_array($user->perms, words('root admin')))) {
                            if (!StudipAuthAbstract::CheckField('auth_user_md5.password', $user->auth_plugin)) {
                                $actionMenu->addButton(
                                    'change_password',
                                    _('Passwortlink zusenden'),
                                    Icon::create('key'),
                                    [
                                        'formaction' => $controller->url_for("admin/user/change_password/{$user->id}", ['from_index' => 1])
                                    ]
                                );
                            }

                            $actionMenu->addButton(
                                'delete_user',
                                _('Nutzer löschen'),
                                Icon::create('trash'),
                                ['formaction' => $controller->url_for("admin/user/bulk/{$user->id}", ['method' => 'delete'])]
                            );

                        }

                        if (Privacy::isVisible($user->id)) {
                            $actionMenu->addLink(
                                $controller->url_for("privacy/landing/{$user->id}"),
                                _('Anzeige Personendaten'),
                                Icon::create('log'),
                                ['data-dialog' => 'size=medium']
                            );
                            $actionMenu->addLink(
                                $controller->url_for("privacy/print/{$user->id}"),
                                _('Personendaten drucken'),
                                Icon::create('print'),
                                ['class' => 'print_action', 'target' => '_blank']
                            );
                            $actionMenu->addLink(
                                $controller->url_for("privacy/export/{$user->id}"),
                                _('Export Personendaten als CSV'),
                                Icon::create('file-text')
                            );
                            $actionMenu->addLink(
                                $controller->url_for("privacy/xml/{$user->id}"),
                                _('Export Personendaten als XML'),
                                Icon::create('file-text')
                            );
                            $actionMenu->addLink(
                                $controller->url_for("privacy/filesexport/{$user->id}"),
                                _('Export persönlicher Dateien als ZIP'),
                                Icon::create('file-archive')
                            );
                        }

                        echo $actionMenu;
                    ?>
                    </td>
                </tr>
            <? endforeach ?>

        </tbody>
        <tfoot>
            <tr>
                <td colspan="12">
                        <input style="vertical-align: middle" type="checkbox" name="check_all" title="<?= _('Alle Benutzer auswählen') ?>"
                               data-proxyfor=".check_all" data-activates=".bulkAction">
                        <select name="method" class="bulkAction size-s" required>
                            <option value="">-- <?= _('Bitte wählen') ?> --</option>
                            <option value="send_message"><?= _('Nachricht senden') ?></option>
                            <option value="delete"><?= _('Löschen') ?></option>
                        </select>

                    <?= Studip\Button::create(_('Ausführen'), [
                        'title' => _('Ausgewählte Aktion ausführen'),
                        'class' => 'bulkAction',
                    ]) ?>
                </td>
            </tr>
        </tfoot>
    </table>
</form>