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