xref: /webtrees/resources/views/admin/modules.phtml (revision 8898179db9ee9ab76e7912468223d7b1fdcddfbc)
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\ModuleListInterface; ?>
13<?php use Fisharebest\Webtrees\Module\ModuleMenuInterface; ?>
14<?php use Fisharebest\Webtrees\Module\ModuleReportInterface; ?>
15<?php use Fisharebest\Webtrees\Module\ModuleSidebarInterface; ?>
16<?php use Fisharebest\Webtrees\Module\ModuleTabInterface; ?>
17<?php use Fisharebest\Webtrees\Module\ModuleThemeInterface; ?>
18<?php use Fisharebest\Webtrees\View; ?>
19
20<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), $title]]) ?>
21
22<h1><?= $title ?></h1>
23
24<?php foreach ($deleted_modules as $module_name) : ?>
25    <div class="alert alert-warning" role="alert">
26        <form action="<?= e(route('delete-module-settings')) ?>" class="form-inline" method="POST">
27            <?= csrf_field() ?>
28            <input type="hidden" name="module_name" value="<?= $module_name ?>">
29            <?= I18N::translate('Preferences exist for the module “%s”, but this module no longer exists.', $module_name) ?>
30            <button type="submit" class="btn btn-secondary">
31                <?= I18N::translate('Delete the preferences for this module.') ?>
32            </button>
33        </form>
34    </div>
35<?php endforeach ?>
36
37<form method="POST">
38    <input type="hidden" name="route" value="admin-update-module-status">
39    <?= csrf_field() ?>
40    <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">
41        <caption class="sr-only">
42            <?= I18N::translate('Module administration') ?>
43        </caption>
44        <thead>
45            <tr>
46                <th>
47                    <?= I18N::translate('Module') ?>
48                </th>
49                <th>
50                    <?= I18N::translate('Enabled') ?>
51                </th>
52                <th data-orderable="false">
53                    <?= I18N::translate('Description') ?>
54                </th>
55                <th title="<?= I18N::translate('Preferences') ?>">
56                    <?= view('icons/preferences') ?>
57                    <span class="sr-only"><?= I18N::translate('Preferences') ?></span>
58                </th>
59                <th title="<?= I18N::translate('Menus') ?>">
60                    <?= view('icons/menu') ?>
61                    <span class="sr-only"><?= I18N::translate('Menus') ?></span>
62                </th>
63                <th title="<?= I18N::translate('Tabs') ?>">
64                    <?= view('icons/tab') ?>
65                    <span class="sr-only"><?= I18N::translate('Tabs') ?></span>
66                </th>
67                <th title="<?= I18N::translate('Sidebars') ?>">
68                    <?= view('icons/sidebar') ?>
69                    <span class="sr-only"><?= I18N::translate('Sidebars') ?></span>
70                </th>
71                <th title="<?= I18N::translate('Blocks') ?>">
72                    <?= view('icons/block') ?>
73                    <span class="sr-only"><?= I18N::translate('Blocks') ?></span>
74                </th>
75                <th title="<?= I18N::translate('Charts') ?>">
76                    <?= view('icons/chart') ?>
77                    <span class="sr-only"><?= I18N::translate('Charts') ?></span>
78                </th>
79                <th title="<?= I18N::translate('Lists') ?>">
80                    <?= view('icons/list') ?>
81                    <span class="sr-only"><?= I18N::translate('Lists') ?></span>
82                </th>
83                <th title="<?= I18N::translate('Reports') ?>">
84                    <?= view('icons/report') ?>
85                    <span class="sr-only"><?= I18N::translate('Reports') ?></span>
86                </th>
87                <th title="<?= I18N::translate('Footers') ?>">
88                    <?= view('icons/footer') ?>
89                    <span class="sr-only"><?= I18N::translate('Footers') ?></span>
90                </th>
91                <th title="<?= I18N::translate('Tracking and analytics') ?>">
92                    <?= view('icons/analytics') ?>
93                    <span class="sr-only"><?= I18N::translate('Tracking and analytics') ?></span>
94                </th>
95                <th title="<?= I18N::translate('Historic events') ?>">
96                    <?= view('icons/history') ?>
97                    <span class="sr-only"><?= I18N::translate('Historic events') ?></span>
98                </th>
99                <th title="<?= I18N::translate('Themes') ?>">
100                    <?= view('icons/theme') ?>
101                    <span class="sr-only"><?= I18N::translate('Themes') ?></span>
102                </th>
103                <th title="<?= I18N::translate('Languages') ?>">
104                    <?= view('icons/language') ?>
105                    <span class="sr-only"><?= I18N::translate('Languages') ?></span>
106                </th>
107            </tr>
108        </thead>
109
110        <tbody>
111            <?php foreach ($modules as $module) : ?>
112                <tr>
113                    <th scope="row" dir="auto">
114                        <?= $module->title() ?>
115                    </th>
116                    <td class="text-center" data-sort="<?= $module->isEnabled() ?>">
117                        <?= Bootstrap4::checkbox('', false, ['name' => 'status-' . $module->name(), 'checked' => $module->isEnabled()]) ?>
118                    </td>
119                    <td>
120                        <?= $module->description() ?>
121                        <?php if ($module instanceof ModuleCustomInterface) : ?>
122                            <?= view('admin/custom-module-info', ['module' => $module]) ?>
123                        <?php endif ?>
124                        <?php if ($module instanceof ModuleExternalUrlInterface) : ?>
125                            <?= view('admin/external-module-info', ['module' => $module]) ?>
126                        <?php endif ?>
127                    </td>
128                    <td class="text-center text-muted" title="<?= I18N::translate('Preferences') ?>">
129                        <?php if ($module instanceof ModuleConfigInterface) : ?>
130                            <a href="<?= e($module->getConfigLink()) ?>" title="<?= I18N::translate('Preferences') ?>">
131                                <?= view('icons/preferences') ?>
132                                <span class="sr-only">
133                                    <?= I18N::translate('Preferences') ?>
134                                </span>
135                            </a>
136                        <?php endif ?>
137                    </td>
138                    <td class="text-center text-muted" title="<?= I18N::translate('Menu') ?>">
139                        <?php if ($module instanceof ModuleMenuInterface) : ?>
140                            <?= view('icons/menu') ?>
141                            <span class="sr-only"><?= I18N::translate('Menu') ?></span>
142                        <?php else : ?>
143                            -
144                        <?php endif ?>
145                    </td>
146                    <td class="text-center text-muted" title="<?= I18N::translate('Tab') ?>">
147                        <?php if ($module instanceof ModuleTabInterface) : ?>
148                            <?= view('icons/tab') ?>
149                            <span class="sr-only"><?= I18N::translate('Tab') ?></span>
150                        <?php else : ?>
151                            -
152                        <?php endif ?>
153                    </td>
154                    <td class="text-center text-muted" title="<?= I18N::translate('Sidebar') ?>">
155                        <?php if ($module instanceof ModuleSidebarInterface) : ?>
156                            <?= view('icons/sidebar') ?>
157                            <span class="sr-only"><?= I18N::translate('Sidebar') ?></span>
158                        <?php else : ?>
159                            -
160                        <?php endif ?>
161                    </td>
162                    <td class="text-center text-muted">
163                        <?php if ($module instanceof ModuleBlockInterface) : ?>
164                            <?php if ($module->isUserBlock()) : ?>
165                                <span title="<?= I18N::translate('My page') ?>">
166                                    <?= view('icons/block-user') ?>
167                                </span>
168                                <span class="sr-only">
169                                    <?= I18N::translate('My page') ?>
170                                </span>
171                            <?php endif ?>
172
173                            <?php if ($module->isTreeBlock()) : ?>
174                                <span title="<?= I18N::translate('Home page') ?>">
175                                    <?= view('icons/block-tree') ?>
176                                </span>
177                                <span class="sr-only">
178                                    <?= I18N::translate('Home page') ?>
179                                </span>
180                            <?php endif ?>
181                        <?php else : ?>
182                            -
183                        <?php endif ?>
184                    </td>
185                    <td class="text-center text-muted" title="<?= I18N::translate('Chart') ?>">
186                        <?php if ($module instanceof ModuleChartInterface) : ?>
187                            <?= view('icons/chart') ?>
188                            <span class="sr-only"><?= I18N::translate('Chart') ?></span>
189                        <?php else : ?>
190                            -
191                        <?php endif ?>
192                    </td>
193                    <td class="text-center text-muted" title="<?= I18N::translate('List') ?>">
194                        <?php if ($module instanceof ModuleListInterface) : ?>
195                            <?= view('icons/list') ?>
196                            <span class="sr-only"><?= I18N::translate('List') ?></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