xref: /webtrees/resources/views/admin/clean-data.phtml (revision 663dd9d85326d3016550248671b2f0eba8949cb3)
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">
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-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($entry)) ?>"
42                        data-post-url="<?= e(route(DeletePath::class, ['path' => $entry])) ?>"
43                        class="btn btn-sm btn-link"
44                    >
45                        <?= view('icons/delete') ?>
46                    </a>
47                <?php endif ?>
48            </li>
49        <?php endforeach ?>
50    </ul>
51</form>
52