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 '
';
if ($controller->isPrintPreview()) {
echo "", i18n::translate('%s Generation Pedigree Chart', $PEDIGREE_GENERATIONS), ":";
} else {
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
if (!$controller->isPrintPreview()) {
?>
| |
', i18n::translate('Click on any of the boxes to get more information about that person.'), ' ';
}
} ?>
|
" isPrintPreview()) echo ' style="top: 1px;"';
else echo 'style="z-index: 1;"'; ?> >
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 && $view!="preview") {
echo '
";
}
echo "\n\t\t
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 "\n\t\t\t
";
if (($talloffset < 2) && ($curgen > $talloffset) && ($curgen < $controller->PEDIGREE_GENERATIONS)) {
echo "";
echo "\n\t\t\t ";
echo "\n\t\t\t | ";
}
else echo " |
| ";
if (!isset($controller->treeid[$i])) $controller->treeid[$i] = false;
print_pedigree_person($controller->treeid[$i], 1, $controller->show_famlink, $iref, 1);
if (($curgen==1) && (count(find_family_ids($controller->treeid[$i]))>0) && $view!="preview") {
$did = 1;
if ($i > ($controller->treesize/2) + ($controller->treesize/4)-1) $did++;
if ($talloffset==3) {
echo "\n\t\t\t\t |
";
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 "\n\t\t\t\t | ";
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 "\n\t\t\t |
\n\t\t
";
}
}
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 "
";
$yoffset += ($controller->pbheight / 2)+10;
echo "\n\t\t
pbwidth, "px; height:", $controller->pbheight, "px; visibility: hidden;\">";
echo "\n\t\t\t
";
echo "\n\t\t
";
}
}
// -- print html footer
$maxyoffset+=30;
?>
isPrintPreview()) echo '