summaryrefslogtreecommitdiff
path: root/resources/views/admin/modules.phtml
blob: 876da7802b69b45601382ad95119ccfdf790e214 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<?php use Fisharebest\Webtrees\I18N; ?>
<?php use Fisharebest\Webtrees\Module\ModuleAnalyticsInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleBlockInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleChartInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleConfigInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleCustomInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleExternalUrlInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleFooterInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleHistoricEventsInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleLanguageInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleListInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleMenuInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleReportInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleSidebarInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleTabInterface; ?>
<?php use Fisharebest\Webtrees\Module\ModuleThemeInterface; ?>
<?php use Fisharebest\Webtrees\View; ?>

<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), $title]]) ?>

<h1><?= $title ?></h1>

<?php foreach ($deleted_modules as $module_name) : ?>
    <div class="alert alert-warning" role="alert">
        <form method="post" action="<?= e(route('delete-module-settings')) ?>" class="form-inline">
            <?= csrf_field() ?>
            <input type="hidden" name="module_name" value="<?= $module_name ?>">
            <?= I18N::translate('Preferences exist for the module “%s”, but this module no longer exists.', $module_name) ?>
            <button type="submit" class="btn btn-secondary">
                <?= I18N::translate('Delete the preferences for this module.') ?>
            </button>
        </form>
    </div>
<?php endforeach ?>

