$IconRDarrow = 'icon-rdarrow'; $IconLDarrow = 'icon-ldarrow'; } else { $IconRarrow = 'icon-larrow'; $IconLarrow = 'icon-rarrow'; $IconRDarrow = 'icon-ldarrow'; $IconLDarrow = 'icon-rdarrow'; } $all_blocks = array(); foreach (Module::getActiveBlocks($WT_TREE) as $name => $block) { if ($user_id && $block->isUserBlock() || $gedcom_id && $block->isGedcomBlock()) { $all_blocks[$name] = $block; } } if ($user_id) { $blocks = FunctionsDb::getUserBlocks($user_id); } else { $blocks = FunctionsDb::getTreeBlocks($gedcom_id); } if ($action === 'update') { foreach (array('main', 'side') as $location) { if ($location === 'main') { $new_blocks = $main; } else { $new_blocks = $right; } foreach ($new_blocks as $order => $block_name) { if (is_numeric($block_name)) { // existing block Database::prepare("UPDATE `##block` SET block_order=? WHERE block_id=?")->execute(array($order, $block_name)); // existing block moved location
use Fisharebest\Webtrees\Controller\PageController; use Fisharebest\Webtrees\Functions\Functions; use Fisharebest\Webtrees\Functions\FunctionsDb; define('WT_SCRIPT_NAME', 'index.php'); require './includes/session.php'; // The only option for action is "ajax" $action = Filter::get('action'); // The default view depends on whether we are logged in if (Auth::check()) { $ctype = Filter::get('ctype', 'gedcom|user', 'user'); } else { $ctype = 'gedcom'; } // Get the blocks list if ($ctype === 'user') { $blocks = FunctionsDb::getUserBlocks(Auth::id()); } else { $blocks = FunctionsDb::getTreeBlocks($WT_TREE->getTreeId()); } $active_blocks = Module::getActiveBlocks($WT_TREE); // The latest version is shown on the administration page. This updates it every day. Functions::fetchLatestVersion(); // We generate individual blocks using AJAX if ($action === 'ajax') { $controller = new AjaxController(); $controller->pageHeader(); // Check we’re displaying an allowable block. $block_id = Filter::getInteger('block_id'); if (array_key_exists($block_id, $blocks['main'])) { $module_name = $blocks['main'][$block_id]; } elseif (array_key_exists($block_id, $blocks['side'])) {