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