xref: /webtrees/resources/views/admin/users-cleanup.phtml (revision 4459dc9a6d0c27769f8135175f3569e4fa287451)
1dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Bootstrap4; ?>
2*4459dc9aSGreg Roach<?php use Fisharebest\Webtrees\Carbon; ?>
3dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\Functions\FunctionsDate; ?>
4dd6b2bfcSGreg Roach<?php use Fisharebest\Webtrees\I18N; ?>
5dd6b2bfcSGreg Roach
6dd6b2bfcSGreg Roach<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-users') => I18N::translate('User administration'), $title]]) ?>
7dd6b2bfcSGreg Roach
8dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
9dd6b2bfcSGreg Roach
10dd6b2bfcSGreg Roach<form>
11dd6b2bfcSGreg Roach    <input type="hidden" name="route" value="admin-users-cleanup">
12dd6b2bfcSGreg Roach    <div class="form-group row">
13dd6b2bfcSGreg Roach        <label for="months" class="col-sm-8 col-form-label">
14dd6b2bfcSGreg Roach            <?= I18N::translate('Number of months since the last sign-in for a user’s account to be considered inactive: ') ?>
15dd6b2bfcSGreg Roach        </label>
16dd6b2bfcSGreg Roach        <div class="col-sm-2">
17dd6b2bfcSGreg Roach            <?= Bootstrap4::select($options, $months, ['id' => 'months', 'name' => 'months']) ?>
18dd6b2bfcSGreg Roach        </div>
19dd6b2bfcSGreg Roach        <div class="col-sm-2">
20dd6b2bfcSGreg Roach            <button type="submit" class="btn btn-primary">
21dd6b2bfcSGreg Roach                <?= I18N::translate('update') ?>
22dd6b2bfcSGreg Roach            </button>
23dd6b2bfcSGreg Roach        </div>
24dd6b2bfcSGreg Roach    </div>
25dd6b2bfcSGreg Roach</form>
26dd6b2bfcSGreg Roach
27dd6b2bfcSGreg Roach<form method="post">
28dd6b2bfcSGreg Roach    <?= csrf_field() ?>
29dd6b2bfcSGreg Roach
30dd6b2bfcSGreg Roach    <table class="table table-bordered">
31dd6b2bfcSGreg Roach        <?php foreach ($inactive_users as $user) : ?>
32dd6b2bfcSGreg Roach            <tr>
33dd6b2bfcSGreg Roach                <td>
34895230eeSGreg Roach                    <a href="<?= e(route('admin-users-edit', ['user_id' => $user->id()])) ?>">
35c65e00b4SGreg Roach                        <?= e($user->userName()) ?>
36dd6b2bfcSGreg Roach37e5a6b4d4SGreg Roach                        <span dir="auto"><?= e($user->realName()) ?></span>
38dd6b2bfcSGreg Roach                    </a>
39dd6b2bfcSGreg Roach                </td>
40dd6b2bfcSGreg Roach                <td>
41*4459dc9aSGreg Roach                    <?= I18N::translate('User’s account has been inactive too long: ') ?>
42*4459dc9aSGreg Roach                    <?= view('components/datetime', ['timestamp' => Carbon::createFromTimestamp(max((int) $user->getPreference('reg_timestamp'), (int) $user->getPreference('sessiontime')))]) ?>
43dd6b2bfcSGreg Roach                </td>
44dd6b2bfcSGreg Roach                <td>
45895230eeSGreg Roach                    <input type="checkbox" name="del_<?= $user->id() ?>">
46dd6b2bfcSGreg Roach                </td>
47dd6b2bfcSGreg Roach            </tr>
48dd6b2bfcSGreg Roach        <?php endforeach ?>
49dd6b2bfcSGreg Roach
50dd6b2bfcSGreg Roach        <?php foreach ($unverified_users as $user) : ?>
51dd6b2bfcSGreg Roach            <tr>
52dd6b2bfcSGreg Roach                <td>
53895230eeSGreg Roach                    <a href="<?= e(route('admin-users-edit', ['user_id' => $user->id()])) ?>">
54c65e00b4SGreg Roach                        <?= e($user->userName()) ?>
55dd6b2bfcSGreg Roach56e5a6b4d4SGreg Roach                        <span dir="auto"><?= e($user->realName()) ?></span>
57dd6b2bfcSGreg Roach                    </a>
58dd6b2bfcSGreg Roach                </td>
59dd6b2bfcSGreg Roach                <td>
60dd6b2bfcSGreg Roach                    <?= I18N::translate('User didn’t verify within 7 days.') ?>
61dd6b2bfcSGreg Roach                    <?php if ($user->getPreference('verified_by_admin') !== '1') : ?>
62dd6b2bfcSGreg Roach                        <?= I18N::translate('User not verified by administrator.') ?>
63dd6b2bfcSGreg Roach                    <?php endif ?>
64dd6b2bfcSGreg Roach                </td>
65dd6b2bfcSGreg Roach                <td>
66895230eeSGreg Roach                    <input type="checkbox" name="del_<?= $user->id() ?>">
67dd6b2bfcSGreg Roach                </td>
68dd6b2bfcSGreg Roach            </tr>
69dd6b2bfcSGreg Roach        <?php endforeach ?>
70dd6b2bfcSGreg Roach    </table>
71dd6b2bfcSGreg Roach
72dd6b2bfcSGreg Roach    <p>
73dd6b2bfcSGreg Roach        <?php if (empty($inactive_users) && empty($unverified_users)) : ?>
74dd6b2bfcSGreg Roach            <?= I18N::translate('Nothing found to cleanup') ?>
75dd6b2bfcSGreg Roach        <?php else : ?>
76dd6b2bfcSGreg Roach        <button type="submit" class="btn btn-primary">
77dd6b2bfcSGreg Roach            <?= I18N::translate('delete') ?>
78dd6b2bfcSGreg Roach        </button>
79dd6b2bfcSGreg Roach        <?php endif ?>
80dd6b2bfcSGreg Roach    </p>
81dd6b2bfcSGreg Roach</form>
82