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