xref: /webtrees/resources/views/modules/faq/config.phtml (revision ac71572d8462e396ed5a307f05b29381e49f9e6e)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
6use Fisharebest\Webtrees\Http\RequestHandlers\ModulesAllPage;
7use Fisharebest\Webtrees\I18N;
8use Fisharebest\Webtrees\Tree;
9use Illuminate\Support\Collection;
10
11/**
12 * @var Collection<int,object> $faqs
13 * @var int                    $max_block_order
14 * @var int                    $min_block_order
15 * @var string                 $title
16 * @var Tree                   $tree
17 * @var array<string,string>   $tree_names
18 */
19
20?>
21
22<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route(ModulesAllPage::class) => I18N::translate('Modules'), $title]]) ?>
23
24<h1><?= $title ?></h1>
25
26<p>
27    <?= /* I18N: FAQ = “Frequently Asked Question” */
28    I18N::translate('FAQs are lists of questions and answers, which allow you to explain the site’s rules, policies, and procedures to your visitors. Questions are typically concerned with privacy, copyright, user-accounts, unsuitable content, requirement for source-citations, etc.') ?>
29    <?= I18N::translate('You may use HTML to format the answer and to add links to other websites.') ?>
30</p>
31
32<form method="post" class="row">
33    <div class="col-auto">
34        <div class="input-group">
35            <?= view('components/select', ['name' => 'tree', 'selected' => $tree->name(), 'options' => $tree_names, 'aria_label' => I18N::translate('Family tree')]) ?>
36            <input type="submit" class="btn btn-primary" value="<?= I18N::translate('show') ?>">
37        </div>
38    </div>
39
40    <?= csrf_field() ?>
41</form>
42
43<p>
44    <a href="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminEdit', 'tree' => $tree->name()])) ?>" class="btn btn-link">
45        <?= view('icons/add') ?>
46        <?= /* I18N: FAQ = “Frequently Asked Question” */
47        I18N::translate('Add an FAQ') ?>
48    </a>
49</p>
50
51<table class="table table-bordered">
52    <caption>
53        <?= I18N::translate('Frequently asked questions') ?>
54    </caption>
55
56    <thead>
57        <tr>
58            <th><?= I18N::translate('Sort order') ?></th>
59            <th><?= I18N::translate('Family tree') ?></th>
60            <th><?= I18N::translate('Question') ?></th>
61            <th><?= I18N::translate('Move up') ?></th>
62            <th><?= I18N::translate('Move down') ?></th>
63            <th><?= I18N::translate('Edit') ?></th>
64            <th><?= I18N::translate('Delete') ?></th>
65        </tr>
66    </thead>
67
68    <tbody>
69        <?php foreach ($faqs as $faq) : ?>
70            <tr class="faq_edit_pos">
71                <td>
72                    <?= I18N::number($faq->block_order) ?>
73                </td>
74                <td>
75                    <?php if ($faq->gedcom_id === null) : ?>
76                        <?= I18N::translate('All') ?>
77                    <?php else : ?>
78                        <?= e($tree->title()) ?>
79                    <?php endif ?>
80                </td>
81                <td>
82                    <?= e($faq->header) ?>
83                </td>
84                <td>
85                    <?php if ($faq->block_order !== $min_block_order) : ?>
86                        <a href="#" data-wt-post-url="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminMoveUp', 'block_id' => $faq->block_id])) ?>" class="btn btn-secondary">
87                            <?= view('icons/arrow-up') ?>
88                        </a>
89                    <?php endif ?>
90                </td>
91                <td>
92                    <?php if ($faq->block_order !== $max_block_order) : ?>
93                        <a href="#" data-wt-post-url="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminMoveDown', 'block_id' => $faq->block_id])) ?>" class="btn btn-secondary">
94                        <?= view('icons/arrow-down') ?>
95                        </a>
96                    <?php endif ?>
97                </td>
98                <td>
99                    <a href="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminEdit', 'block_id' => $faq->block_id, 'tree' => $tree->name()])) ?>" aria-label="<?= I18N::translate('Edit') ?>" class="btn btn-primary">
100                        <?= view('icons/edit') ?>
101                    </a>
102                </td>
103                <td>
104                    <a href="#" data-wt-post-url="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminDelete', 'block_id' => $faq->block_id])) ?>" data-wt-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($faq->header)) ?>" aria-label="<?= I18N::translate('Delete') ?>" class="btn btn-danger">
105                        <?= view('icons/delete') ?>
106                    </a>
107                </td>
108            </tr>
109        <?php endforeach ?>
110    </tbody>
111</table>
112