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