1<?php 2 3use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 4use Fisharebest\Webtrees\Http\RequestHandlers\ModuleDeleteSettings; 5use Fisharebest\Webtrees\Http\RequestHandlers\ModulesAllAction; 6use Fisharebest\Webtrees\I18N; 7use Fisharebest\Webtrees\Module\ModuleAnalyticsInterface; 8use Fisharebest\Webtrees\Module\ModuleBlockInterface; 9use Fisharebest\Webtrees\Module\ModuleChartInterface; 10use Fisharebest\Webtrees\Module\ModuleConfigInterface; 11use Fisharebest\Webtrees\Module\ModuleCustomInterface; 12use Fisharebest\Webtrees\Module\ModuleExternalUrlInterface; 13use Fisharebest\Webtrees\Module\ModuleFooterInterface; 14use Fisharebest\Webtrees\Module\ModuleHistoricEventsInterface; 15use Fisharebest\Webtrees\Module\ModuleInterface; 16use Fisharebest\Webtrees\Module\ModuleLanguageInterface; 17use Fisharebest\Webtrees\Module\ModuleListInterface; 18use Fisharebest\Webtrees\Module\ModuleMenuInterface; 19use Fisharebest\Webtrees\Module\ModuleReportInterface; 20use Fisharebest\Webtrees\Module\ModuleSidebarInterface; 21use Fisharebest\Webtrees\Module\ModuleTabInterface; 22use Fisharebest\Webtrees\Module\ModuleThemeInterface; 23use Fisharebest\Webtrees\View; 24use Illuminate\Support\Collection; 25 26/** 27 * @var Collection<string> $deleted_modules 28 * @var Collection<ModuleInterface> $modules 29 * @var string $title 30 */ 31 32?> 33 34<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), $title]]) ?> 35 36<h1><?= $title ?></h1> 37 38<?php foreach ($deleted_modules as $module_name) : ?> 39 <div class="alert alert-warning" role="alert"> 40 <form method="post" action="<?= e(route(ModuleDeleteSettings::class)) ?>"> 41 <?= csrf_field() ?> 42 <input type="hidden" name="module_name" value="<?= $module_name ?>"> 43 <?= I18N::translate('Preferences exist for the module “%s”, but this module no longer exists.', $module_name) ?> 44 <button type="submit" class="btn btn-secondary"> 45 <?= I18N::translate('Delete the preferences for this module.') ?> 46 </button> 47 </form> 48 </div> 49<?php endforeach ?> 50 51<form method="post" action="<?= e(route(ModulesAllAction::class)) ?>"> 52 <?= csrf_field() ?> 53 54 <table class="table table-bordered table-hover table-sm table-module-administration" 55 <?= view('lists/datatables-attributes') ?> 56 data-info="false" 57 data-paging="false" 58 data-filter="false" 59 > 60 <caption class="visually-hidden"> 61 <?= I18N::translate('Module administration') ?> 62 </caption> 63 <thead> 64 <tr> 65 <th> 66 <?= I18N::translate('Module') ?> 67 </th> 68 <th> 69 <?= I18N::translate('Enabled') ?> 70 </th> 71 <th data-orderable="false"> 72 <?= I18N::translate('Description') ?> 73 </th> 74 <th title="<?= I18N::translate('Preferences') ?>"> 75 <?= view('icons/preferences') ?> 76 <span class="visually-hidden"><?= I18N::translate('Preferences') ?></span> 77 </th> 78 <th title="<?= I18N::translate('Menus') ?>"> 79 <?= view('icons/menu') ?> 80 <span class="visually-hidden"><?= I18N::translate('Menus') ?></span> 81 </th> 82 <th title="<?= I18N::translate('Tabs') ?>"> 83 <?= view('icons/tab') ?> 84 <span class="visually-hidden"><?= I18N::translate('Tabs') ?></span> 85 </th> 86 <th title="<?= I18N::translate('Sidebars') ?>"> 87 <?= view('icons/sidebar') ?> 88 <span class="visually-hidden"><?= I18N::translate('Sidebars') ?></span> 89 </th> 90 <th title="<?= I18N::translate('Blocks') ?>"> 91 <?= view('icons/block') ?> 92 <span class="visually-hidden"><?= I18N::translate('Blocks') ?></span> 93 </th> 94 <th title="<?= I18N::translate('Charts') ?>"> 95 <?= view('icons/chart') ?> 96 <span class="visually-hidden"><?= I18N::translate('Charts') ?></span> 97 </th> 98 <th title="<?= I18N::translate('Lists') ?>"> 99 <?= view('icons/list') ?> 100 <span class="visually-hidden"><?= I18N::translate('Lists') ?></span> 101 </th> 102 <th title="<?= I18N::translate('Reports') ?>"> 103 <?= view('icons/report') ?> 104 <span class="visually-hidden"><?= I18N::translate('Reports') ?></span> 105 </th> 106 <th title="<?= I18N::translate('Footers') ?>"> 107 <?= view('icons/footer') ?> 108 <span class="visually-hidden"><?= I18N::translate('Footers') ?></span> 109 </th> 110 <th title="<?= I18N::translate('Tracking and analytics') ?>"> 111 <?= view('icons/analytics') ?> 112 <span class="visually-hidden"><?= I18N::translate('Tracking and analytics') ?></span> 113 </th> 114 <th title="<?= I18N::translate('Historic events') ?>"> 115 <?= view('icons/history') ?> 116 <span class="visually-hidden"><?= I18N::translate('Historic events') ?></span> 117 </th> 118 <th title="<?= I18N::translate('Themes') ?>"> 119 <?= view('icons/theme') ?> 120 <span class="visually-hidden"><?= I18N::translate('Themes') ?></span> 121 </th> 122 <th title="<?= I18N::translate('Languages') ?>"> 123 <?= view('icons/language') ?> 124 <span class="visually-hidden"><?= I18N::translate('Languages') ?></span> 125 </th> 126 </tr> 127 </thead> 128 129 <tbody> 130 <?php foreach ($modules as $module) : ?> 131 <tr> 132 <th scope="row" dir="auto"> 133 <?= $module->title() ?> 134 </th> 135 <td class="text-center" data-sort="<?= $module->isEnabled() ?>"> 136 <?= view('components/checkbox', ['label' => '', 'name' => 'status-' . $module->name(), 'checked' => $module->isEnabled()]) ?> 137 </td> 138 <td> 139 <?= $module->description() ?> 140 <?php if ($module instanceof ModuleCustomInterface) : ?> 141 <?= view('admin/custom-module-info', ['module' => $module]) ?> 142 <?php endif ?> 143 <?php if ($module instanceof ModuleExternalUrlInterface) : ?> 144 <?= view('admin/external-module-info', ['module' => $module]) ?> 145 <?php endif ?> 146 </td> 147 <td class="text-center text-muted" title="<?= I18N::translate('Preferences') ?>"> 148 <?php if ($module instanceof ModuleConfigInterface) : ?> 149 <?php if ($module->isEnabled()) : ?> 150 <a href="<?= e($module->getConfigLink()) ?>" title="<?= I18N::translate('Preferences') ?>"> 151 <?= view('icons/preferences') ?> 152 <span class="visually-hidden"> 153 <?= I18N::translate('Preferences') ?> 154 </span> 155 </a> 156 <?php else : ?> 157 <?= view('icons/preferences') ?> 158 <?php endif ?> 159 <?php endif ?> 160 </td> 161 <td class="text-center text-muted" title="<?= I18N::translate('Menu') ?>"> 162 <?php if ($module instanceof ModuleMenuInterface) : ?> 163 <?= view('icons/menu') ?> 164 <span class="visually-hidden"><?= I18N::translate('Menu') ?></span> 165 <?php else : ?> 166 - 167 <?php endif ?> 168 </td> 169 <td class="text-center text-muted" title="<?= I18N::translate('Tab') ?>"> 170 <?php if ($module instanceof ModuleTabInterface) : ?> 171 <?= view('icons/tab') ?> 172 <span class="visually-hidden"><?= I18N::translate('Tab') ?></span> 173 <?php else : ?> 174 - 175 <?php endif ?> 176 </td> 177 <td class="text-center text-muted" title="<?= I18N::translate('Sidebar') ?>"> 178 <?php if ($module instanceof ModuleSidebarInterface) : ?> 179 <?= view('icons/sidebar') ?> 180 <span class="visually-hidden"><?= I18N::translate('Sidebar') ?></span> 181 <?php else : ?> 182 - 183 <?php endif ?> 184 </td> 185 <td class="text-center text-muted"> 186 <?php if ($module instanceof ModuleBlockInterface) : ?> 187 <?php if ($module->isUserBlock()) : ?> 188 <span title="<?= I18N::translate('My page') ?>"> 189 <?= view('icons/block-user') ?> 190 </span> 191 <span class="visually-hidden"> 192 <?= I18N::translate('My page') ?> 193 </span> 194 <?php endif ?> 195 196 <?php if ($module->isTreeBlock()) : ?> 197 <span title="<?= I18N::translate('Home page') ?>"> 198 <?= view('icons/block-tree') ?> 199 </span> 200 <span class="visually-hidden"> 201 <?= I18N::translate('Home page') ?> 202 </span> 203 <?php endif ?> 204 <?php else : ?> 205 - 206 <?php endif ?> 207 </td> 208 <td class="text-center text-muted" title="<?= I18N::translate('Chart') ?>"> 209 <?php if ($module instanceof ModuleChartInterface) : ?> 210 <?= view('icons/chart') ?> 211 <span class="visually-hidden"><?= I18N::translate('Chart') ?></span> 212 <?php else : ?> 213 - 214 <?php endif ?> 215 </td> 216 <td class="text-center text-muted" title="<?= I18N::translate('List') ?>"> 217 <?php if ($module instanceof ModuleListInterface) : ?> 218 <?= view('icons/list') ?> 219 <span class="visually-hidden"><?= I18N::translate('List') ?></span> 220 <?php else : ?> 221 - 222 <?php endif ?> 223 </td> 224 <td class="text-center text-muted" title="<?= I18N::translate('Report') ?>"> 225 <?php if ($module instanceof ModuleReportInterface) : ?> 226 <?= view('icons/report') ?> 227 <span class="visually-hidden"><?= I18N::translate('Report') ?></span> 228 <?php else : ?> 229 - 230 <?php endif ?> 231 </td> 232 <td class="text-center text-muted" title="<?= I18N::translate('Footer') ?>"> 233 <?php if ($module instanceof ModuleFooterInterface) : ?> 234 <?= view('icons/footer') ?> 235 <span class="visually-hidden"><?= I18N::translate('Footer') ?></span> 236 <?php else : ?> 237 - 238 <?php endif ?> 239 </td> 240 <td class="text-center text-muted" title="<?= I18N::translate('Tracking and analytics') ?>"> 241 <?php if ($module instanceof ModuleAnalyticsInterface) : ?> 242 <?= view('icons/analytics') ?> 243 <span class="visually-hidden"><?= I18N::translate('Tracking and analytics') ?></span> 244 <?php else : ?> 245 - 246 <?php endif ?> 247 </td> 248 <td class="text-center text-muted" title="<?= I18N::translate('Historic events') ?>"> 249 <?php if ($module instanceof ModuleHistoricEventsInterface) : ?> 250 <?= view('icons/history') ?> 251 <span class="visually-hidden"><?= I18N::translate('Historic events') ?></span> 252 <?php else : ?> 253 - 254 <?php endif ?> 255 </td> 256 <td class="text-center text-muted" title="<?= I18N::translate('Theme') ?>"> 257 <?php if ($module instanceof ModuleThemeInterface) : ?> 258 <?= view('icons/theme') ?> 259 <span class="visually-hidden"><?= I18N::translate('Theme') ?></span> 260 <?php else : ?> 261 - 262 <?php endif ?> 263 </td> 264 <td class="text-center text-muted" title="<?= I18N::translate('Language') ?>"> 265 <?php if ($module instanceof ModuleLanguageInterface) : ?> 266 <?= view('icons/language') ?> 267 <span class="visually-hidden"><?= I18N::translate('Language') ?></span> 268 <?php else : ?> 269 - 270 <?php endif ?> 271 </td> 272 </tr> 273 <?php endforeach ?> 274 </tbody> 275 </table> 276 <button class="btn btn-primary" type="submit"> 277 <?= view('icons/save') ?> 278 <?= I18N::translate('save') ?></button> 279</form> 280 281<?php View::push('javascript') ?> 282<script> 283 'use strict'; 284 285 $(".table-module-administration").dataTable(); 286</script> 287<?php View::endpush() ?> 288