. */ namespace Fisharebest\Webtrees; use Fisharebest\Algorithm\ConnectedComponent; use Fisharebest\Webtrees\Controller\PageController; /** @global Tree $WT_TREE */ global $WT_TREE; require 'includes/session.php'; $controller = new PageController; $controller ->restrictAccess(Auth::isManager($WT_TREE)) ->setPageTitle(I18N::translate('Find unrelated individuals') . ' — ' . $WT_TREE->getTitleHtml()) ->pageHeader(); $associates = Filter::getBool('associates'); if ($associates) { $sql = "SELECT l_from, l_to FROM `##link` WHERE l_file = :tree_id AND l_type IN ('FAMS', 'FAMC', 'ASSO', '_ASSO')"; } else { $sql = "SELECT l_from, l_to FROM `##link` WHERE l_file = :tree_id AND l_type IN ('FAMS', 'FAMC')"; } $rows = Database::prepare($sql)->execute([ 'tree_id' => $WT_TREE->getTreeId(), ])->fetchAll(); $graph = []; foreach ($rows as $row) { $graph[$row->l_from][$row->l_to] = 1; $graph[$row->l_to][$row->l_from] = 1; } $algorithm = new ConnectedComponent($graph); $components = $algorithm->findConnectedComponents(); $root = $controller->getSignificantIndividual(); $root_id = $root->getXref(); /** @var Individual[][] */ $individual_groups = []; $group_number = 1; foreach ($components as $key => $component) { if (!in_array($root_id, $component)) { $individuals = []; foreach ($component as $xref) { $individual = Individual::getInstance($xref, $WT_TREE); if ($individual instanceof Individual) { $individuals[] = $individual; } } $individual_groups[$group_number++] = $individuals; } } echo Bootstrap4::breadcrumbs([ 'admin.php' => I18N::translate('Control panel'), 'admin_trees_manage.php' => I18N::translate('Manage family trees'), ], $controller->getPageTitle()); ?>

getPageTitle() ?>

>

getFullName()) ?>