. */ namespace Fisharebest\Webtrees\Controller; use Fisharebest\Webtrees\Filter; use Fisharebest\Webtrees\Functions\FunctionsCharts; use Fisharebest\Webtrees\Functions\FunctionsPrint; use Fisharebest\Webtrees\I18N; use Fisharebest\Webtrees\Individual; use Fisharebest\Webtrees\Theme; /** * Controller for the ancestry chart */ class AncestryController extends ChartController { /** @var int Show boxes for cousins */ public $show_cousins; /** @var int Determines style of chart */ public $chart_style; /** @var int Number of generations to display */ public $generations; /** * Startup activity */ public function __construct() { global $WT_TREE; parent::__construct(); // Extract form parameters $this->show_cousins = Filter::getInteger('show_cousins', 0, 1); $this->chart_style = Filter::getInteger('chart_style', 0, 3); $this->generations = Filter::getInteger('PEDIGREE_GENERATIONS', 2, $WT_TREE->getPreference('MAX_PEDIGREE_GENERATIONS'), $WT_TREE->getPreference('DEFAULT_PEDIGREE_GENERATIONS')); if ($this->root && $this->root->canShowName()) { $this->setPageTitle( /* I18N: %s is an individual’s name */ I18N::translate('Ancestors of %s', $this->root->getFullName()) ); } else { $this->setPageTitle(I18N::translate('Ancestors')); } } /** * print a child ascendancy * * @param Individual $individual * @param int $sosa child sosa number * @param int $depth the ascendancy depth to show */ public function printChildAscendancy(Individual $individual, $sosa, $depth) { echo '
  • '; echo ''; echo '
    '; if ($sosa === 1) { echo ''; } else { echo ''; echo ''; } FunctionsPrint::printPedigreePerson($individual, $this->showFull()); echo ''; if ($sosa > 1) { FunctionsCharts::printUrlArrow('?rootid=' . $individual->getXref() . '&PEDIGREE_GENERATIONS=' . $this->generations . '&show_full=' . $this->showFull() . '&chart_style=' . $this->chart_style . '&ged=' . $individual->getTree()->getNameUrl(), I18N::translate('Ancestors of %s', $individual->getFullName()), 3); } echo ' ', I18N::number($sosa), ' '; echo ' ', FunctionsCharts::getSosaName($sosa), '
    '; // Parents $family = $individual->getPrimaryChildFamily(); if ($family && $depth > 0) { // Marriage details echo ''; echo ''; echo ' ', I18N::number($sosa * 2), ' ', I18N::translate('and'); echo ' ', I18N::number($sosa * 2 + 1), ''; if ($family->canShow()) { foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { echo ' ', $fact->summary(), ''; } } echo ''; // display parents recursively - or show empty boxes echo ''; } echo '
  • '; } }