addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js') ->addInlineJavascript('autocomplete();'); if ($person1 && $person1->canShowName() && $person2 && $person2->canShowName()) { $controller ->setPageTitle(WT_I18N::translate(/* I18N: %s are individual’s names */ 'Relationships between %1$s and %2$s', $person1->getFullName(), $person2->getFullName())) ->PageHeader(); $node=get_relationship($person1, $person2, $followspouse, 0, $path_to_find); // If no blood relationship exists, look for relationship via marriage if ($path_to_find==0 && $node==false && $followspouse==false) { $followspouse=true; $node=get_relationship($person1, $person2, $followspouse, 0, $path_to_find); } $disp=true; } else { $controller ->setPageTitle(WT_I18N::translate('Relationships')) ->PageHeader(); $node=false; $disp=false; } ?>

getPageTitle(); ?>

>
0) { echo WT_I18N::translate('Show path'); } ?> ', $i+1, ''; } ?> onclick="document.people.path_to_find.value='-1';" >
'; echo help_link('next_path'); } ?>
', WT_I18N::translate('This information is private and cannot be shown.'), '
'; } elseif (!$node) { if ($path_to_find==0) { echo '

', WT_I18N::translate('No link between the two individuals could be found.'), '

'; } else { echo '

', WT_I18N::translate('No other link between the two individuals could be found.'), '

'; } } else { if ($node) { echo '

', WT_I18N::translate('Relationship: %s', get_relationship_name($node)), '

