xref: /webtrees/resources/views/admin/users-table-options.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
1040e7dbaSGreg Roach<?php
2040e7dbaSGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
596aa0555SGreg Roachuse Fisharebest\Webtrees\Auth;
66fd01894SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\DeleteUser;
72627f99aSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\HomePage;
8b4144a6dSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\Masquerade;
94c3563c0SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\UserEditPage;
10040e7dbaSGreg Roachuse Fisharebest\Webtrees\I18N;
1196aa0555SGreg Roachuse Fisharebest\Webtrees\User;
1296aa0555SGreg Roach
1396aa0555SGreg Roach/**
14f70bcff5SGreg Roach * @var object $row
1596aa0555SGreg Roach * @var User   $self
1696aa0555SGreg Roach * @var User   $user
1796aa0555SGreg Roach */
18040e7dbaSGreg Roach
19040e7dbaSGreg Roach?>
20040e7dbaSGreg Roach
21040e7dbaSGreg Roach<div class="dropdown">
22315eb316SGreg Roach    <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">
23040e7dbaSGreg Roach        <?= view('icons/menu') ?>
24040e7dbaSGreg Roach    </button>
25040e7dbaSGreg Roach    <div class="dropdown-menu" aria-labelledby="edit-user-button-<?= $row->user_id ?>">
26040e7dbaSGreg Roach        <div class="dropdown-item">
27040e7dbaSGreg Roach            <?= view('icons/edit') ?>
284c3563c0SGreg Roach            <a href="<?= e(route(UserEditPage::class, ['user_id' => $row->user_id])) ?>">
29040e7dbaSGreg Roach                <?= I18N::translate('Edit') ?>
30040e7dbaSGreg Roach            </a>
31040e7dbaSGreg Roach        </div>
32040e7dbaSGreg Roach
33040e7dbaSGreg Roach        <div class="divider"></div>
34040e7dbaSGreg Roach
3596aa0555SGreg Roach        <?php if ($user->id() !== $self->id()) : ?>
36040e7dbaSGreg Roach            <div class="dropdown-item">
37040e7dbaSGreg Roach                <?= view('icons/user') ?>
38d4786c66SGreg Roach                <a href="#" data-wt-post-url="<?= e(route(Masquerade::class, ['user_id' => $row->user_id])) ?>" data-wt-reload-url="<?= e(route(HomePage::class)) ?>">
39040e7dbaSGreg Roach                    <?= I18N::translate('Masquerade as this user') ?>
40040e7dbaSGreg Roach                </a>
41040e7dbaSGreg Roach            </div>
42040e7dbaSGreg Roach
4396aa0555SGreg Roach            <?php if (!Auth::isAdmin($user)) : ?>
44040e7dbaSGreg Roach                <div class="dropdown-item">
45040e7dbaSGreg Roach                    <?= view('icons/delete') ?>
46d4786c66SGreg Roach                    <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])) ?>">
47040e7dbaSGreg Roach                        <?= I18N::translate('Delete') ?>
48040e7dbaSGreg Roach                    </a>
49040e7dbaSGreg Roach                </div>
50040e7dbaSGreg Roach            <?php endif ?>
5196aa0555SGreg Roach        <?php endif ?>
52040e7dbaSGreg Roach    </div>
53040e7dbaSGreg Roach</div>
54