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