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