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