11bfef740SGreg Roach<?php 21bfef740SGreg Roach 31bfef740SGreg Roachuse Fisharebest\Webtrees\Functions\FunctionsEdit; 40c0910bfSGreg Roachuse Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel; 51bfef740SGreg Roachuse Fisharebest\Webtrees\I18N; 61bfef740SGreg Roachuse Fisharebest\Webtrees\Module\ModuleConfigInterface; 71bfef740SGreg Roachuse Fisharebest\Webtrees\Module\ModuleCustomInterface; 81bfef740SGreg Roachuse Fisharebest\Webtrees\Module\ModuleExternalUrlInterface; 91bfef740SGreg Roachuse Fisharebest\Webtrees\View; 101bfef740SGreg Roach 111bfef740SGreg Roach?> 120cb66f86SGreg Roach 130c0910bfSGreg Roach<?= view('components/breadcrumbs', ['links' => [route(ControlPanel::class) => I18N::translate('Control panel'), route('modules') => I18N::translate('All modules'), $title]]) ?> 140cb66f86SGreg Roach 150cb66f86SGreg Roach<h1><?= $title ?></h1> 160cb66f86SGreg Roach 178e5c5efeSGreg Roach<p><?= $description ?></p> 188e5c5efeSGreg Roach 190cb66f86SGreg Roach<form method="post"> 200cb66f86SGreg Roach <?= csrf_field() ?> 210cb66f86SGreg Roach <table class="table table-bordered wt-table-menu"> 220cb66f86SGreg Roach <thead> 230cb66f86SGreg Roach <tr> 24510d3f2fSGreg Roach <th><?= I18N::translate('Module') ?></th> 250cb66f86SGreg Roach <th class="text-center"><?= I18N::translate('Enabled') ?></th> 2633c34396SGreg Roach <?php if ($uses_access) : ?> 27745968f0SGreg Roach <th colspan="2" class="text-center"><?= I18N::translate('Access level') ?></th> 2833c34396SGreg Roach <?php endif ?> 2933c34396SGreg Roach <?php if ($uses_sorting) : ?> 300cb66f86SGreg Roach <th class="text-center"><?= I18N::translate('Move up') ?></th> 310cb66f86SGreg Roach <th class="text-center"><?= I18N::translate('Move down') ?></th> 320cb66f86SGreg Roach <?php endif ?> 330cb66f86SGreg Roach </tr> 340cb66f86SGreg Roach </thead> 350cb66f86SGreg Roach 360cb66f86SGreg Roach <tbody> 370cb66f86SGreg Roach <?php foreach ($modules as $module_name => $module) : ?> 380cb66f86SGreg Roach <tr> 390cb66f86SGreg Roach <th scope="col"> 40*0f180719SGreg Roach <input type="hidden" name="order[]" value="<?= e($module->name()) ?>"> 4133c34396SGreg Roach <span title="<?= e($module->description()) ?>"> 420cb66f86SGreg Roach <?= $module->title() ?> 4333c34396SGreg Roach </span> 446b32f095SGreg Roach <?php if ($module instanceof ModuleConfigInterface && $module->isEnabled()) : ?> 450cb66f86SGreg Roach <a href="<?= e($module->getConfigLink()) ?>" title="<?= I18N::translate('Preferences') ?>"> 460cb66f86SGreg Roach <?= view('icons/preferences') ?> 470cb66f86SGreg Roach <span class="sr-only"> 480cb66f86SGreg Roach <?= I18N::translate('Preferences') ?> 490cb66f86SGreg Roach </span> 500cb66f86SGreg Roach </a> 510cb66f86SGreg Roach <?php endif ?> 521bfef740SGreg Roach <?php if ($module instanceof ModuleCustomInterface) : ?> 531bfef740SGreg Roach <?= view('admin/custom-module-info', ['module' => $module]) ?> 541bfef740SGreg Roach <?php endif ?> 558e5c5efeSGreg Roach <?php if ($module instanceof ModuleExternalUrlInterface) : ?> 561bfef740SGreg Roach <?= view('admin/external-module-info', ['module' => $module]) ?> 578e5c5efeSGreg Roach <?php endif ?> 580cb66f86SGreg Roach </th> 590cb66f86SGreg Roach 600cb66f86SGreg Roach <td class="text-center"> 610cb66f86SGreg Roach <label class="d-block"> 620cb66f86SGreg Roach <input type="checkbox" name="status-<?= e($module->name()) ?>" id="status-<?= e($module->name()) ?>" <?= $module->isEnabled() ? 'checked' : '' ?>> 630cb66f86SGreg Roach <span class="sr-only"> 640cb66f86SGreg Roach <?= I18N::translate('Enabled') ?> 650cb66f86SGreg Roach </span> 660cb66f86SGreg Roach </label> 670cb66f86SGreg Roach </td> 680cb66f86SGreg Roach 6933c34396SGreg Roach <?php if ($uses_access) : ?> 70745968f0SGreg Roach <td> 71745968f0SGreg Roach <ul class="list-unstyled"> 72745968f0SGreg Roach <?php foreach ($access_summary[$module->name()] as $level): ?> 73745968f0SGreg Roach <li><?= $level ?></li> 74745968f0SGreg Roach <?php endforeach ?> 75745968f0SGreg Roach </ul> 76745968f0SGreg Roach 770cb66f86SGreg Roach <div class="modal fade" id="access-level-<?= $module->name() ?>" tabindex="-1" role="dialog"> 780cb66f86SGreg Roach <div class="modal-dialog" role="document"> 790cb66f86SGreg Roach <div class="modal-content"> 800cb66f86SGreg Roach <div class="modal-header"> 810cb66f86SGreg Roach <h2 class="modal-title"> 820cb66f86SGreg Roach <?= e($module->title()) ?> – <?= I18N::translate('Access level') ?> 830cb66f86SGreg Roach </h2> 840cb66f86SGreg Roach <button type="button" class="close" data-dismiss="modal" aria-label="Close"> 850cb66f86SGreg Roach <span aria-hidden="true">×</span> 860cb66f86SGreg Roach </button> 870cb66f86SGreg Roach </div> 880cb66f86SGreg Roach <div class="modal-body"> 890cb66f86SGreg Roach <table class="table table-sm"> 900cb66f86SGreg Roach <tbody> 910cb66f86SGreg Roach <?php foreach ($trees as $tree) : ?> 920cb66f86SGreg Roach <tr> 930cb66f86SGreg Roach <td> 940cb66f86SGreg Roach <?= e($tree->title()) ?> 950cb66f86SGreg Roach </td> 960cb66f86SGreg Roach <td> 97c9e11c2aSGreg Roach <?= view('components/select', ['name' => 'access-' . $module->name() . '-' . $tree->id(), 'selected' => $module->accessLevel($tree, $interface), 'options' => FunctionsEdit::optionsAccessLevels()]) ?> 980cb66f86SGreg Roach </tr> 990cb66f86SGreg Roach <?php endforeach ?> 1000cb66f86SGreg Roach </tbody> 1010cb66f86SGreg Roach </table> 1020cb66f86SGreg Roach </div> 1030cb66f86SGreg Roach <div class="modal-footer"> 1040cb66f86SGreg Roach <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button> 1050cb66f86SGreg Roach </div> 1060cb66f86SGreg Roach </div> 1070cb66f86SGreg Roach </div> 1080cb66f86SGreg Roach </div> 109745968f0SGreg Roach </td> 1100cb66f86SGreg Roach 111745968f0SGreg Roach <td> 1120cb66f86SGreg Roach <button type="button" class="btn btn-link" data-toggle="modal" data-target="#access-level-<?= $module->name() ?>"> 1130cb66f86SGreg Roach <?= view('icons/edit') ?> 114745968f0SGreg Roach <span class="sr-only"><?= I18N::translate('edit') ?></span> 1150cb66f86SGreg Roach </button> 1160cb66f86SGreg Roach </td> 11733c34396SGreg Roach <?php endif ?> 1180cb66f86SGreg Roach 11933c34396SGreg Roach <?php if ($uses_sorting) : ?> 1200cb66f86SGreg Roach <td class="move up text-center"> 1210cb66f86SGreg Roach <a href="#" title="<?= I18N::translate('Move up') ?>"> 1220cb66f86SGreg Roach <?= view('icons/arrow-up') ?> 1230cb66f86SGreg Roach </a> 1240cb66f86SGreg Roach </td> 1250cb66f86SGreg Roach 1260cb66f86SGreg Roach <td class="move down text-center"> 1270cb66f86SGreg Roach <a href="#" title="<?= I18N::translate('Move down') ?>"> 1280cb66f86SGreg Roach <?= view('icons/arrow-down') ?> 1290cb66f86SGreg Roach </a> 1300cb66f86SGreg Roach </td> 1310cb66f86SGreg Roach <?php endif ?> 1320cb66f86SGreg Roach </tr> 1330cb66f86SGreg Roach <?php endforeach ?> 1340cb66f86SGreg Roach </tbody> 1350cb66f86SGreg Roach </table> 1360cb66f86SGreg Roach 1370cb66f86SGreg Roach <button class="btn btn-primary" type="submit"> 1380cb66f86SGreg Roach <?= view('icons/save') ?> 1390cb66f86SGreg Roach <?= I18N::translate('save') ?> 1400cb66f86SGreg Roach </button> 1410cb66f86SGreg Roach 1420c0910bfSGreg Roach <a class="btn btn-secondary" href="<?= e(route(ControlPanel::class)) ?>"> 1430cb66f86SGreg Roach <?= view('icons/cancel') ?> 1440cb66f86SGreg Roach <?= I18N::translate('cancel') ?> 1450cb66f86SGreg Roach </a> 1460cb66f86SGreg Roach</form> 1470cb66f86SGreg Roach 1480cb66f86SGreg Roach 1490cb66f86SGreg Roach<?php View::push('javascript') ?> 1500cb66f86SGreg Roach<script> 1510cb66f86SGreg Roach $('.wt-table-menu td.move').click(function() { 1520cb66f86SGreg Roach var row = $(this).closest('tr'); 1530cb66f86SGreg Roach 1540cb66f86SGreg Roach if ($(this).hasClass('up')) { 1550cb66f86SGreg Roach row.prev().before(row); 1560cb66f86SGreg Roach } else { 1570cb66f86SGreg Roach row.next().after(row); 1580cb66f86SGreg Roach } 1590cb66f86SGreg Roach 1600cb66f86SGreg Roach return false; 1610cb66f86SGreg Roach }); 1620cb66f86SGreg Roach</script> 1630cb66f86SGreg Roach<?php View::endpush() ?> 1640cb66f86SGreg Roach 1650cb66f86SGreg Roach<?php View::push('styles') ?> 1660cb66f86SGreg Roach<style> 1670cb66f86SGreg Roach .wt-table-menu tr:first-child .wt-icon-arrow-up { 1680cb66f86SGreg Roach display:none; 1690cb66f86SGreg Roach } 1700cb66f86SGreg Roach .wt-table-menu tr:last-child .wt-icon-arrow-down { 1710cb66f86SGreg Roach display:none; 1720cb66f86SGreg Roach } 1730cb66f86SGreg Roach</style> 1740cb66f86SGreg Roach<?php View::endpush() ?> 175