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