.
*/
namespace Fisharebest\Webtrees;
/**
* Defined in session.php
*
* @global Tree $WT_TREE
*/
global $WT_TREE;
use Fisharebest\Webtrees\Controller\AncestryController;
use Fisharebest\Webtrees\Functions\FunctionsCharts;
use Fisharebest\Webtrees\Functions\FunctionsEdit;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
use Fisharebest\Webtrees\Functions\FunctionsPrintLists;
define('WT_SCRIPT_NAME', 'ancestry.php');
require './includes/session.php';
$MAX_PEDIGREE_GENERATIONS = $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS');
$controller = new AncestryController;
$controller
->restrictAccess(Module::isActiveChart($WT_TREE, 'ancestors_chart'))
->pageHeader()
->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)
->addInlineJavascript('autocomplete();');
?>
getPageTitle(); ?>
error_message) {
echo '
', $controller->error_message, '
';
return;
}
switch ($controller->chart_style) {
case 0:
// List
echo '
';
$controller->printChildAscendancy($controller->root, 1, $controller->generations - 1);
echo '
';
echo '
';
break;
case 1:
echo '
';
// Booklet
// first page : show indi facts
FunctionsPrint::printPedigreePerson($controller->root, $controller->showFull());
// process the tree
$ancestors = $controller->sosaAncestors($controller->generations - 1);
$ancestors = array_filter($ancestors); // The SOSA array includes empty placeholders
foreach ($ancestors as $sosa => $individual) {
foreach ($individual->getChildFamilies() as $family) {
FunctionsCharts::printSosaFamily($family->getXref(), $individual->getXref(), $sosa, '', '', '', $controller->show_cousins, $controller->showFull());
}
}
echo '
';
break;
case 2:
// Individual list
$ancestors = $controller->sosaAncestors($controller->generations);
$ancestors = array_filter($ancestors); // The SOSA array includes empty placeholders
echo '
', FunctionsPrintLists::individualTable($ancestors, 'sosa'), '
';
break;
case 3:
// Family list
$ancestors = $controller->sosaAncestors($controller->generations - 1);
$ancestors = array_filter($ancestors); // The SOSA array includes empty placeholders
$families = array();
foreach ($ancestors as $individual) {
foreach ($individual->getChildFamilies() as $family) {
$families[$family->getXref()] = $family;
}
}
echo '
', FunctionsPrintLists::familyTable($families), '
';
break;
}
echo '
';