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