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