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