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