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