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