/** * 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 '<li>'; echo '<table><tbody><tr><td>'; if ($sosa === 1) { echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="3" width="', Theme::theme()->parameter('chart-descendancy-indent'), '"></td><td>'; } else { echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="3" width="2" alt="">'; echo '<img src="', Theme::theme()->parameter('image-hline'), '" height="3" width="', Theme::theme()->parameter('chart-descendancy-indent') - 2, '"></td><td>'; } FunctionsPrint::printPedigreePerson($individual, $this->showFull()); echo '</td><td>'; 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 '</td><td class="details1"> <span class="person_box' . ($sosa === 1 ? 'NN' : ($sosa % 2 ? 'F' : '')) . '">', I18N::number($sosa), '</span> '; echo '</td><td class="details1"> ', FunctionsCharts::getSosaName($sosa), '</td>'; echo '</tr></tbody></table>'; // Parents $family = $individual->getPrimaryChildFamily(); if ($family && $depth > 0) { // Marriage details echo '<span class="details1">'; echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="2" width="', Theme::theme()->parameter('chart-descendancy-indent'), '" alt=""><a href="#" onclick="return expand_layer(\'sosa_', $sosa, '\');" class="top"><i id="sosa_', $sosa, '_img" class="icon-minus" title="', I18N::translate('View family'), '"></i></a>'; echo ' <span class="person_box">', I18N::number($sosa * 2), '</span> ', I18N::translate('and'); echo ' <span class="person_boxF">', I18N::number($sosa * 2 + 1), '</span>'; if ($family->canShow()) { foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>'; } } echo '</span>'; // display parents recursively - or show empty boxes echo '<ul id="sosa_', $sosa, '" class="generation">'; if ($family->getHusband()) { $this->printChildAscendancy($family->getHusband(), $sosa * 2, $depth - 1); } if ($family->getWife()) { $this->printChildAscendancy($family->getWife(), $sosa * 2 + 1, $depth - 1); } echo '</ul>'; } echo '</li>'; }
/** * print a family descendancy * * @param Individual $person * @param Family $family * @param int $depth the descendancy depth to show */ private function printFamilyDescendancy(Individual $person, Family $family, $depth) { $uid = Uuid::uuid4(); // create a unique ID // print marriage info echo '<li>'; echo '<img src="', Theme::theme()->parameter('image-spacer'), '" height="2" width="', Theme::theme()->parameter('chart-descendancy-indent') + 4, '">'; echo '<span class="details1">'; echo "<a href=\"#\" onclick=\"expand_layer('" . $uid . "'); return false;\" class=\"top\"><i id=\"" . $uid . "_img\" class=\"icon-minus\" title=\"" . I18N::translate('View this family') . "\"></i></a>"; if ($family->canShow()) { foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>'; } } echo '</span>'; // print spouse $spouse = $family->getSpouse($person); echo '<ul id="' . $uid . '" class="generation">'; echo '<li>'; echo '<table><tr><td>'; FunctionsPrint::printPedigreePerson($spouse, $this->showFull()); echo '</td>'; // check if spouse has parents and add an arrow echo '<td></td>'; echo '<td>'; if ($spouse) { foreach ($spouse->getChildFamilies() as $cfamily) { foreach ($cfamily->getSpouses() as $parent) { FunctionsCharts::printUrlArrow('?rootid=' . $parent->getXref() . '&generations=' . $this->generations . '&chart_style=' . $this->chart_style . '&show_full=' . $this->showFull() . '&ged=' . $parent->getTree()->getNameUrl(), I18N::translate('Start at parents'), 2); // only show the arrow for one of the parents break; } } } if ($this->showFull()) { echo '<br><br> '; } echo '</td></tr>'; // children $children = $family->getChildren(); echo '<tr><td colspan="3" class="details1" > '; if ($children) { echo GedcomTag::getLabel('NCHI') . ': ' . count($children); } else { // Distinguish between no children (NCHI 0) and no recorded // children (no CHIL records) if (strpos($family->getGedcom(), '\\n1 NCHI 0')) { echo GedcomTag::getLabel('NCHI') . ': ' . count($children); } else { echo I18N::translate('No children'); } } echo '</td></tr></table>'; echo '</li>'; if ($depth > 1) { foreach ($children as $child) { $this->printChildDescendancy($child, $depth - 1); } } echo '</ul>'; echo '</li>'; }