*/ namespace Fisharebest\Webtrees; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\RelationshipController; use Fisharebest\Webtrees\Functions\Functions; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Functions\FunctionsPrint; define('WT_SCRIPT_NAME', 'relationship.php'); require './includes/session.php'; $controller = new RelationshipController(); $pid1 = Filter::get('pid1', WT_REGEX_XREF); $pid2 = Filter::get('pid2', WT_REGEX_XREF); $show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS')); $find_all = Filter::getBool('find_all'); $person1 = Individual::getInstance($pid1, $WT_TREE); $person2 = Individual::getInstance($pid2, $WT_TREE); $controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); if ($person1 && $person2) { $controller->setPageTitle(I18N::translate('Relationships between %1$s and %2$s', $person1->getFullName(), $person2->getFullName()))->pageHeader(); $paths = $controller->calculateRelationships($person1, $person2, $find_all); } else { $controller->setPageTitle(I18N::translate('Relationships'))->pageHeader(); $paths = array(); } ?>
/** * check (blood) relationship between partners * * @param type $person * @param type $spouse * @return string (relationship name) */ private function checkRelationship($person, $spouse) { $controller = new RelationshipController(); $paths = $controller->calculateRelationships($person, $spouse, 1); foreach ($paths as $path) { $relationships = $controller->oldStyleRelationshipPath($path); if (empty($relationships)) { // Cannot see one of the families/individuals, due to privacy; continue; } foreach (array_keys($path) as $n) { if ($n % 2 === 1) { switch ($relationships[$n]) { case 'sis': case 'bro': case 'sib': return Functions::getRelationshipNameFromPath(implode('', $relationships), $person, $spouse); } } } } }
/** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\RelationshipController; use Fisharebest\Webtrees\Functions\Functions; use Fisharebest\Webtrees\Functions\FunctionsEdit; use Fisharebest\Webtrees\Functions\FunctionsPrint; use Fisharebest\Webtrees\Module\RelationshipsChartModule; define('WT_SCRIPT_NAME', 'relationship.php'); require './includes/session.php'; $max_recursion = $WT_TREE->getPreference('RELATIONSHIP_RECURSION', RelationshipsChartModule::DEFAULT_RECURSION); $ancestors_only = $WT_TREE->getPreference('RELATIONSHIP_ANCESTORS', RelationshipsChartModule::DEFAULT_ANCESTORS); $controller = new RelationshipController(); $pid1 = Filter::get('pid1', WT_REGEX_XREF); $pid2 = Filter::get('pid2', WT_REGEX_XREF); $show_full = Filter::getInteger('show_full', 0, 1, $WT_TREE->getPreference('PEDIGREE_FULL_DETAILS')); $recursion = Filter::getInteger('recursion', 0, $max_recursion, 0); $ancestors = Filter::getInteger('ancestors', 0, 1, 0); $person1 = Individual::getInstance($pid1, $WT_TREE); $person2 = Individual::getInstance($pid2, $WT_TREE); $controller->restrictAccess(Module::isActiveChart($WT_TREE, 'relationships_chart'))->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addInlineJavascript('autocomplete();'); if ($person1 && $person2) { $controller->setPageTitle(I18N::translate('Relationships between %1$s and %2$s', $person1->getFullName(), $person2->getFullName()))->pageHeader(); $paths = $controller->calculateRelationships($person1, $person2, $recursion, (bool) $ancestors); } else { $controller->setPageTitle(I18N::translate('Relationships'))->pageHeader(); $paths = array(); }