<form method="post">
    <input type="hidden" name="route" value="admin-update-module-status">
    <?= csrf_field() ?>
    <table class="table table-bordered table-hover table-sm table-module-administration"
        <?= view('lists/datatables-attributes') ?>
        data-info="false"
        data-paging="false"
        data-filter="false"
    >
        <caption class="sr-only">
            <?= I18N::translate('Module administration') ?>
        </caption>
        <thead>
            <tr>
                <th>
                    <?= I18N::translate('Module') ?>
                </th>
                <th>
                    <?= I18N::translate('Enabled') ?>
                </th>
                <th data-orderable="false">
                    <?= I18N::translate('Description') ?>
                </th>
                <th title="<?= I18N::translate('Preferences') ?>">
                    <?= view('icons/preferences') ?>
                    <span class="sr-only"><?= I18N::translate('Preferences') ?></span>
                </th>
                <th title="<?= I18N::translate('Menus') ?>">
                    <?= view('icons/menu') ?>
                    <span class="sr-only"><?= I18N::translate('Menus') ?></span>
                </th>
                <th title="<?= I18N::translate('Tabs') ?>">
                    <?= view('icons/tab') ?>
                    <span class="sr-only"><?= I18N::translate('Tabs') ?></span>
                </th>
                <th title="<?= I18N::translate('Sidebars') ?>">
                    <?= view('icons/sidebar') ?>
                    <span class="sr-only"><?= I18N::translate('Sidebars') ?></span>
                </th>
                <th title="<?= I18N::translate('Blocks') ?>">
                    <?= view('icons/block') ?>
                    <span class="sr-only"><?= I18N::translate('Blocks') ?></span>
                </th>
                <th title="<?= I18N::translate('Charts') ?>">
                    <?= view('icons/chart') ?>
                    <span class="sr-only"><?= I18N::translate('Charts') ?></span>
                </th>
                <th title="<?= I18N::translate('Lists') ?>">
                    <?= view('icons/list') ?>
                    <span class="sr-only"><?= I18N::translate('Lists') ?></span>
                </th>
                <th title="<?= I18N::translate('Reports') ?>">
                    <?= view('icons/report') ?>
                    <span class="sr-only"><?= I18N::translate('Reports') ?></span>
                </th>
                <th title="<?= I18N::translate('Footers') ?>">
                    <?= view('icons/footer') ?>
                    <span class="sr-only"><?= I18N::translate('Footers') ?></span>
                </th>
                <th title="<?= I18N::translate('Tracking and analytics') ?>">
                    <?= view('icons/analytics') ?>
                    <span class="sr-only"><?= I18N::translate('Tracking and analytics') ?></span>
                </th>
                <th title="<?= I18N::translate('Historic events') ?>">
                    <?= view('icons/history') ?>
                    <span class="sr-only"><?= I18N::translate('Historic events') ?></span>
                </th>
                <th title="<?= I18N::translate('Themes') ?>">
                    <?= view('icons/theme') ?>
                    <span class="sr-only"><?= I18N::translate('Themes') ?></span>
                </th>
                <th title="<?= I18N::translate('Languages') ?>">
                    <?= view('icons/language') ?>
                    <span class="sr-only"><?= I18N::translate('Languages') ?></span>
                </th>
            </tr>
        </thead>

        <tbody>
            <?php foreach ($modules as $module) : ?>
                <tr>
                    <th scope="row" dir="auto">
                        <?= $module->title() ?>
                    </th>
                    <td class="text-center" data-sort="<?= $module->isEnabled() ?>">
                        <?= view('components/checkbox', ['label' => '', 'name' => 'status-' . $module->name(), 'checked' => $module->isEnabled()]) ?>
                    </td>
                    <td>
                        <?= $module->description() ?>
                        <?php if ($module instanceof ModuleCustomInterface) : ?>
                            <?= view('admin/custom-module-info', ['module' => $module]) ?>
                        <?php endif ?>
                        <?php if ($module instanceof ModuleExternalUrlInterface) : ?>
                            <?= view('admin/external-module-info', ['module' => $module]) ?>
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Preferences') ?>">
                        <?php if ($module instanceof ModuleConfigInterface) : ?>
                            <?php if ($module->isEnabled()) : ?>
                                <a href="<?= e($module->getConfigLink()) ?>" title="<?= I18N::translate('Preferences') ?>">
                                    <?= view('icons/preferences') ?>
                                    <span class="sr-only">
                                        <?= I18N::translate('Preferences') ?>
                                    </span>
                                </a>
                            <?php else : ?>
                                <?= view('icons/preferences') ?>
                            <?php endif ?>
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Menu') ?>">
                        <?php if ($module instanceof ModuleMenuInterface) : ?>
                            <?= view('icons/menu') ?>
                            <span class="sr-only"><?= I18N::translate('Menu') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Tab') ?>">
                        <?php if ($module instanceof ModuleTabInterface) : ?>
                            <?= view('icons/tab') ?>
                            <span class="sr-only"><?= I18N::translate('Tab') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Sidebar') ?>">
                        <?php if ($module instanceof ModuleSidebarInterface) : ?>
                            <?= view('icons/sidebar') ?>
                            <span class="sr-only"><?= I18N::translate('Sidebar') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted">
                        <?php if ($module instanceof ModuleBlockInterface) : ?>
                            <?php if ($module->isUserBlock()) : ?>
                                <span title="<?= I18N::translate('My page') ?>">
                                    <?= view('icons/block-user') ?>
                                </span>
                                <span class="sr-only">
                                    <?= I18N::translate('My page') ?>
                                </span>
                            <?php endif ?>

                            <?php if ($module->isTreeBlock()) : ?>
                                <span title="<?= I18N::translate('Home page') ?>">
                                    <?= view('icons/block-tree') ?>
                                </span>
                                <span class="sr-only">
                                    <?= I18N::translate('Home page') ?>
                                </span>
                            <?php endif ?>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Chart') ?>">
                        <?php if ($module instanceof ModuleChartInterface) : ?>
                            <?= view('icons/chart') ?>
                            <span class="sr-only"><?= I18N::translate('Chart') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('List') ?>">
                        <?php if ($module instanceof ModuleListInterface) : ?>
                            <?= view('icons/list') ?>
                            <span class="sr-only"><?= I18N::translate('List') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Report') ?>">
                        <?php if ($module instanceof ModuleReportInterface) : ?>
                            <?= view('icons/report') ?>
                            <span class="sr-only"><?= I18N::translate('Report') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Footer') ?>">
                        <?php if ($module instanceof ModuleFooterInterface) : ?>
                            <?= view('icons/footer') ?>
                            <span class="sr-only"><?= I18N::translate('Footer') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Tracking and analytics') ?>">
                        <?php if ($module instanceof ModuleAnalyticsInterface) : ?>
                            <?= view('icons/analytics') ?>
                            <span class="sr-only"><?= I18N::translate('Tracking and analytics') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Historic events') ?>">
                        <?php if ($module instanceof ModuleHistoricEventsInterface) : ?>
                            <?= view('icons/history') ?>
                            <span class="sr-only"><?= I18N::translate('Historic events') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Theme') ?>">
                        <?php if ($module instanceof ModuleThemeInterface) : ?>
                            <?= view('icons/theme') ?>
                            <span class="sr-only"><?= I18N::translate('Theme') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                    <td class="text-center text-muted" title="<?= I18N::translate('Language') ?>">
                        <?php if ($module instanceof ModuleLanguageInterface) : ?>
                            <?= view('icons/language') ?>
                            <span class="sr-only"><?= I18N::translate('Language') ?></span>
                        <?php else : ?>
                            -
                        <?php endif ?>
                    </td>
                </tr>
            <?php endforeach ?>
        </tbody>
    </table>
    <button class="btn btn-primary" type="submit">
        <?= view('icons/save') ?>
        <?= I18N::translate('save') ?></button>
</form>

<?php View::push('javascript') ?>
<script>
  'use strict';

  $(".table-module-administration").dataTable();
</script>
<?php View::endpush() ?>