xref: /webtrees/resources/views/admin/users-cleanup.phtml (revision b6017f990d38d8c56e04c0096ce9a7e8745ad4ba)
1<?php
2
3use Fisharebest\Webtrees\Carbon;
4use Fisharebest\Webtrees\Contracts\UserInterface;
5use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
6use Fisharebest\Webtrees\Http\RequestHandlers\UserEditPage;
7use Fisharebest\Webtrees\Http\RequestHandlers\UserListPage;
8use Fisharebest\Webtrees\Http\RequestHandlers\UsersCleanupAction;
9use Fisharebest\Webtrees\I18N;
10
11?>
12
13<?= view('components/breadcrumbs', ['links' => [
14    route(ControlPanel::class) => I18N::translate('Control panel'),
15    route(UserListPage::class) => I18N::translate('User administration'),
16    $title,
17]]) ?>
18
19<h1><?= $title ?></h1>
20
21<form method="post" action="<?= e(route(UsersCleanupAction::class)) ?>">
22    <?= csrf_field() ?>
23
24    <table class="table table-bordered">
25        <?php foreach ($inactive_users as $user) : ?>
26            <tr>
27                <td>
28                    <input type="checkbox" name="delete[]" value="<?= $user->id() ?>" aria-label="<?= e($user->userName()) ?>">
29                </td>
30                <td>
31                    <a href="<?= e(route(UserEditPage::class, ['user_id' => $user->id()])) ?>">
32                        <?= e($user->userName()) ?>
3334                        <span dir="auto"><?= e($user->realName()) ?></span>
35                    </a>
36                </td>
37                <td>
38                    <?= I18N::translate('User’s account has been inactive too long: ') ?>
39                    <?= view('components/datetime', ['timestamp' => Carbon::createFromTimestamp(max((int) $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED), (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE)))]) ?>
40                </td>
41            </tr>
42        <?php endforeach ?>
43
44        <?php foreach ($unverified_users as $user) : ?>
45            <tr>
46                <td>
47                    <input type="checkbox" name="delete[]" value="<?= $user->id() ?>" aria-label="<?= e($user->userName()) ?>">
48                </td>
49                <td>
50                    <a href="<?= e(route(UserEditPage::class, ['user_id' => $user->id()])) ?>">
51                        <?= e($user->userName()) ?>
5253                        <span dir="auto"><?= e($user->realName()) ?></span>
54                    </a>
55                </td>
56                <td>
57                    <?= I18N::translate('User didn’t verify within 7 days.') ?>
58                    <?php if ($user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) !== '1') : ?>
59                        <?= I18N::translate('User not verified by administrator.') ?>
60                    <?php endif ?>
61                </td>
62            </tr>
63        <?php endforeach ?>
64    </table>
65
66    <p>
67        <?php if ($inactive_users->isEmpty() && $unverified_users->isEmpty()) : ?>
68            <?= I18N::translate('Nothing found to cleanup') ?>
69        <?php else : ?>
70            <button type="submit" class="btn btn-primary">
71                <?= I18N::translate('delete') ?>
72            </button>
73        <?php endif ?>
74    </p>
75</form>
76