xref: /webtrees/resources/views/modules/faq/config.phtml (revision fcfa147e10aaa6c7ff580c29bd6e5b88666befc1)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4use Fisharebest\Webtrees\I18N;
5
6?>
7
8<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route('modules') => I18N::translate('Modules'), $title]]) ?>
9
10<h1><?= $title ?></h1>
11
12<p>
13    <?= /* I18N: FAQ = “Frequently Asked Question” */
14    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.') ?>
15    <?= I18N::translate('You may use HTML to format the answer and to add links to other websites.') ?>
16</p>
17
18<p>
19<form method="get" action="<?= e(route('module', ['module' => $module, 'action' => 'Admin'])) ?>" class="form form-inline">
20    <input type="hidden" name="route" value="<?= e('/module/' . $module . '/Admin') ?>">
21    <label for="tree" class="sr-only">
22        <?= I18N::translate('Family tree') ?>
23    </label>
24    <?= view('components/select', ['name' => 'tree', 'selected' => $tree->name(), 'options' => $tree_names]) ?>
25    <input type="submit" class="btn btn-primary" value="<?= I18N::translate('show') ?>">
26</form>
27</p>
28
29<p>
30    <a href="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminEdit', 'tree' => $tree->name()])) ?>" class="btn btn-link">
31        <?= view('icons/add') ?>
32        <?= /* I18N: FAQ = “Frequently Asked Question” */
33        I18N::translate('Add an FAQ') ?>
34    </a>
35</p>
36
37<table class="table table-bordered">
38    <thead>
39        <tr>
40            <th><?= I18N::translate('Sort order') ?></th>
41            <th><?= I18N::translate('Family tree') ?></th>
42            <th><?= I18N::translate('Question') ?></th>
43            <th><span class="sr-only"><?= I18N::translate('Move up') ?></span></th>
44            <th><span class="sr-only"><?= I18N::translate('Move down') ?></span></th>
45            <th><span class="sr-only"><?= I18N::translate('Edit') ?></span></th>
46            <th><span class="sr-only"><?= I18N::translate('Delete') ?></span></th>
47        </tr>
48    </thead>
49    <tbody>
50        <?php foreach ($faqs as $faq) : ?>
51            <tr class="faq_edit_pos">
52                <td>
53                    <?= I18N::number($faq->block_order + 1) ?>
54                </td>
55                <td>
56                    <?php if ($faq->gedcom_id === null) : ?>
57                        <?= I18N::translate('All') ?>
58                    <?php else : ?>
59                        <?= e($tree->title()) ?>
60                    <?php endif ?>
61                </td>
62                <td>
63                    <?= e($faq->header) ?>
64                </td>
65                <td>
66                    <?php if ($faq->block_order != $min_block_order) : ?>
67                        <form method="post" action="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminMoveUp', 'block_id' => $faq->block_id, 'tree' => $tree->name()])) ?>">
68                            <?= csrf_field() ?>
69                            <button type="submit" class="btn btn-secondary">
70                                <?= view('icons/arrow-up') ?>
71                                <?= I18N::translate('Move up') ?>
72                            </button>
73                        </form>
74                    <?php endif ?>
75                </td>
76                <td>
77                    <?php if ($faq->block_order != $max_block_order) : ?>
78                        <form method="post" action="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminMoveDown', 'block_id' => $faq->block_id, 'tree' => $tree->name()])) ?>">
79                            <?= csrf_field() ?>
80                            <button type="submit" class="btn btn-secondary">
81                                <?= view('icons/arrow-down') ?>
82                                <?= I18N::translate('Move down') ?>
83                            </button>
84                        </form>
85                    <?php endif ?>
86                </td>
87                <td>
88                    <a href="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminEdit', 'block_id' => $faq->block_id, 'tree' => $tree->name()])) ?>" class="btn btn-primary">
89                        <?= view('icons/edit') ?>
90                        <?= I18N::translate('Edit') ?>
91                    </a>
92                </td>
93                <td>
94                    <form method="post" action="<?= e(route('module', ['module' => 'faq', 'action' => 'AdminDelete', 'block_id' => $faq->block_id, 'tree' => $tree->name()])) ?>">
95                        <?= csrf_field() ?>
96                        <button type="submit" class="btn btn-danger" onclick="return confirm(this.dataset.confirm);" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($faq->header)) ?>">
97                            <?= view('icons/delete') ?>
98                            <?= I18N::translate('delete') ?>
99                        </button>
100                    </form>
101                </td>
102            </tr>
103        <?php endforeach ?>
104    </tbody>
105</table>
106