xref: /webtrees/resources/views/admin/modules.phtml (revision daf34d43ba5e888a45d11a75c74019f07021ac04)
1<?php use Fisharebest\Webtrees\I18N; ?>
2<?php use Fisharebest\Webtrees\Module\ModuleAnalyticsInterface; ?>
3<?php use Fisharebest\Webtrees\Module\ModuleBlockInterface; ?>
4<?php use Fisharebest\Webtrees\Module\ModuleChartInterface; ?>
5<?php use Fisharebest\Webtrees\Module\ModuleConfigInterface; ?>
6<?php use Fisharebest\Webtrees\Module\ModuleCustomInterface; ?>
7<?php use Fisharebest\Webtrees\Module\ModuleExternalUrlInterface; ?>
8<?php use Fisharebest\Webtrees\Module\ModuleFooterInterface; ?>
9<?php use Fisharebest\Webtrees\Module\ModuleHistoricEventsInterface; ?>
10<?php use Fisharebest\Webtrees\Module\ModuleLanguageInterface; ?>
11<?php use Fisharebest\Webtrees\Module\ModuleListInterface; ?>
12<?php use Fisharebest\Webtrees\Module\ModuleMenuInterface; ?>
13<?php use Fisharebest\Webtrees\Module\ModuleReportInterface; ?>
14<?php use Fisharebest\Webtrees\Module\ModuleSidebarInterface; ?>
15<?php use Fisharebest\Webtrees\Module\ModuleTabInterface; ?>
16<?php use Fisharebest\Webtrees\Module\ModuleThemeInterface; ?>
17<?php use Fisharebest\Webtrees\View; ?>
18
19<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), $title]]) ?>
20
21<h1><?= $title ?></h1>
22
23<?php foreach ($deleted_modules as $module_name) : ?>
24    <div class="alert alert-warning" role="alert">
25        <form method="post" action="<?= e(route('delete-module-settings')) ?>" class="form-inline">
26            <?= csrf_field() ?>
27            <input type="hidden" name="module_name" value="<?= $module_name ?>">
28            <?= I18N::translate('Preferences exist for the module “%s”, but this module no longer exists.', $module_name) ?>
29            <button type="submit" class="btn btn-secondary">
30                <?= I18N::translate('Delete the preferences for this module.') ?>
31            </button>
32        </form>
33    </div>
34<?php endforeach ?>
35
36<form method="post">
37    <?= csrf_field() ?>
38    <table class="table table-bordered table-hover table-sm table-module-administration"
39        <?= view('lists/datatables-attributes') ?>
40        data-info="false"
41        data-paging="false"
42        data-filter="false"
43    >
44        <caption class="sr-only">
45            <?= I18N::translate('Module administration') ?>
46        </caption>
47        <thead>
48            <tr>
49                <th>
50                    <?= I18N::translate('Module') ?>
51                </th>
52                <th>
53                    <?= I18N::translate('Enabled') ?>
54                </th>
55                <th data-orderable="false">
56                    <?= I18N::translate('Description') ?>
57                </th>
58                <th title="<?= I18N::translate('Preferences') ?>">
59                    <?= view('icons/preferences') ?>
60                    <span class="sr-only"><?= I18N::translate('Preferences') ?></span>
61                </th>
62                <th title="<?= I18N::translate('Menus') ?>">
63                    <?= view('icons/menu') ?>
64                    <span class="sr-only"><?= I18N::translate('Menus') ?></span>
65                </th>
66                <th title="<?= I18N::translate('Tabs') ?>">
67                    <?= view('icons/tab') ?>
68                    <span class="sr-only"><?= I18N::translate('Tabs') ?></span>
69                </th>
70                <th title="<?= I18N::translate('Sidebars') ?>">
71                    <?= view('icons/sidebar') ?>
72                    <span class="sr-only"><?= I18N::translate('Sidebars') ?></span>
73                </th>
74                <th title="<?= I18N::translate('Blocks') ?>">
75                    <?= view('icons/block') ?>
76                    <span class="sr-only"><?= I18N::translate('Blocks') ?></span>
77                </th>
78                <th title="<?= I18N::translate('Charts') ?>">
79                    <?= view('icons/chart') ?>
80                    <span class="sr-only"><?= I18N::translate('Charts') ?></span>
81                </th>
82                <th title="<?= I18N::translate('Lists') ?>">
83                    <?= view('icons/list') ?>
84                    <span class="sr-only"><?= I18N::translate('Lists') ?></span>
85                </th>
86                <th title="<?= I18N::translate('Reports') ?>">
87                    <?= view('icons/report') ?>
88                    <span class="sr-only"><?= I18N::translate('Reports') ?></span>
89                </th>
90                <th title="<?= I18N::translate('Footers') ?>">
91                    <?= view('icons/footer') ?>
92                    <span class="sr-only"><?= I18N::translate('Footers') ?></span>
93                </th>
94                <th title="<?= I18N::translate('Tracking and analytics') ?>">
95                    <?= view('icons/analytics') ?>
96                    <span class="sr-only"><?= I18N::translate('Tracking and analytics') ?></span>
97                </th>
98                <th title="<?= I18N::translate('Historic events') ?>">
99                    <?= view('icons/history') ?>
100                    <span class="sr-only"><?= I18N::translate('Historic events') ?></span>
101                </th>
102                <th title="<?= I18N::translate('Themes') ?>">
103                    <?= view('icons/theme') ?>
104                    <span class="sr-only"><?= I18N::translate('Themes') ?></span>
105                </th>
106                <th title="<?= I18N::translate('Languages') ?>">
107                    <?= view('icons/language') ?>
108                    <span class="sr-only"><?= I18N::translate('Languages') ?></span>
109                </th>
110            </tr>
111        </thead>
112
113        <tbody>
114            <?php foreach ($modules as $module) : ?>
115                <tr>
116                    <th scope="row" dir="auto">
117                        <?= $module->title() ?>
118                    </th>
119                    <td class="text-center" data-sort="<?= $module->isEnabled() ?>">
120                        <?= view('components/checkbox', ['label' => '', 'name' => 'status-' . $module->name(), 'checked' => $module->isEnabled()]) ?>
121                    </td>
122                    <td>
123                        <?= $module->description() ?>
124                        <?php if ($module instanceof ModuleCustomInterface) : ?>
125                            <?= view('admin/custom-module-info', ['module' => $module]) ?>
126                        <?php endif ?>
127                        <?php if ($module instanceof ModuleExternalUrlInterface) : ?>
128                            <?= view('admin/external-module-info', ['module' => $module]) ?>
129                        <?php endif ?>
130                    </td>
131                    <td class="text-center text-muted" title="<?= I18N::translate('Preferences') ?>">
132                        <?php if ($module instanceof ModuleConfigInterface) : ?>
133                            <?php if ($module->isEnabled()) : ?>
134                                <a href="<?= e($module->getConfigLink()) ?>" title="<?= I18N::translate('Preferences') ?>">
135                                    <?= view('icons/preferences') ?>
136                                    <span class="sr-only">
137                                        <?= I18N::translate('Preferences') ?>
138                                    </span>
139                                </a>
140                            <?php else : ?>
141                                <?= view('icons/preferences') ?>
142                            <?php endif ?>
143                        <?php endif ?>
144                    </td>
145                    <td class="text-center text-muted" title="<?= I18N::translate('Menu') ?>">
146                        <?php if ($module instanceof ModuleMenuInterface) : ?>
147                            <?= view('icons/menu') ?>
148                            <span class="sr-only"><?= I18N::translate('Menu') ?></span>
149                        <?php else : ?>
150                            -
151                        <?php endif ?>
152                    </td>
153                    <td class="text-center text-muted" title="<?= I18N::translate('Tab') ?>">
154                        <?php if ($module instanceof ModuleTabInterface) : ?>
155                            <?= view('icons/tab') ?>
156                            <span class="sr-only"><?= I18N::translate('Tab') ?></span>
157                        <?php else : ?>
158                            -
159                        <?php endif ?>
160                    </td>
161                    <td class="text-center text-muted" title="<?= I18N::translate('Sidebar') ?>">
162                        <?php if ($module instanceof ModuleSidebarInterface) : ?>
163                            <?= view('icons/sidebar') ?>
164                            <span class="sr-only"><?= I18N::translate('Sidebar') ?></span>
165                        <?php else : ?>
166                            -
167                        <?php endif ?>
168                    </td>
169                    <td class="text-center text-muted">
170                        <?php if ($module instanceof ModuleBlockInterface) : ?>
171                            <?php if ($module->isUserBlock()) : ?>
172                                <span title="<?= I18N::translate('My page') ?>">
173                                    <?= view('icons/block-user') ?>
174                                </span>
175                                <span class="sr-only">
176                                    <?= I18N::translate('My page') ?>
177                                </span>
178                            <?php endif ?>
179
180                            <?php if ($module->isTreeBlock()) : ?>
181                                <span title="<?= I18N::translate('Home page') ?>">
182                                    <?= view('icons/block-tree') ?>
183                                </span>
184                                <span class="sr-only">
185                                    <?= I18N::translate('Home page') ?>
186                                </span>
187                            <?php endif ?>
188                        <?php else : ?>
189                            -
190                        <?php endif ?>
191                    </td>
192                    <td class="text-center text-muted" title="<?= I18N::translate('Chart') ?>">
193                        <?php if ($module instanceof ModuleChartInterface) : ?>
194                            <?= view('icons/chart') ?>
195                            <span class="sr-only"><?= I18N::translate('Chart') ?></span>
196                        <?php else : ?>
197                            -
198                        <?php endif ?>
199                    </td>
200                    <td class="text-center text-muted" title="<?= I18N::translate('List') ?>">
201                        <?php if ($module instanceof ModuleListInterface) : ?>
202                            <?= view('icons/list') ?>
203                            <span class="sr-only"><?= I18N::translate('List') ?></span>
204                        <?php else : ?>
205                            -
206                        <?php endif ?>
207                    </td>
208                    <td class="text-center text-muted" title="<?= I18N::translate('Report') ?>">
209                        <?php if ($module instanceof ModuleReportInterface) : ?>
210                            <?= view('icons/report') ?>
211                            <span class="sr-only"><?= I18N::translate('Report') ?></span>
212                        <?php else : ?>
213                            -
214                        <?php endif ?>
215                    </td>
216                    <td class="text-center text-muted" title="<?= I18N::translate('Footer') ?>">
217                        <?php if ($module instanceof ModuleFooterInterface) : ?>
218                            <?= view('icons/footer') ?>
219                            <span class="sr-only"><?= I18N::translate('Footer') ?></span>
220                        <?php else : ?>
221                            -
222                        <?php endif ?>
223                    </td>
224                    <td class="text-center text-muted" title="<?= I18N::translate('Tracking and analytics') ?>">
225                        <?php if ($module instanceof ModuleAnalyticsInterface) : ?>
226                            <?= view('icons/analytics') ?>
227                            <span class="sr-only"><?= I18N::translate('Tracking and analytics') ?></span>
228                        <?php else : ?>
229                            -
230                        <?php endif ?>
231                    </td>
232                    <td class="text-center text-muted" title="<?= I18N::translate('Historic events') ?>">
233                        <?php if ($module instanceof ModuleHistoricEventsInterface) : ?>
234                            <?= view('icons/history') ?>
235                            <span class="sr-only"><?= I18N::translate('Historic events') ?></span>
236                        <?php else : ?>
237                            -
238                        <?php endif ?>
239                    </td>
240                    <td class="text-center text-muted" title="<?= I18N::translate('Theme') ?>">
241                        <?php if ($module instanceof ModuleThemeInterface) : ?>
242                            <?= view('icons/theme') ?>
243                            <span class="sr-only"><?= I18N::translate('Theme') ?></span>
244                        <?php else : ?>
245                            -
246                        <?php endif ?>
247                    </td>
248                    <td class="text-center text-muted" title="<?= I18N::translate('Language') ?>">
249                        <?php if ($module instanceof ModuleLanguageInterface) : ?>
250                            <?= view('icons/language') ?>
251                            <span class="sr-only"><?= I18N::translate('Language') ?></span>
252                        <?php else : ?>
253                            -
254                        <?php endif ?>
255                    </td>
256                </tr>
257            <?php endforeach ?>
258        </tbody>
259    </table>
260    <button class="btn btn-primary" type="submit">
261        <?= view('icons/save') ?>
262        <?= I18N::translate('save') ?></button>
263</form>
264
265<?php View::push('javascript') ?>
266<script>
267  'use strict';
268
269  $(".table-module-administration").dataTable();
270</script>
271<?php View::endpush() ?>
272