xref: /webtrees/resources/views/admin/modules.phtml (revision 9f667ff2169dfca16c3d1c0ebb87d36da533186b)
10c0910bfSGreg Roach<?php
2dd6b2bfcSGreg Roach
30c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
4*9f667ff2SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ModuleDeleteSettings;
5*9f667ff2SGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ModulesAllAction;
60c0910bfSGreg Roachuse Fisharebest\Webtrees\I18N;
70c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleAnalyticsInterface;
80c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleBlockInterface;
90c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleChartInterface;
100c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleConfigInterface;
110c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleCustomInterface;
120c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleExternalUrlInterface;
130c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleFooterInterface;
140c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleHistoricEventsInterface;
15*9f667ff2SGreg Roachuse Fisharebest\Webtrees\Module\ModuleInterface;
160c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleLanguageInterface;
170c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleListInterface;
180c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleMenuInterface;
190c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleReportInterface;
200c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleSidebarInterface;
210c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleTabInterface;
220c0910bfSGreg Roachuse Fisharebest\Webtrees\Module\ModuleThemeInterface;
230c0910bfSGreg Roachuse Fisharebest\Webtrees\View;
24*9f667ff2SGreg Roachuse Illuminate\Support\Collection;
25*9f667ff2SGreg Roach
26*9f667ff2SGreg Roach/**
27*9f667ff2SGreg Roach * @var Collection<string>          $deleted_modules
28*9f667ff2SGreg Roach * @var Collection<ModuleInterface> $modules
29*9f667ff2SGreg Roach * @var string                      $title
30*9f667ff2SGreg Roach */
310c0910bfSGreg Roach
320c0910bfSGreg Roach?>
330c0910bfSGreg Roach
340c0910bfSGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?>
35dd6b2bfcSGreg Roach
36dd6b2bfcSGreg Roach<h1><?= $title ?></h1>
37dd6b2bfcSGreg Roach
38dd6b2bfcSGreg Roach<?php foreach ($deleted_modules as $module_name) : ?>
39dd6b2bfcSGreg Roach    <div class="alert alert-warning" role="alert">
40*9f667ff2SGreg Roach        <form method="post" action="<?= e(route(ModuleDeleteSettings::class)) ?>" class="form-inline">
41dd6b2bfcSGreg Roach            <?= csrf_field() ?>
42dd6b2bfcSGreg Roach            <input type="hidden" name="module_name" value="<?= $module_name ?>">
43dd6b2bfcSGreg Roach            <?= I18N::translate('Preferences exist for the module “%s”, but this module no longer exists.', $module_name) ?>
4497c22350SGreg Roach            <button type="submit" class="btn btn-secondary">
45dd6b2bfcSGreg Roach                <?= I18N::translate('Delete the preferences for this module.') ?>
46dd6b2bfcSGreg Roach            </button>
47dd6b2bfcSGreg Roach        </form>
48dd6b2bfcSGreg Roach    </div>
49dd6b2bfcSGreg Roach<?php endforeach ?>
50dd6b2bfcSGreg Roach
51*9f667ff2SGreg Roach<form method="post" action="<?= e(route(ModulesAllAction::class)) ?>">
52dd6b2bfcSGreg Roach    <?= csrf_field() ?>
53*9f667ff2SGreg Roach
54b6c326d8SGreg Roach    <table class="table table-bordered table-hover table-sm table-module-administration"
55b6c326d8SGreg Roach        <?= view('lists/datatables-attributes') ?>
56b6c326d8SGreg Roach        data-info="false"
57b6c326d8SGreg Roach        data-paging="false"
58b6c326d8SGreg Roach        data-filter="false"
59b6c326d8SGreg Roach    >
60dd6b2bfcSGreg Roach        <caption class="sr-only">
61dd6b2bfcSGreg Roach            <?= I18N::translate('Module administration') ?>
62dd6b2bfcSGreg Roach        </caption>
63dd6b2bfcSGreg Roach        <thead>
64dd6b2bfcSGreg Roach            <tr>
65dd6b2bfcSGreg Roach                <th>
66dd6b2bfcSGreg Roach                    <?= I18N::translate('Module') ?>
67dd6b2bfcSGreg Roach                </th>
68dd6b2bfcSGreg Roach                <th>
69dd6b2bfcSGreg Roach                    <?= I18N::translate('Enabled') ?>
70dd6b2bfcSGreg Roach                </th>
710cb66f86SGreg Roach                <th data-orderable="false">
72dd6b2bfcSGreg Roach                    <?= I18N::translate('Description') ?>
73dd6b2bfcSGreg Roach                </th>
740cb66f86SGreg Roach                <th title="<?= I18N::translate('Preferences') ?>">
750cb66f86SGreg Roach                    <?= view('icons/preferences') ?>
760cb66f86SGreg Roach                    <span class="sr-only"><?= I18N::translate('Preferences') ?></span>
77dd6b2bfcSGreg Roach                </th>
780cb66f86SGreg Roach                <th title="<?= I18N::translate('Menus') ?>">
790cb66f86SGreg Roach                    <?= view('icons/menu') ?>
800cb66f86SGreg Roach                    <span class="sr-only"><?= I18N::translate('Menus') ?></span>
81dd6b2bfcSGreg Roach                </th>
820cb66f86SGreg Roach                <th title="<?= I18N::translate('Tabs') ?>">
830cb66f86SGreg Roach                    <?= view('icons/tab') ?>
840cb66f86SGreg Roach                    <span class="sr-only"><?= I18N::translate('Tabs') ?></span>
85dd6b2bfcSGreg Roach                </th>
860cb66f86SGreg Roach                <th title="<?= I18N::translate('Sidebars') ?>">
870cb66f86SGreg Roach                    <?= view('icons/sidebar') ?>
880cb66f86SGreg Roach                    <span class="sr-only"><?= I18N::translate('Sidebars') ?></span>
89dd6b2bfcSGreg Roach                </th>
900cb66f86SGreg Roach                <th title="<?= I18N::translate('Blocks') ?>">
910cb66f86SGreg Roach                    <?= view('icons/block') ?>
920cb66f86SGreg Roach                    <span class="sr-only"><?= I18N::translate('Blocks') ?></span>
93dd6b2bfcSGreg Roach                </th>
940cb66f86SGreg Roach                <th title="<?= I18N::translate('Charts') ?>">
950cb66f86SGreg Roach                    <?= view('icons/chart') ?>
960cb66f86SGreg Roach                    <span class="sr-only"><?= I18N::translate('Charts') ?></span>
97dd6b2bfcSGreg Roach                </th>
9867992b6aSRichard Cissee                <th title="<?= I18N::translate('Lists') ?>">
9967992b6aSRichard Cissee                    <?= view('icons/list') ?>
10067992b6aSRichard Cissee                    <span class="sr-only"><?= I18N::translate('Lists') ?></span>
10167992b6aSRichard Cissee                </th>
1020cb66f86SGreg Roach                <th title="<?= I18N::translate('Reports') ?>">
1030cb66f86SGreg Roach                    <?= view('icons/report') ?>
1040cb66f86SGreg Roach                    <span class="sr-only"><?= I18N::translate('Reports') ?></span>
105dd6b2bfcSGreg Roach                </th>
10633c34396SGreg Roach                <th title="<?= I18N::translate('Footers') ?>">
10733c34396SGreg Roach                    <?= view('icons/footer') ?>
10833c34396SGreg Roach                    <span class="sr-only"><?= I18N::translate('Footers') ?></span>
10933c34396SGreg Roach                </th>
1109e5cb8c9SGreg Roach                <th title="<?= I18N::translate('Tracking and analytics') ?>">
1119e5cb8c9SGreg Roach                    <?= view('icons/analytics') ?>
1129e5cb8c9SGreg Roach                    <span class="sr-only"><?= I18N::translate('Tracking and analytics') ?></span>
1139e5cb8c9SGreg Roach                </th>
114f3244202SGreg Roach                <th title="<?= I18N::translate('Historic events') ?>">
115f3244202SGreg Roach                    <?= view('icons/history') ?>
116f3244202SGreg Roach                    <span class="sr-only"><?= I18N::translate('Historic events') ?></span>
117f3244202SGreg Roach                </th>
11811eb8581SGreg Roach                <th title="<?= I18N::translate('Themes') ?>">
1190cb66f86SGreg Roach                    <?= view('icons/theme') ?>
1200cb66f86SGreg Roach                    <span class="sr-only"><?= I18N::translate('Themes') ?></span>
121dd6b2bfcSGreg Roach                </th>
12211eb8581SGreg Roach                <th title="<?= I18N::translate('Languages') ?>">
12311eb8581SGreg Roach                    <?= view('icons/language') ?>
12411eb8581SGreg Roach                    <span class="sr-only"><?= I18N::translate('Languages') ?></span>
12511eb8581SGreg Roach                </th>
126dd6b2bfcSGreg Roach            </tr>
127dd6b2bfcSGreg Roach        </thead>
1280cb66f86SGreg Roach
129dd6b2bfcSGreg Roach        <tbody>
13049a243cbSGreg Roach            <?php foreach ($modules as $module) : ?>
131dd6b2bfcSGreg Roach                <tr>
1320cb66f86SGreg Roach                    <th scope="row" dir="auto">
13349a243cbSGreg Roach                        <?= $module->title() ?>
134dd6b2bfcSGreg Roach                    </th>
13549a243cbSGreg Roach                    <td class="text-center" data-sort="<?= $module->isEnabled() ?>">
136b6c326d8SGreg Roach                        <?= view('components/checkbox', ['label' => '', 'name' => 'status-' . $module->name(), 'checked' => $module->isEnabled()]) ?>
137dd6b2bfcSGreg Roach                    </td>
1380cb66f86SGreg Roach                    <td>
13949a243cbSGreg Roach                        <?= $module->description() ?>
1409cad7645SGreg Roach                        <?php if ($module instanceof ModuleCustomInterface) : ?>
1411bfef740SGreg Roach                            <?= view('admin/custom-module-info', ['module' => $module]) ?>
142dd6b2bfcSGreg Roach                        <?php endif ?>
1438e5c5efeSGreg Roach                        <?php if ($module instanceof ModuleExternalUrlInterface) : ?>
1441bfef740SGreg Roach                            <?= view('admin/external-module-info', ['module' => $module]) ?>
1458e5c5efeSGreg Roach                        <?php endif ?>
146dd6b2bfcSGreg Roach                    </td>
1470cb66f86SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Preferences') ?>">
1480cb66f86SGreg Roach                        <?php if ($module instanceof ModuleConfigInterface) : ?>
1498d6560c4SGreg Roach                            <?php if ($module->isEnabled()) : ?>
1500cb66f86SGreg Roach                                <a href="<?= e($module->getConfigLink()) ?>" title="<?= I18N::translate('Preferences') ?>">
1510cb66f86SGreg Roach                                    <?= view('icons/preferences') ?>
1520cb66f86SGreg Roach                                    <span class="sr-only">
1530cb66f86SGreg Roach                                        <?= I18N::translate('Preferences') ?>
1540cb66f86SGreg Roach                                    </span>
1550cb66f86SGreg Roach                                </a>
1568d6560c4SGreg Roach                            <?php else : ?>
1578d6560c4SGreg Roach                                <?= view('icons/preferences') ?>
1588d6560c4SGreg Roach                            <?php endif ?>
1590cb66f86SGreg Roach                        <?php endif ?>
1600cb66f86SGreg Roach                    </td>
1610cb66f86SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Menu') ?>">
162dd6b2bfcSGreg Roach                        <?php if ($module instanceof ModuleMenuInterface) : ?>
163dd6b2bfcSGreg Roach                            <?= view('icons/menu') ?>
164dd6b2bfcSGreg Roach                            <span class="sr-only"><?= I18N::translate('Menu') ?></span>
165dd6b2bfcSGreg Roach                        <?php else : ?>
166dd6b2bfcSGreg Roach                            -
167dd6b2bfcSGreg Roach                        <?php endif ?>
168dd6b2bfcSGreg Roach                    </td>
1690cb66f86SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Tab') ?>">
170dd6b2bfcSGreg Roach                        <?php if ($module instanceof ModuleTabInterface) : ?>
171dd6b2bfcSGreg Roach                            <?= view('icons/tab') ?>
172dd6b2bfcSGreg Roach                            <span class="sr-only"><?= I18N::translate('Tab') ?></span>
1730cb66f86SGreg Roach                        <?php else : ?>
1740cb66f86SGreg Roach                            -
175dd6b2bfcSGreg Roach                        <?php endif ?>
1760cb66f86SGreg Roach                    </td>
1770cb66f86SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Sidebar') ?>">
178dd6b2bfcSGreg Roach                        <?php if ($module instanceof ModuleSidebarInterface) : ?>
179dd6b2bfcSGreg Roach                            <?= view('icons/sidebar') ?>
180dd6b2bfcSGreg Roach                            <span class="sr-only"><?= I18N::translate('Sidebar') ?></span>
1810cb66f86SGreg Roach                        <?php else : ?>
1820cb66f86SGreg Roach                            -
183dd6b2bfcSGreg Roach                        <?php endif ?>
1840cb66f86SGreg Roach                    </td>
1850cb66f86SGreg Roach                    <td class="text-center text-muted">
1860cb66f86SGreg Roach                        <?php if ($module instanceof ModuleBlockInterface) : ?>
1870cb66f86SGreg Roach                            <?php if ($module->isUserBlock()) : ?>
1880cb66f86SGreg Roach                                <span title="<?= I18N::translate('My page') ?>">
189dd6b2bfcSGreg Roach                                    <?= view('icons/block-user') ?>
1900cb66f86SGreg Roach                                </span>
1910cb66f86SGreg Roach                                <span class="sr-only">
1920cb66f86SGreg Roach                                    <?= I18N::translate('My page') ?>
1930cb66f86SGreg Roach                                </span>
194dd6b2bfcSGreg Roach                            <?php endif ?>
1950cb66f86SGreg Roach
1960cb66f86SGreg Roach                            <?php if ($module->isTreeBlock()) : ?>
1970cb66f86SGreg Roach                                <span title="<?= I18N::translate('Home page') ?>">
198dd6b2bfcSGreg Roach                                    <?= view('icons/block-tree') ?>
1990cb66f86SGreg Roach                                </span>
2000cb66f86SGreg Roach                                <span class="sr-only">
2010cb66f86SGreg Roach                                    <?= I18N::translate('Home page') ?>
2020cb66f86SGreg Roach                                </span>
203dd6b2bfcSGreg Roach                            <?php endif ?>
2040cb66f86SGreg Roach                        <?php else : ?>
2050cb66f86SGreg Roach                            -
2060cb66f86SGreg Roach                        <?php endif ?>
2070cb66f86SGreg Roach                    </td>
2080cb66f86SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Chart') ?>">
209dd6b2bfcSGreg Roach                        <?php if ($module instanceof ModuleChartInterface) : ?>
210dd6b2bfcSGreg Roach                            <?= view('icons/chart') ?>
211dd6b2bfcSGreg Roach                            <span class="sr-only"><?= I18N::translate('Chart') ?></span>
2120cb66f86SGreg Roach                        <?php else : ?>
2130cb66f86SGreg Roach                            -
214dd6b2bfcSGreg Roach                        <?php endif ?>
2150cb66f86SGreg Roach                    </td>
21667992b6aSRichard Cissee                    <td class="text-center text-muted" title="<?= I18N::translate('List') ?>">
21767992b6aSRichard Cissee                        <?php if ($module instanceof ModuleListInterface) : ?>
21867992b6aSRichard Cissee                            <?= view('icons/list') ?>
21967992b6aSRichard Cissee                            <span class="sr-only"><?= I18N::translate('List') ?></span>
22067992b6aSRichard Cissee                        <?php else : ?>
22167992b6aSRichard Cissee                            -
22267992b6aSRichard Cissee                        <?php endif ?>
22367992b6aSRichard Cissee                    </td>
2240cb66f86SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Report') ?>">
225dd6b2bfcSGreg Roach                        <?php if ($module instanceof ModuleReportInterface) : ?>
226dd6b2bfcSGreg Roach                            <?= view('icons/report') ?>
227dd6b2bfcSGreg Roach                            <span class="sr-only"><?= I18N::translate('Report') ?></span>
2280cb66f86SGreg Roach                        <?php else : ?>
2290cb66f86SGreg Roach                            -
230dd6b2bfcSGreg Roach                        <?php endif ?>
2310cb66f86SGreg Roach                    </td>
23233c34396SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Footer') ?>">
23333c34396SGreg Roach                        <?php if ($module instanceof ModuleFooterInterface) : ?>
23433c34396SGreg Roach                            <?= view('icons/footer') ?>
23533c34396SGreg Roach                            <span class="sr-only"><?= I18N::translate('Footer') ?></span>
23633c34396SGreg Roach                        <?php else : ?>
23733c34396SGreg Roach                            -
23833c34396SGreg Roach                        <?php endif ?>
23933c34396SGreg Roach                    </td>
2409e5cb8c9SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Tracking and analytics') ?>">
2419e5cb8c9SGreg Roach                        <?php if ($module instanceof ModuleAnalyticsInterface) : ?>
2429e5cb8c9SGreg Roach                            <?= view('icons/analytics') ?>
2439e5cb8c9SGreg Roach                            <span class="sr-only"><?= I18N::translate('Tracking and analytics') ?></span>
2449e5cb8c9SGreg Roach                        <?php else : ?>
2459e5cb8c9SGreg Roach                            -
2469e5cb8c9SGreg Roach                        <?php endif ?>
2479e5cb8c9SGreg Roach                    </td>
248f3244202SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Historic events') ?>">
249f3244202SGreg Roach                        <?php if ($module instanceof ModuleHistoricEventsInterface) : ?>
250f3244202SGreg Roach                            <?= view('icons/history') ?>
251f3244202SGreg Roach                            <span class="sr-only"><?= I18N::translate('Historic events') ?></span>
252f3244202SGreg Roach                        <?php else : ?>
253f3244202SGreg Roach                            -
254f3244202SGreg Roach                        <?php endif ?>
255f3244202SGreg Roach                    </td>
25611eb8581SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Theme') ?>">
257dd6b2bfcSGreg Roach                        <?php if ($module instanceof ModuleThemeInterface) : ?>
258dd6b2bfcSGreg Roach                            <?= view('icons/theme') ?>
259dd6b2bfcSGreg Roach                            <span class="sr-only"><?= I18N::translate('Theme') ?></span>
2600cb66f86SGreg Roach                        <?php else : ?>
2610cb66f86SGreg Roach                            -
262dd6b2bfcSGreg Roach                        <?php endif ?>
263dd6b2bfcSGreg Roach                    </td>
26411eb8581SGreg Roach                    <td class="text-center text-muted" title="<?= I18N::translate('Language') ?>">
26511eb8581SGreg Roach                        <?php if ($module instanceof ModuleLanguageInterface) : ?>
26611eb8581SGreg Roach                            <?= view('icons/language') ?>
26711eb8581SGreg Roach                            <span class="sr-only"><?= I18N::translate('Language') ?></span>
26811eb8581SGreg Roach                        <?php else : ?>
26911eb8581SGreg Roach                            -
27011eb8581SGreg Roach                        <?php endif ?>
27111eb8581SGreg Roach                    </td>
272dd6b2bfcSGreg Roach                </tr>
273dd6b2bfcSGreg Roach            <?php endforeach ?>
274dd6b2bfcSGreg Roach        </tbody>
275dd6b2bfcSGreg Roach    </table>
276dd6b2bfcSGreg Roach    <button class="btn btn-primary" type="submit">
277dd6b2bfcSGreg Roach        <?= view('icons/save') ?>
278dd6b2bfcSGreg Roach        <?= I18N::translate('save') ?></button>
279dd6b2bfcSGreg Roach</form>
280dd6b2bfcSGreg Roach
281dd6b2bfcSGreg Roach<?php View::push('javascript') ?>
282dd6b2bfcSGreg Roach<script>
283dd6b2bfcSGreg Roach  'use strict';
284dd6b2bfcSGreg Roach
285b6c326d8SGreg Roach  $(".table-module-administration").dataTable();
286dd6b2bfcSGreg Roach</script>
287dd6b2bfcSGreg Roach<?php View::endpush() ?>
288