xref: /webtrees/resources/views/admin/users-cleanup.phtml (revision 315eb31683006273e24c08b447e6e1095d6f2147)
10c0910bfSGreg Roach<?php
2dd6b2bfcSGreg Roach
30c0910bfSGreg Roachuse Fisharebest\Webtrees\Carbon;
41fe542e9SGreg Roachuse Fisharebest\Webtrees\Contracts\UserInterface;
50c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
64c3563c0SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\UserEditPage;
74c3563c0SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\UserListPage;
82474349cSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\UsersCleanupAction;
90c0910bfSGreg Roachuse Fisharebest\Webtrees\I18N;
107c2c99faSGreg Roachuse Illuminate\Support\Collection;
117c2c99faSGreg Roach
127c2c99faSGreg Roach/**
137c2c99faSGreg Roach * @var Collection<UserInterface> $inactive_users
147c2c99faSGreg Roach * @var string                    $title
157c2c99faSGreg Roach * @var Collection<UserInterface> $unverified_users
167c2c99faSGreg Roach */
170c0910bfSGreg Roach
180c0910bfSGreg Roach?>
190c0910bfSGreg Roach
204c3563c0SGreg Roach<?= view('components/breadcrumbs', ['links' => [
214c3563c0SGreg Roach    route(ControlPanel::class) => I18N::translate('Control panel'),
224c3563c0SGreg Roach    route(UserListPage::class) => I18N::translate('User administration'),
234c3563c0SGreg Roach    $title,
244c3563c0SGreg Roach]]) ?>
25dd6b2bfcSGreg Roach
26dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
27dd6b2bfcSGreg Roach
282474349cSGreg Roach<form method="post" action="<?= e(route(UsersCleanupAction::class)) ?>">
29dd6b2bfcSGreg Roach    <?= csrf_field() ?>
30dd6b2bfcSGreg Roach
31dd6b2bfcSGreg Roach    <table class="table table-bordered">
32dd6b2bfcSGreg Roach        <?php foreach ($inactive_users as $user) : ?>
33dd6b2bfcSGreg Roach            <tr>
34dd6b2bfcSGreg Roach                <td>
355e62dd03SGreg Roach                    <input type="checkbox" name="delete[]" value="<?= $user->id() ?>" aria-label="<?= e($user->userName()) ?>">
365e62dd03SGreg Roach                </td>
375e62dd03SGreg Roach                <td>
384c3563c0SGreg Roach                    <a href="<?= e(route(UserEditPage::class, ['user_id' => $user->id()])) ?>">
39c65e00b4SGreg Roach                        <?= e($user->userName()) ?>
40dd6b2bfcSGreg Roach41*315eb316SGreg Roach                        <bdi><?= e($user->realName()) ?></bdi>
42dd6b2bfcSGreg Roach                    </a>
43dd6b2bfcSGreg Roach                </td>
44dd6b2bfcSGreg Roach                <td>
454459dc9aSGreg Roach                    <?= I18N::translate('User’s account has been inactive too long: ') ?>
461fe542e9SGreg Roach                    <?= view('components/datetime', ['timestamp' => Carbon::createFromTimestamp(max((int) $user->getPreference(UserInterface::PREF_TIMESTAMP_REGISTERED), (int) $user->getPreference(UserInterface::PREF_TIMESTAMP_ACTIVE)))]) ?>
47dd6b2bfcSGreg Roach                </td>
48dd6b2bfcSGreg Roach            </tr>
49dd6b2bfcSGreg Roach        <?php endforeach ?>
50dd6b2bfcSGreg Roach
51dd6b2bfcSGreg Roach        <?php foreach ($unverified_users as $user) : ?>
52dd6b2bfcSGreg Roach            <tr>
53dd6b2bfcSGreg Roach                <td>
545e62dd03SGreg Roach                    <input type="checkbox" name="delete[]" value="<?= $user->id() ?>" aria-label="<?= e($user->userName()) ?>">
555e62dd03SGreg Roach                </td>
565e62dd03SGreg Roach                <td>
574c3563c0SGreg Roach                    <a href="<?= e(route(UserEditPage::class, ['user_id' => $user->id()])) ?>">
58c65e00b4SGreg Roach                        <?= e($user->userName()) ?>
59dd6b2bfcSGreg Roach60*315eb316SGreg Roach                        <bdi><?= e($user->realName()) ?></bdi>
61dd6b2bfcSGreg Roach                    </a>
62dd6b2bfcSGreg Roach                </td>
63dd6b2bfcSGreg Roach                <td>
64dd6b2bfcSGreg Roach                    <?= I18N::translate('User didn’t verify within 7 days.') ?>
651fe542e9SGreg Roach                    <?php if ($user->getPreference(UserInterface::PREF_IS_ACCOUNT_APPROVED) !== '1') : ?>
66dd6b2bfcSGreg Roach                        <?= I18N::translate('User not verified by administrator.') ?>
67dd6b2bfcSGreg Roach                    <?php endif ?>
68dd6b2bfcSGreg Roach                </td>
69dd6b2bfcSGreg Roach            </tr>
70dd6b2bfcSGreg Roach        <?php endforeach ?>
71dd6b2bfcSGreg Roach    </table>
72dd6b2bfcSGreg Roach
73dd6b2bfcSGreg Roach    <p>
742474349cSGreg Roach        <?php if ($inactive_users->isEmpty() && $unverified_users->isEmpty()) : ?>
75dd6b2bfcSGreg Roach            <?= I18N::translate('Nothing found to cleanup') ?>
76dd6b2bfcSGreg Roach        <?php else : ?>
77dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
78dd6b2bfcSGreg Roach                <?= I18N::translate('delete') ?>
79dd6b2bfcSGreg Roach            </button>
80dd6b2bfcSGreg Roach        <?php endif ?>
81dd6b2bfcSGreg Roach    </p>
82dd6b2bfcSGreg Roach</form>
83