22 August 2005 * * $Id$ * @package webtrees * @subpackage Charts */ define('WT_SCRIPT_NAME', 'pedigree.php'); require './includes/session.php'; require WT_ROOT.'includes/controllers/pedigree_ctrl.php'; $controller = new PedigreeController(); $controller->init(); // -- echo html header information print_header($controller->getPageTitle()); if ($ENABLE_AUTOCOMPLETE) require WT_ROOT.'js/autocomplete.js.htm'; // LightBox if (WT_USE_LIGHTBOX) { require WT_ROOT.'modules/lightbox/lb_defaultconfig.php'; require WT_ROOT.'modules/lightbox/functions/lb_call_js.php'; } echo '
'; echo "

", i18n::translate('Pedigree Tree'), ":"; echo '
', PrintReady($controller->name); if ($controller->addname!="") { echo '
', PrintReady($controller->addname); } echo '

'; // -- echo the form to change the number of displayed generations ?>
 
"/>
', i18n::translate('Click on any of the boxes to get more information about that person.'), '
'; } ?>
" > treesize-1); $i>=0; $i--) { // -- check to see if we have moved to the next generation if ($i < floor($controller->treesize / (pow(2, $curgen)))) { $curgen++; } $prevxoffset = $xoffset; $prevyoffset = $yoffset; if ($talloffset < 2) { $xoffset = $controller->offsetarray[$i]["x"]; $yoffset = $controller->offsetarray[$i]["y"]; } else { $xoffset = $controller->offsetarray[$i]["y"]; $yoffset = $controller->offsetarray[$i]["x"]; } // -- if we are in the middle generations then we need to draw the connecting lines if (($curgen > 0 && $talloffset > 1) || (($curgen > $talloffset) && ($curgen < $controller->PEDIGREE_GENERATIONS))) { if ($i%2==1) { if ($SHOW_EMPTY_BOXES || ($controller->treeid[$i]) || ($controller->treeid[$i+1])) { if ($talloffset < 2) { $vlength = $prevyoffset-$yoffset; } else { $vlength = $prevxoffset-$xoffset; } if (!$SHOW_EMPTY_BOXES && (empty($controller->treeid[$i+1]))) { $parent = ceil(($i-1)/2); $vlength = $controller->offsetarray[$parent]["y"]-$yoffset; } $linexoffset = $xoffset; if ($talloffset < 2) { echo '
'; echo ''; echo '
'; } else { echo '
'; echo ''; } else { echo ($linexoffset-2+$controller->pbwidth/2+$vlength/2), "px; top:", ($yoffset+1+$controller->pbheight/2), "px; z-index: 0;\">"; echo ''; } echo '
'; echo '
'; echo ''; echo '
'; } } } } // -- draw the box if (!empty($controller->treeid[$i]) || $SHOW_EMPTY_BOXES) { // Work around a bug in FireFox that mis-places some boxes in Portrait RTL, resulting in // vertical lines that themselves appear to be mis-placed. if ($TEXT_DIRECTION=="rtl" && $BROWSERTYPE=="mozilla" && ($curgen <= 2)) $xoffset += 10; if ($TEXT_DIRECTION=="rtl") $xoffset += $brborder; // Account for thickness of right box border if ($yoffset>$maxyoffset) $maxyoffset=$yoffset; $widthadd = 0; if ($i==0) $iref = rand(); else $iref = $i; if (($curgen==1)&&(!empty($controller->treeid[$i]))&&(count(find_family_ids($controller->treeid[$i]))>0)) $widthadd = 20; if (($curgen >2) && ($curgen < $controller->PEDIGREE_GENERATIONS)) $widthadd = 10; if ($talloffset == 2) { echo '
'; if (($curgen==1)&&(count(find_family_ids($controller->treeid[$i]))>0)) { $did = 1; if ($i > ($controller->treesize/2) + ($controller->treesize/4)-1) $did++; echo 'PEDIGREE_GENERATIONS, '&rootid=', $controller->treeid[$did], '&show_full=', $controller->show_full, '&talloffset=', $controller->talloffset, ' '; echo "onmouseover=\"swap_image('arrow$i', 2);\" onmouseout=\"swap_image('arrow$i', 2);\">"; echo "'; echo ''; } echo "
"; } echo "
treeid[$i])) echo "$iref"; else echo $controller->treeid[$i]; if ($TEXT_DIRECTION=="rtl") echo ".1.$iref\" style=\"position:absolute; right:"; else echo ".1.$iref\" style=\"position:absolute; left:"; if ($talloffset == 2) $zindex = $PEDIGREE_GENERATIONS-$curgen; else $zindex = 0; echo $xoffset, "px; top:", $yoffset, "px; width:", ($controller->pbwidth+$widthadd), "px; height:", $controller->pbheight, "px; "; echo "z-index: ", $zindex, ";\">"; echo ""; if (($talloffset < 2) && ($curgen > $talloffset) && ($curgen < $controller->PEDIGREE_GENERATIONS)) { echo "
"; echo "\"\""; echo ""; } else echo "
"; if (!isset($controller->treeid[$i])) $controller->treeid[$i] = false; print_pedigree_person($controller->treeid[$i], 1, $iref, 1); if (($curgen==1) && (count(find_family_ids($controller->treeid[$i]))>0)) { $did = 1; if ($i > ($controller->treesize/2) + ($controller->treesize/4)-1) $did++; if ($talloffset==3) { echo "
"; echo "PEDIGREE_GENERATIONS}&rootid={$controller->treeid[$did]}&show_full={$controller->show_full}&talloffset={$controller->talloffset}\" "; echo "onmouseover=\"swap_image('arrow$i', 3);\" onmouseout=\"swap_image('arrow$i', 3);\">"; echo "\"\""; } else if ($talloffset < 2) { echo ""; echo "PEDIGREE_GENERATIONS}&rootid={$controller->treeid[$did]}&show_full={$controller->show_full}&talloffset={$talloffset}\" "; if ($TEXT_DIRECTION=="rtl") { echo "onmouseover=\"swap_image('arrow$i', 0);\" onmouseout=\"swap_image('arrow$i', 0);\">"; echo "\"\""; } else { echo "onmouseover=\"swap_image('arrow$i', 1);\" onmouseout=\"swap_image('arrow$i', 1);\">"; echo "\"\""; } echo ""; } } echo "
"; } } if ($controller->rootPerson->canDisplayDetails()) { // -- echo left arrow for decendants so that we can move down the tree $yoffset += ($controller->pbheight / 2)-10; $famids = $controller->rootPerson->getSpouseFamilies(); //-- make sure there is more than 1 child in the family with parents $cfamids = $controller->rootPerson->getChildFamilies(); if (count($famids)>0) { echo "
"; } else if ($talloffset == 1) { if ($PEDIGREE_GENERATIONS<4) $basexoffset += 60; echo $basexoffset, "px; top:", $yoffset, "px; width:10px; height:10px; \">"; } else if ($talloffset==3) { echo ($linexoffset-10+$controller->pbwidth/2+$vlength/2), "px; top:", ($yoffset-$controller->pbheight/2-10), "px; width:10px; height:10px; \">"; } else { echo ($linexoffset-10+$controller->pbwidth/2+$vlength/2), "px; top:", ($yoffset+$controller->pbheight/2+10), "px; width:10px; height:10px; \">"; } if ($talloffset < 2) { if ($TEXT_DIRECTION=="rtl") echo ""; else echo ""; if ($TEXT_DIRECTION=="rtl") echo "\"\""; else echo "\"\""; } else if ($talloffset==3) { echo ""; echo "\"\""; } else { echo ""; echo "\"\""; } echo ""; echo "
"; $yoffset += ($controller->pbheight / 2)+10; echo "
pbwidth, "px; height:", $controller->pbheight, "px; visibility: hidden;\">"; echo "
"; foreach ($famids as $ind=>$family) { if ($family!=null) { $husb = $family->getHusbId(); $wife = $family->getWifeId(); if ($controller->rootid!=$husb) $spid=$family->getHusband(); else $spid=$family->getWife(); if (!empty($spid)) { echo "PEDIGREE_GENERATIONS}&rootid=".$spid->getXref()."&show_full={$controller->show_full}&talloffset={$talloffset}\">canDisplayName()) { $name = $spid->getFullName(); $name = rtrim($name); } else $name = i18n::translate('Private'); if (hasRTLText($name)) echo 'class="name2">'; else echo 'class="name1">'; echo PrintReady($name); echo '
'; } $children = $family->getChildren(); foreach ($children as $ind2=>$child) { echo "  PEDIGREE_GENERATIONS}&rootid=".$child->getXref()."&show_full={$controller->show_full}&talloffset={$talloffset}\">canDisplayName()) { $name = $child->getFullName(); $name = rtrim($name); } else $name = i18n::translate('Private'); if (hasRTLText($name)) echo "class=\"name2\">< "; else echo "class=\"name1\">< "; echo PrintReady($name); echo '
'; } } } //-- echo the siblings foreach ($cfamids as $ind=>$family) { if ($family!=null) { $children = $family->getChildren(); if (count($children)>2) echo '
', i18n::translate('Siblings'), '
'; if (count($children)==2) echo '
', i18n::translate('Sibling'), '
'; foreach ($children as $ind2=>$child) { if (!$controller->rootPerson->equals($child) && !is_null($child)) { echo "  PEDIGREE_GENERATIONS}&rootid=".$child->getXref()."&show_full={$controller->show_full}&talloffset={$talloffset}\">canDisplayName()) { $name = $child->getFullName(); $name = rtrim($name); } else $name = i18n::translate('Private'); if (hasRTLText($name)) echo 'class="name2"> '; else echo 'class="name1"> '; echo PrintReady($name); echo '
'; } } } } echo "
"; echo "
"; } } // -- print html footer $maxyoffset+=30; ?>