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