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