1<?php 2 3use Fisharebest\Webtrees\Bootstrap4; 4use Fisharebest\Webtrees\Functions\FunctionsEdit; 5use Fisharebest\Webtrees\I18N; 6use Fisharebest\Webtrees\Module\ModuleConfigInterface; 7use Fisharebest\Webtrees\Module\ModuleCustomInterface; 8use Fisharebest\Webtrees\Module\ModuleExternalUrlInterface; 9use Fisharebest\Webtrees\View; 10 11?> 12 13<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('modules') => I18N::translate('All modules'), $title]]) ?> 14 15<h1><?= $title ?></h1> 16 17<p><?= $description ?></p> 18 19<form method="post"> 20 <?= csrf_field() ?> 21 <table class="table table-bordered wt-table-menu"> 22 <thead> 23 <tr> 24 <th><?= I18N::translate('Module') ?></th> 25 <th class="text-center"><?= I18N::translate('Enabled') ?></th> 26 <?php if ($uses_access) : ?> 27 <th class="text-center"><?= I18N::translate('Access level') ?></th> 28 <?php endif ?> 29 <?php if ($uses_sorting) : ?> 30 <th class="text-center"><?= I18N::translate('Move up') ?></th> 31 <th class="text-center"><?= I18N::translate('Move down') ?></th> 32 <?php endif ?> 33 </tr> 34 </thead> 35 36 <tbody> 37 <?php foreach ($modules as $module_name => $module) : ?> 38 <tr> 39 <th scope="col"> 40 <input type="hidden" name="order[]" value="<?= e($module->name()) ?>"?> 41 <span title="<?= e($module->description()) ?>"> 42 <?= $module->title() ?> 43 </span> 44 <?php if ($module instanceof ModuleConfigInterface && $module->isEnabled()) : ?> 45 <a href="<?= e($module->getConfigLink()) ?>" title="<?= I18N::translate('Preferences') ?>"> 46 <?= view('icons/preferences') ?> 47 <span class="sr-only"> 48 <?= I18N::translate('Preferences') ?> 49 </span> 50 </a> 51 <?php endif ?> 52 <?php if ($module instanceof ModuleCustomInterface) : ?> 53 <?= view('admin/custom-module-info', ['module' => $module]) ?> 54 <?php endif ?> 55 <?php if ($module instanceof ModuleExternalUrlInterface) : ?> 56 <?= view('admin/external-module-info', ['module' => $module]) ?> 57 <?php endif ?> 58 </th> 59 60 <td class="text-center"> 61 <label class="d-block"> 62 <input type="checkbox" name="status-<?= e($module->name()) ?>" id="status-<?= e($module->name()) ?>" <?= $module->isEnabled() ? 'checked' : '' ?>> 63 <span class="sr-only"> 64 <?= I18N::translate('Enabled') ?> 65 </span> 66 </label> 67 </td> 68 69 <?php if ($uses_access) : ?> 70 <td class="text-center"> 71 <div class="modal fade" id="access-level-<?= $module->name() ?>" tabindex="-1" role="dialog"> 72 <div class="modal-dialog" role="document"> 73 <div class="modal-content"> 74 <div class="modal-header"> 75 <h2 class="modal-title"> 76 <?= e($module->title()) ?> – <?= I18N::translate('Access level') ?> 77 </h2> 78 <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 79 <span aria-hidden="true">×</span> 80 </button> 81 </div> 82 <div class="modal-body"> 83 <table class="table table-sm"> 84 <tbody> 85 <?php foreach ($trees as $tree) : ?> 86 <tr> 87 <td> 88 <?= e($tree->title()) ?> 89 </td> 90 <td> 91 <?= Bootstrap4::select(FunctionsEdit::optionsAccessLevels(), $module->accessLevel($tree, $interface), ['name' => 'access-' . $module->name() . '-' . $tree->id()]) ?> 92 </td> 93 </tr> 94 <?php endforeach ?> 95 </tbody> 96 </table> 97 </div> 98 <div class="modal-footer"> 99 <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button> 100 </div> 101 </div> 102 </div> 103 </div> 104 105 <button type="button" class="btn btn-link" data-toggle="modal" data-target="#access-level-<?= $module->name() ?>"> 106 <?= view('icons/edit') ?> 107 <span class="sr-only"> 108 <?= I18N::translate('edit') ?> 109 </span> 110 </button> 111 </td> 112 <?php endif ?> 113 114 <?php if ($uses_sorting) : ?> 115 <td class="move up text-center"> 116 <a href="#" title="<?= I18N::translate('Move up') ?>"> 117 <?= view('icons/arrow-up') ?> 118 </a> 119 </td> 120 121 <td class="move down text-center"> 122 <a href="#" title="<?= I18N::translate('Move down') ?>"> 123 <?= view('icons/arrow-down') ?> 124 </a> 125 </td> 126 <?php endif ?> 127 </tr> 128 <?php endforeach ?> 129 </tbody> 130 </table> 131 132 <button class="btn btn-primary" type="submit"> 133 <?= view('icons/save') ?> 134 <?= I18N::translate('save') ?> 135 </button> 136 137 <a class="btn btn-secondary" href="<?= e(route('admin-control-panel')) ?>"> 138 <?= view('icons/cancel') ?> 139 <?= I18N::translate('cancel') ?> 140 </a> 141</form> 142 143 144<?php View::push('javascript') ?> 145<script> 146 $('.wt-table-menu td.move').click(function() { 147 var row = $(this).closest('tr'); 148 149 if ($(this).hasClass('up')) { 150 row.prev().before(row); 151 } else { 152 row.next().after(row); 153 } 154 155 return false; 156 }); 157</script> 158<?php View::endpush() ?> 159 160<?php View::push('styles') ?> 161<style> 162 .wt-table-menu tr:first-child .wt-icon-arrow-up { 163 display:none; 164 } 165 .wt-table-menu tr:last-child .wt-icon-arrow-down { 166 display:none; 167 } 168</style> 169<?php View::endpush() ?> 170