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