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