xref: /webtrees/resources/views/admin/users-table-options.phtml (revision cf7c85896a54223772c76826381a9151d4a21e10)
1<?php
2
3use Fisharebest\Webtrees\Auth;
4use Fisharebest\Webtrees\Http\RequestHandlers\Masquerade;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\User;
7
8/**
9 * @var stdClass $row
10 * @var User     $self
11 * @var User     $user
12 */
13
14?>
15
16<div class="dropdown">
17    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" id="edit-user-button-<?= $row->user_id ?>" aria-haspopup="true" aria-expanded="false">
18        <?= view('icons/menu') ?>
19    </button>
20    <div class="dropdown-menu" aria-labelledby="edit-user-button-<?= $row->user_id ?>">
21        <div class="dropdown-item">
22            <?= view('icons/edit') ?>
23            <a href="<?= e(route('admin-users-edit', ['user_id' => $row->user_id])) ?>">
24                <?= I18N::translate('Edit') ?>
25            </a>
26        </div>
27
28        <div class="divider"></div>
29
30        <?php if ($user->id() !== $self->id()) : ?>
31            <div class="dropdown-item">
32                <?= view('icons/user') ?>
33                <a href="#" data-post-url="<?= e(route(Masquerade::class, ['user_id' => $row->user_id])) ?>">
34                    <?= I18N::translate('Masquerade as this user') ?>
35                </a>
36            </div>
37
38            <?php if (!Auth::isAdmin($user)) : ?>
39                <div class="dropdown-item">
40                    <?= view('icons/delete') ?>
41                    <a href="#" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($row->user_name)) ?>" data-post-url="<?= e(route('delete-user', ['user_id' => $row->user_id])) ?>">
42                        <?= I18N::translate('Delete') ?>
43                    </a>
44                </div>
45            <?php endif ?>
46        <?php endif ?>
47    </div>
48</div>
49