xref: /webtrees/resources/views/admin/clean-data.phtml (revision ac71572d8462e396ed5a307f05b29381e49f9e6e)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
6use Fisharebest\Webtrees\Http\RequestHandlers\DeletePath;
7use Fisharebest\Webtrees\I18N;
8
9/**
10 * @var array<string> $entries
11 * @var array<string> $protected
12 * @var string        $title
13 */
14
15?>
16
17<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
18
19<h1><?= $title ?></h1>
20
21<p>
22    <?= I18N::translate('Files marked with %s are required for proper operation and cannot be removed.', view('icons/ban')) ?>
23</p>
24
25<form method="post">
26    <input type="hidden" value="admin-clean-data">
27
28    <ul class="fa-ul mx-0">
29        <?php foreach ($entries as $entry) : ?>
30            <li>
31                <?php if (substr_compare($entry, '/', -1) === 0) : ?>
32                    <?= view('icons/folder') ?>
33                <?php else : ?>
34                     <?= view('icons/file') ?>
35                <?php endif ?>
36                <?= e($entry) ?>
37                <?php if (in_array($entry, $protected, true)) : ?>
38                    <?= view('icons/ban') ?>
39                <?php else : ?>
40                    <a
41                        href="#"
42                        data-wt-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($entry)) ?>"
43                        data-wt-post-url="<?= e(route(DeletePath::class, ['path' => $entry])) ?>"
44                        class="btn btn-sm btn-link"
45                    >
46                        <?= view('icons/delete') ?>
47                        <span class="visually-hidden"><?= I18N::translate('delete') ?></span>
48                    </a>
49                <?php endif ?>
50            </li>
51        <?php endforeach ?>
52    </ul>
53
54    <?= csrf_field() ?>
55</form>
56