xref: /webtrees/resources/views/admin/modules.phtml (revision 4fbeb707df82fa5025e6110f443695700edd846c)
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                            <br>
123                            <?= view('icons/warning') ?>
124                            <?= I18N::translate('Custom module') ?>
125                            <?php if ($module::CUSTOM_VERSION) : ?>
126                                - <?= I18N::translate('Version') ?> <?= $module::CUSTOM_VERSION ?>
127                            <?php endif ?>
128                            <?php if ($module::CUSTOM_WEBSITE) : ?>
129                                - <a href="<?= $module::CUSTOM_WEBSITE ?>">
130                                    <?= $module::CUSTOM_WEBSITE ?>
131                                </a>
132                            <?php endif ?>
133                        <?php endif ?>
134                        <?php if ($module instanceof ModuleExternalUrlInterface) : ?>
135                            <br>
136                            <a href="<?= e($module->externalUrl()) ?>">
137                                <?= e($module->externalUrl()) ?>
138                            </a>
139                        <?php endif ?>
140                    </td>
141                    <td class="text-center text-muted" title="<?= I18N::translate('Preferences') ?>">
142                        <?php if ($module instanceof ModuleConfigInterface) : ?>
143                            <a href="<?= e($module->getConfigLink()) ?>" title="<?= I18N::translate('Preferences') ?>">
144                                <?= view('icons/preferences') ?>
145                                <span class="sr-only">
146                                    <?= I18N::translate('Preferences') ?>
147                                </span>
148                            </a>
149                        <?php endif ?>
150                    </td>
151                    <td class="text-center text-muted" title="<?= I18N::translate('Menu') ?>">
152                        <?php if ($module instanceof ModuleMenuInterface) : ?>
153                            <?= view('icons/menu') ?>
154                            <span class="sr-only"><?= I18N::translate('Menu') ?></span>
155                        <?php else : ?>
156                            -
157                        <?php endif ?>
158                    </td>
159                    <td class="text-center text-muted" title="<?= I18N::translate('Tab') ?>">
160                        <?php if ($module instanceof ModuleTabInterface) : ?>
161                            <?= view('icons/tab') ?>
162                            <span class="sr-only"><?= I18N::translate('Tab') ?></span>
163                        <?php else : ?>
164                            -
165                        <?php endif ?>
166                    </td>
167                    <td class="text-center text-muted" title="<?= I18N::translate('Sidebar') ?>">
168                        <?php if ($module instanceof ModuleSidebarInterface) : ?>
169                            <?= view('icons/sidebar') ?>
170                            <span class="sr-only"><?= I18N::translate('Sidebar') ?></span>
171                        <?php else : ?>
172                            -
173                        <?php endif ?>
174                    </td>
175                    <td class="text-center text-muted">
176                        <?php if ($module instanceof ModuleBlockInterface) : ?>
177                            <?php if ($module->isUserBlock()) : ?>
178                                <span title="<?= I18N::translate('My page') ?>">
179                                    <?= view('icons/block-user') ?>
180                                </span>
181                                <span class="sr-only">
182                                    <?= I18N::translate('My page') ?>
183                                </span>
184                            <?php endif ?>
185
186                            <?php if ($module->isTreeBlock()) : ?>
187                                <span title="<?= I18N::translate('Home page') ?>">
188                                    <?= view('icons/block-tree') ?>
189                                </span>
190                                <span class="sr-only">
191                                    <?= I18N::translate('Home page') ?>
192                                </span>
193                            <?php endif ?>
194                        <?php else : ?>
195                            -
196                        <?php endif ?>
197                    </td>
198                    <td class="text-center text-muted" title="<?= I18N::translate('Chart') ?>">
199                        <?php if ($module instanceof ModuleChartInterface) : ?>
200                            <?= view('icons/chart') ?>
201                            <span class="sr-only"><?= I18N::translate('Chart') ?></span>
202                        <?php else : ?>
203                            -
204                        <?php endif ?>
205                    </td>
206                    <td class="text-center text-muted" title="<?= I18N::translate('List') ?>">
207                        <?php if ($module instanceof ModuleListInterface) : ?>
208                            <?= view('icons/list') ?>
209                            <span class="sr-only"><?= I18N::translate('List') ?></span>
210                        <?php else : ?>
211                            -
212                        <?php endif ?>
213                    </td>
214                    <td class="text-center text-muted" title="<?= I18N::translate('Report') ?>">
215                        <?php if ($module instanceof ModuleReportInterface) : ?>
216                            <?= view('icons/report') ?>
217                            <span class="sr-only"><?= I18N::translate('Report') ?></span>
218                        <?php else : ?>
219                            -
220                        <?php endif ?>
221                    </td>
222                    <td class="text-center text-muted" title="<?= I18N::translate('Footer') ?>">
223                        <?php if ($module instanceof ModuleFooterInterface) : ?>
224                            <?= view('icons/footer') ?>
225                            <span class="sr-only"><?= I18N::translate('Footer') ?></span>
226                        <?php else : ?>
227                            -
228                        <?php endif ?>
229                    </td>
230                    <td class="text-center text-muted" title="<?= I18N::translate('Tracking and analytics') ?>">
231                        <?php if ($module instanceof ModuleAnalyticsInterface) : ?>
232                            <?= view('icons/analytics') ?>
233                            <span class="sr-only"><?= I18N::translate('Tracking and analytics') ?></span>
234                        <?php else : ?>
235                            -
236                        <?php endif ?>
237                    </td>
238                    <td class="text-center text-muted" title="<?= I18N::translate('Historic events') ?>">
239                        <?php if ($module instanceof ModuleHistoricEventsInterface) : ?>
240                            <?= view('icons/history') ?>
241                            <span class="sr-only"><?= I18N::translate('Historic events') ?></span>
242                        <?php else : ?>
243                            -
244                        <?php endif ?>
245                    </td>
246                    <td class="text-center text-muted" title="<?= I18N::translate('Theme') ?>">
247                        <?php if ($module instanceof ModuleThemeInterface) : ?>
248                            <?= view('icons/theme') ?>
249                            <span class="sr-only"><?= I18N::translate('Theme') ?></span>
250                        <?php else : ?>
251                            -
252                        <?php endif ?>
253                    </td>
254                    <td class="text-center text-muted" title="<?= I18N::translate('Language') ?>">
255                        <?php if ($module instanceof ModuleLanguageInterface) : ?>
256                            <?= view('icons/language') ?>
257                            <span class="sr-only"><?= I18N::translate('Language') ?></span>
258                        <?php else : ?>
259                            -
260                        <?php endif ?>
261                    </td>
262                </tr>
263            <?php endforeach ?>
264        </tbody>
265    </table>
266    <button class="btn btn-primary" type="submit">
267        <?= view('icons/save') ?>
268        <?= I18N::translate('save') ?></button>
269</form>
270
271<?php View::push('javascript') ?>
272<script>
273  'use strict';
274
275  $(".table-module-administration").dataTable({<?= I18N::datatablesI18N() ?>});
276</script>
277<?php View::endpush() ?>
278