'; // Use relative layout to position the person boxes. echo '
'; $yoffset = $Dbaseyoffset + 20; $xoffset = $Dbasexoffset; $colNum = 0; $rowNum = 0; $previous=''; $change_count=''; // shift right on alternate change of direction $xs = $Dbxspacing+70; $ys = $Dbyspacing+50; // step1 = tree depth calculation $dmin=0; $dmax=0; $depth=0; foreach ($node['path'] as $index=>$person) { if ($node['relations'][$index]=='father' || $node['relations'][$index]=='mother' || $node['relations'][$index]=='parent') { $depth++; if ($depth>$dmax) { $dmax=$depth; } if ($asc==0) { $asc=1; // the first link is a parent link } } if ($node['relations'][$index]=='son' || $node['relations'][$index]=='daughter' || $node['relations'][$index]=='child') { $depth--; if ($depth<$dmin) { $dmin=$depth; } if ($asc==0) { $asc=-1; // the first link is a child link } } } $depth=$dmax+$dmin; // need more yoffset before the first box ? if ($asc==1) { $yoffset -= $dmin*($Dbheight+$ys); } if ($asc==-1) { $yoffset += $dmax*($Dbheight+$ys); } $rowNum = ($asc==-1) ? $depth : 0; $maxxoffset = -1*$Dbwidth-20; $maxyoffset = $yoffset; // Left and right get reversed on RTL pages if ($TEXT_DIRECTION=='ltr') { $right_arrow='icon-rarrow'; } else { $right_arrow='icon-larrow'; } // Up and down get reversed, for the “oldest at top” option if ($asc==1) { $up_arrow ='icon-uarrow'; $down_arrow ='icon-darrow'; } else { $up_arrow ='icon-darrow'; $down_arrow ='icon-uarrow'; } foreach ($node['path'] as $index=>$person) { $linex = $xoffset; $liney = $yoffset; $mfstyle = 'NN'; switch ($person->getSex()) { case 'M': $mfstyle=''; break; case 'F': $mfstyle='F'; break; case 'U': $mfstyle='NN'; break; } switch ($node['relations'][$index]) { case 'father': case 'mother': case 'parent': $arrow_img = $down_arrow; $line = $WT_IMAGES['vline']; $liney += $Dbheight; $linex += $Dbwidth/2; $lh = 54; $lw = 3; $lh=$ys; $linex=$xoffset+$Dbwidth/2; // put the box up or down ? $yoffset += $asc*($Dbheight+$lh); $rowNum += $asc; if ($asc==1) { $liney = $yoffset-$lh; } else { $liney = $yoffset+$Dbheight; } // need to draw a joining line ? if ($previous=='child' && ($change_count++ % 2) == 0) { $joinh = 3; $joinw = $xs/2+2; $xoffset += $Dbwidth+$xs; $colNum ++; //$rowNum is inherited from the box immediately to the left $linex = $xoffset-$xs/2; if ($asc==-1) { $liney=$yoffset+$Dbheight; } else { $liney=$yoffset-$lh; } $joinx = $xoffset-$xs; $joiny = $liney-2-($asc-1)/2*$lh; echo "
\"\"
"; $joinw = $xs/2+2; $joinx = $joinx+$xs/2; $joiny = $joiny+$asc*$lh; echo "
\"\"
"; } else $change_count=''; $previous='parent'; break; case 'brother': case 'sister': case 'sibling': case 'husband': case 'wife': case 'spouse': $arrow_img = $right_arrow; $xoffset += $Dbwidth+$Dbxspacing+70; $colNum ++; //$rowNum is inherited from the box immediately to the left $line = $WT_IMAGES['hline']; $linex += $Dbwidth; $liney += $Dbheight/2; $lh = 3; $lw = 70; $lw = $xs; $linex = $xoffset-$lw; $liney = $yoffset+$Dbheight/4; $previous=''; break; case 'son': case 'daughter': case 'child': $arrow_img = $up_arrow; $line = $WT_IMAGES['vline']; $liney += $Dbheight; $linex += $Dbwidth/2; $lh = 54; $lw = 3; $lh=$ys; $linex = $xoffset+$Dbwidth/2; // put the box up or down ? $yoffset -= $asc*($Dbheight+$lh); $rowNum -= $asc; if ($asc==-1) { $liney = $yoffset-$lh; } else { $liney = $yoffset+$Dbheight; } // need to draw a joining line ? if ($previous=='parent' && ($change_count++ % 2) == 0) { $joinh = 3; $joinw = $xs/2+2; $xoffset += $Dbwidth+$xs; $colNum ++; //$rowNum is inherited from the box immediately to the left $linex = $xoffset-$xs/2; if ($asc==1) { $liney=$yoffset+$Dbheight; } else { $liney=$yoffset-($lh+$Dbyspacing); } $joinx = $xoffset-$xs; $joiny = $liney-2+($asc+1)/2*$lh; echo '
'; $joinw = $xs/2+2; $joinx = $joinx+$xs/2; $joiny = $joiny-$asc*$lh; echo '
'; } else $change_count=''; $previous='child'; break; } if ($yoffset > $maxyoffset) { $maxyoffset = $yoffset; } $plinex = $linex; $pxoffset = $xoffset; // Adjust all box positions for proper placement with respect to other page elements $pyoffset = $yoffset - 2; if ($index>0) { if ($TEXT_DIRECTION=='rtl' && $line!=$WT_IMAGES['hline']) { echo '
'; echo ''; echo '
'; echo WT_I18N::translate($node['relations'][$index]); echo ''; } else { echo '
'; echo '
'; echo ''; if ($lh == 3) { echo '
'; // note: $lh==3 means horiz arrow } echo WT_I18N::translate($node['relations'][$index]); } echo '
'; } // Determine the z-index for this box $zIndex = 200 - ($colNum * $depth + $rowNum); echo '
'; print_pedigree_person($person); echo '
'; } } echo '
'; // close#relationship_chart } } echo '
'; // close #relationshippage // The contents of
use relative positions. // Need to expand the div to include the children, or we'll overlap the footer. // $maxyoffset is the top edge of the lowest box. $controller->addInlineJavascript(' relationship_chart_div = document.getElementById("relationship_chart"); if (relationship_chart_div) { relationship_chart_div.style.height = "'.($maxyoffset+$Dbheight+20).'px"; relationship_chart_div.style.width = "100%"; }' );