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