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