/** * Build all patronymic lineages for the reference surname. * * @return array List of root patronymic lineages */ public function buildLineages() { $indis = \Fisharebest\Webtrees\Query\QueryName::individuals($this->tree, $this->surname, null, null, false, false); if (count($indis) == 0) { return null; } $root_lineages = array(); foreach ($indis as $indi) { $pid = $indi->getXref(); if (!isset($this->used_indis[$pid])) { //Find the root of the lineage /** @var Fisharebest\Webtrees\Individual $indiFirst */ $indiFirst = $this->getLineageRootIndividual($indi); if ($indiFirst) { $this->used_indis[$indiFirst->getXref()] = true; if ($indiFirst->canShow()) { //Check if the root individual has brothers and sisters, without parents $indiChildFamily = $indiFirst->getPrimaryChildFamily(); if ($indiChildFamily !== null) { $root_node = new LineageRootNode(null); $root_node->addFamily($indiChildFamily); } else { $root_node = new LineageRootNode($indiFirst); } $root_node = $this->buildLineage($root_node); if ($root_node) { $root_lineages[] = $root_node; } } } } } return $root_lineages; }
/** * Print a root lineage node * @param LineageRootNode $node */ private function printRootLineage(LineageRootNode $node) { print '<div class="patrolin_tree">'; if ($node->getIndividual() === null) { $fam_nodes = $node->getFamiliesNodes(); foreach ($fam_nodes as $fam) { foreach ($fam_nodes[$fam] as $child_node) { if ($child_node) { $this->printLineage($child_node); } } } } else { $this->printLineage($node); } echo '</div>'; $places = $node->getPlaces(); if ($places && count($places) > 0) { echo '<div class="patrolin_places">'; echo \MyArtJaub\Webtrees\Functions\FunctionsPrint::htmlPlacesCloud($places, false, $this->data->get('tree')); echo '</div>'; } }