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