. */ namespace Fisharebest\Webtrees; use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Module\ModuleConfigInterface; define('WT_SCRIPT_NAME', 'admin_module_menus.php'); require 'includes/session.php'; $controller = new PageController; $controller ->restrictAccess(Auth::isAdmin()) ->setPageTitle(I18N::translate('Menus')); $action = Filter::post('action'); $modules = Module::getAllModulesByComponent('menu'); if ($action === 'update_mods' && Filter::checkCsrf()) { foreach ($modules as $module) { foreach (Tree::getAll() as $tree) { $access_level = Filter::post('access-' . $module->getName() . '-' . $tree->getTreeId(), WT_REGEX_INTEGER, $module->defaultAccessLevel()); Database::prepare( "REPLACE INTO `##module_privacy` (module_name, gedcom_id, component, access_level) VALUES (?, ?, 'menu', ?)" )->execute(array($module->getName(), $tree->getTreeId(), $access_level)); } $order = Filter::post('order-' . $module->getName()); Database::prepare( "UPDATE `##module` SET menu_order = ? WHERE module_name = ?" )->execute(array($order, $module->getName())); } header('Location: ' . WT_BASE_URL . WT_SCRIPT_NAME); return; } $controller ->addInlineJavascript(' jQuery("#module_table").sortable({ items: ".sortme", forceHelperSize: true, forcePlaceholderSize: true, opacity: 0.7, cursor: "move", axis: "y", update: function(event, ui) { jQuery("input", jQuery(this)).each( function (index, element) { element.value = index + 1; } ); } }); ') ->pageHeader(); ?>