pageHeader();
if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm';
// LBox =====================================================================================
if (WT_USE_LIGHTBOX) {
require WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lb_call_js.php';
}
// ==========================================================================================
echo '
', WT_I18N::translate('Descendants of %s', $controller->name), '';
echo WT_JS_START;
echo 'var pastefield; function paste_id(value) {pastefield.value=value;}';
echo WT_JS_END;
$gencount=0;
echo ' | | ';
echo ' |
';
if (is_null($controller->descPerson)) {
echo '', WT_I18N::translate('The requested GEDCOM record could not be found. This could be caused by a link to an invalid person or by a corrupt GEDCOM file.'), '';
}
switch ($controller->chart_style) {
case 0: //-- list
if ($show_full==0) {
echo '', WT_I18N::translate('Click on any of the boxes to get more information about that person.'), '
';
}
echo '';
$controller->print_child_descendancy($controller->descPerson, $controller->generations);
echo '
';
break;
case 1: //-- booklet
echo '';
if ($show_full==0) {
echo '', WT_I18N::translate('Click on any of the boxes to get more information about that person.'), '
';
}
$show_cousins = true;
$controller->print_child_family($controller->descPerson, $controller->generations);
echo '
';
break;
case 2: //-- Individual list
$descendants=indi_desc($controller->descPerson, $controller->generations, array());
echo '';
echo format_indi_table($descendants, WT_I18N::translate('Descendants of %s', $controller->name));
echo '
';
break;
case 3: //-- Family list
$descendants=fam_desc($controller->descPerson, $controller->generations, array());
echo '';
echo format_fam_table($descendants, WT_I18N::translate('Descendants of %s', $controller->name));
echo '
';
break;
}
function indi_desc($person, $n, $array) {
if ($n<1) {
return $array;
}
$array[$person->getXref()]=$person;
foreach ($person->getSpouseFamilies() as $family) {
$spouse=$family->getSpouse($person);
if (isset($spouse)) $array[$spouse->getXref()]=$spouse;
foreach ($family->getChildren() as $child) {
$array=indi_desc($child, $n-1, $array);
}
}
return $array;
}
function fam_desc($person, $n, $array) {
if ($n<1) {
return $array;
}
foreach ($person->getSpouseFamilies() as $family) {
$array[$family->getXref()]=$family;
foreach ($family->getChildren() as $child) {
$array=fam_desc($child, $n-1, $array);
}
}
return $array;
}