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