function print_descendency($pid, $count) { global $show_spouse, $dgenerations, $bwidth, $bheight, $bhalfheight; global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $generations, $box_width, $view, $show_full, $pgv_lang; if ($count >= $dgenerations) { return 0; } print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"; print "<tr>"; print "<td width=\"" . ($bwidth - 2) . "\">\n"; $numkids = 0; $famids = find_sfamily_ids($pid); if (count($famids) > 0) { $firstkids = 0; foreach ($famids as $indexval => $famid) { $famrec = find_family_record($famid, PGV_GED_ID); $ct = preg_match_all("/1 CHIL @(.*)@/", $famrec, $match, PREG_SET_ORDER); if ($ct > 0) { print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"; for ($i = 0; $i < $ct; $i++) { $rowspan = 2; if ($i > 0 && $i < $ct - 1) { $rowspan = 1; } $chil = trim($match[$i][1]); print "<tr><td rowspan=\"{$rowspan}\" width=\"{$bwidth}\" style=\"padding-top: 2px;\">\n"; if ($count < $dgenerations - 1) { $kids = print_descendency($chil, $count + 1); if ($i == 0) { $firstkids = $kids; } $numkids += $kids; } else { print_pedigree_person($chil); $numkids++; } print "</td>\n"; $twidth = 7; if ($ct == 1) { $twidth += 3; } print "<td rowspan=\"{$rowspan}\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" width=\"{$twidth}\" height=\"3\" alt=\"\" /></td>\n"; if ($ct > 1) { if ($i == 0) { print "<td height=\"" . ($bhalfheight + 3) . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td></tr>\n"; print "<tr><td height=\"" . ($bhalfheight + 3) . "\" style=\"background: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "');\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td>\n"; } else { if ($i == $ct - 1) { print "<td height=\"" . ($bhalfheight + 4) . "\" style=\"background: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "');\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td></tr>\n"; print "<tr><td height=\"" . ($bhalfheight + 4) . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td>\n"; } else { print "<td style=\"background: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "');\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td>\n"; } } } print "</tr>\n"; } print "</table>\n"; } } print "</td>\n"; print "<td width=\"{$bwidth}\">\n"; } // NOTE: If statement OK if ($numkids == 0) { $numkids = 1; $tbwidth = $bwidth + 16; for ($j = $count; $j < $dgenerations; $j++) { print "</td>\n<td width=\"{$bwidth}\">\n"; } } //-- add offset divs to make things line up better if ($show_spouse) { foreach ($famids as $indexval => $famid) { $famrec = find_family_record($famid, PGV_GED_ID); if (!empty($famrec)) { $marrec = get_sub_record(1, "1 MARR", $famrec); if (!empty($marrec)) { print "<br />"; } print "<div style=\"height: " . $bheight . "px; width: " . $bwidth . "px;\"><br /></div>\n"; } } } print_pedigree_person($pid); // NOTE: If statement OK if ($show_spouse) { foreach ($famids as $indexval => $famid) { $famrec = find_family_record($famid, PGV_GED_ID); if (!empty($famrec)) { $parents = find_parents_in_record($famrec); $marrec = get_sub_record(1, "1 MARR", $famrec); if (!empty($marrec)) { print "<br />"; $marriage = new Event($marrec); $marriage->print_simple_fact(); } if ($parents["HUSB"] != $pid) { print_pedigree_person($parents["HUSB"]); } else { print_pedigree_person($parents["WIFE"]); } } } } // NOTE: If statement OK if ($count == 0) { $indirec = find_person_record($pid, PGV_GED_ID); // NOTE: If statement OK if (displayDetailsById($pid, 'INDI') || showLivingNameById($pid)) { // -- print left arrow for decendants so that we can move down the tree $famids = find_sfamily_ids($pid); //-- make sure there is more than 1 child in the family with parents $cfamids = find_family_ids($pid); $num = 0; // NOTE: For statement OK for ($f = 0; $f < count($cfamids); $f++) { $famrec = find_family_record($cfamids[$f], PGV_GED_ID); if ($famrec) { $num += preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER); } } // NOTE: If statement OK if ($famids || $num > 1) { print "\n\t\t<div class=\"center\" id=\"childarrow.{$pid}\" dir=\"" . $TEXT_DIRECTION . "\""; print " style=\"position:absolute; width:" . $bwidth . "px; \">"; if ($view != "preview") { print "<a href=\"javascript: " . $pgv_lang["show"] . "\" onclick=\"return togglechildrenbox('{$pid}');\" onmouseover=\"swap_image('larrow.{$pid}',3);\" onmouseout=\"swap_image('larrow.{$pid}',3);\">"; print "<img id=\"larrow.{$pid}\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["darrow"]["other"] . "\" border=\"0\" alt=\"\" />"; print "</a>"; } print "\n\t\t<div id=\"childbox.{$pid}\" dir=\"" . $TEXT_DIRECTION . "\" style=\"width:" . $bwidth . "px; height:" . $bheight . "px; visibility: hidden;\">"; print "\n\t\t\t<table class=\"person_box\"><tr><td>"; for ($f = 0; $f < count($famids); $f++) { $famrec = find_family_record(trim($famids[$f]), PGV_GED_ID); if ($famrec) { $parents = find_parents($famids[$f]); if ($parents) { if ($pid != $parents["HUSB"]) { $spid = $parents["HUSB"]; } else { $spid = $parents["WIFE"]; } $spouse = Person::getInstance($spid); if ($spouse) { $name = $spouse->getFullName(); print "\n\t\t\t\t<a href=\"" . encode_url("familybook.php?pid={$spid}&show_spouse={$show_spouse}&show_full={$show_full}&generations={$generations}&box_width={$box_width}") . "\"><span class=\""; if (hasRTLText($name)) { print "name2"; } else { print "name1"; } print "\">"; print PrintReady($name); print "<br /></span></a>"; } } $num = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER); for ($i = 0; $i < $num; $i++) { //-- add the following line to stop a bad PHP bug if ($i >= $num) { break; } $cid = $smatch[$i][1]; $child = Person::getInstance($cid); $name = $child->getFullName(); print "\n\t\t\t\t <a href=\"" . encode_url("familybook.php?pid={$cid}&show_spouse={$show_spouse}&show_full={$show_full}&generations={$generations}&box_width={$box_width}") . "\"><span class=\""; if (hasRTLText($name)) { print "name2"; } else { print "name1"; } print "\">< "; print PrintReady($name); print "<br /></span></a>"; } } } //-- print the siblings for ($f = 0; $f < count($cfamids); $f++) { $famrec = find_family_record($cfamids[$f], PGV_GED_ID); if ($famrec) { $parents = find_parents($cfamids[$f]); if ($parents) { print "<span class=\"name1\"><br />" . $pgv_lang["parents"] . "<br /></span>"; if (!empty($parents["HUSB"])) { $spid = $parents["HUSB"]; $spouse = Person::getInstance($spid); $name = $spouse->getFullName(); print "\n\t\t\t\t <a href=\"" . encode_url("familybook.php?pid={$spid}&show_spouse={$show_spouse}&show_full={$show_full}&generations={$generations}&box_width={$box_width}") . "\"><span class=\""; if (hasRTLText($name)) { print "name2"; } else { print "name1"; } print "\">"; print PrintReady($name); print "<br /></span></a>"; } if (!empty($parents["WIFE"])) { $spid = $parents["WIFE"]; $spouse = Person::getInstance($spid); $name = $spouse->getFullName(); print "\n\t\t\t\t <a href=\"" . encode_url("familybook.php?pid={$spid}&show_spouse={$show_spouse}&show_full={$show_full}&generations={$generations}&box_width={$box_width}") . "\"><span class=\""; if (hasRTLText($name)) { print "name2"; } else { print "name1"; } print "\">"; print PrintReady($name); print "<br /></span></a>"; } } $num = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER); if ($num > 2) { print "<span class=\"name1\"><br />" . $pgv_lang["siblings"] . "<br /></span>"; } if ($num == 2) { print "<span class=\"name1\"><br />" . $pgv_lang["sibling"] . "<br /></span>"; } for ($i = 0; $i < $num; $i++) { //-- add the following line to stop a bad PHP bug if ($i >= $num) { break; } $cid = $smatch[$i][1]; if ($cid != $pid) { $child = Person::getInstance($cid); $name = $child->getFullName(); print "\n\t\t\t\t <a href=\"familybook.php?pid={$cid}&show_spouse={$show_spouse}&show_full={$show_full}&generations={$generations}&box_width={$box_width}\"><span class=\""; if (hasRTLText($name)) { print "name2"; } else { print "name1"; } print "\"> "; print PrintReady($name); print "<br /></span></a>"; } } } } print "\n\t\t\t</td></tr></table>"; print "\n\t\t</div>"; print "\n\t\t</div>"; } } } print "</td></tr>\n"; print "</table>\n"; return $numkids; }
/** * Prints descendency of passed in person * * @param mixed $pid ID of person to print descendency for * @param mixed $count count of generations to print * @access public * @return void */ function print_descendency($pid, $count, $showNav = true) { global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $pgv_lang, $bheight, $bwidth, $bhalfheight; global $lastGenSecondFam; if ($count > $this->dgenerations) { return 0; } $person = Person::getInstance($pid); if (is_null($person)) { return; } $tablealign = "right"; $otablealign = "left"; if ($TEXT_DIRECTION == "rtl") { $tablealign = "left"; $otablealign = "right"; } // print $this->dgenerations; print "<!-- print_descendency for {$pid} -->"; //-- put a space between families on the last generation if ($count == $this->dgenerations - 1) { if (isset($lastGenSecondFam)) { print "<br />"; } $lastGenSecondFam = true; } print "<table id=\"table_{$pid}\" align=\"" . $tablealign . "\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; print "<tr>"; print "<td align=\"{$tablealign}\" width=\"100%\">\n"; $numkids = 0; $families = $person->getSpouseFamilies(); $famcount = count($families); $famNum = 0; $kidNum = 0; $children = array(); if ($count < $this->dgenerations) { //-- put all of the children in a common array foreach ($families as $famid => $family) { $famNum++; $chs = $family->getChildren(); foreach ($chs as $c => $child) { $children[] = $child; } } $ct = count($children); if ($ct > 0) { print "<table style=\"position: relative; top: auto; text-align: {$tablealign};\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; for ($i = 0; $i < $ct; $i++) { if ($i > 0 && $i < $ct - 1) { $rowspan = 1; } /* @var $person2 Person */ $person2 = $children[$i]; $chil = $person2->getXref(); print "<tr>"; print "<td id=\"td_{$chil}\" class=\"{$TEXT_DIRECTION}\" align=\"{$tablealign}\">"; $kids = $this->print_descendency($chil, $count + 1); $numkids += $kids; print "</td>"; //-- print the lines $twidth = 7; if ($ct == 1) { $twidth += 3; } if ($ct > 1) { if ($i == 0) { //-- adjust for the number of kids $h = ($bhalfheight + 3) * $numkids; print "<td valign=\"bottom\"><img name=\"tvertline\" id=\"vline_{$chil}\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "\" width=\"3\" height=\"{$h}\" alt=\"\" /></td>"; } else { if ($i == $ct - 1) { $h = ($bhalfheight + 3) * $kids; if ($count < $this->dgenerations - 1) { if ($this->show_spouse) { $h -= 15; } else { $h += 15; } } print "<td valign=\"top\"><img name=\"bvertline\" id=\"vline_{$chil}\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "\" width=\"3\" height=\"" . $h . "\" alt=\"\" /></td>"; } else { print "<td style=\"background: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "');\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td>"; } } } print "</tr>"; } print "</table>\n"; } print "</td>\n"; print "<td width=\"{$bwidth}\">"; } // Print the descendency expansion arrow if ($count == $this->dgenerations) { $numkids = 1; $tbwidth = $bwidth + 16; for ($j = $count; $j < $this->dgenerations; $j++) { print "<div style=\"width: " . $tbwidth . "px;\"><br /></div>\n</td>\n<td width=\"{$bwidth}\">"; } $kcount = 0; foreach ($families as $famid => $family) { $kcount += $family->getNumberOfChildren(); } if ($kcount == 0) { print "<div style=\"width: " . $this->arrwidth . "px;\"><br /></div>\n</td>\n<td width=\"{$bwidth}\">"; } else { print "<div style=\"width: " . $this->arrwidth . "px;\"><a href=\"{$pid}\" onclick=\"return ChangeDis('td_" . $pid . "','" . $pid . "','" . $this->show_full . "','" . $this->show_spouse . "','" . $this->box_width . "')\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["larrow"]["other"] . "\" border=\"0\" alt=\"\" /></a></div>\n"; //-- move the arrow up to line up with the correct box if ($this->show_spouse) { foreach ($families as $famid => $family) { /* @var $family Family */ if (!is_null($family)) { $spouse = $family->getSpouse($person); if ($spouse != null) { print "<br /><br /><br />"; } } } } print "</td>\n<td width=\"{$bwidth}\">"; } } print "<table id=\"table2_{$pid}\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td>"; print_pedigree_person($pid); print "</td><td><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" width=\"7\" height=\"3\" alt=\"\" />"; //----- Print the spouse if ($this->show_spouse) { foreach ($families as $famid => $family) { /* @var $family Family */ if (!is_null($family)) { $spouse = $family->getSpouse($person); if ($spouse != null) { print "</td></tr><tr><td align=\"{$otablealign}\">"; //-- shrink the box for the spouses $tempw = $bwidth; $temph = $bheight; $bwidth -= 10; $bheight -= 10; print_pedigree_person($spouse->getXref()); $bwidth = $tempw; $bheight = $temph; $numkids += 0.95; print "</td><td></td>"; } } } //-- add offset divs to make things line up better if ($count == $this->dgenerations) { print "<tr><td colspan\"2\"><div style=\"height: " . $bhalfheight / 2 . "px; width: " . $bwidth . "px;\"><br /></div>"; } } print "</td></tr></table>"; // For the root person, print a down arrow that allows changing the root of tree if ($showNav && $count == 1) { // NOTE: If statement OK if ($person->canDisplayName()) { // -- print left arrow for decendants so that we can move down the tree $famids = $person->getSpouseFamilies(); //-- make sure there is more than 1 child in the family with parents $cfamids = $person->getChildFamilies(); $num = 0; foreach ($cfamids as $famid => $family) { if (!is_null($family)) { $num += $family->getNumberOfChildren(); } } // NOTE: If statement OK if ($num > 0) { print "\n\t\t<div class=\"center\" id=\"childarrow\" dir=\"" . $TEXT_DIRECTION . "\""; print " style=\"position:absolute; width:" . $bwidth . "px; \">"; if ($this->view != "preview") { print "<a href=\"javascript: " . $pgv_lang["show"] . "\" onclick=\"togglechildrenbox(); return false;\" onmouseover=\"swap_image('larrow',3);\" onmouseout=\"swap_image('larrow',3);\">"; print "<img id=\"larrow\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["darrow"]["other"] . "\" border=\"0\" alt=\"\" />"; print "</a><br />"; } print "\n\t\t<div id=\"childbox\" dir=\"" . $TEXT_DIRECTION . "\" style=\"width:" . $bwidth . "px; height:" . $bheight . "px; visibility: hidden;\">"; print "\n\t\t\t<table class=\"person_box\"><tr><td>"; foreach ($famids as $famid => $family) { if (!is_null($family)) { $spouse = $family->getSpouse($person); if (!empty($spouse)) { $spid = $spouse->getXref(); print "\n\t\t\t\t<a href=\"" . encode_url("hourglass.php?pid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}") . "\"><span "; $name = $spouse->getFullName(); $name = rtrim($name); if (hasRTLText($name)) { print "class=\"name2\">"; } else { print "class=\"name1\">"; } print PrintReady($name); print "<br /></span></a>"; } $children = $family->getChildren(); foreach ($children as $id => $child) { $cid = $child->getXref(); print "\n\t\t\t\t <a href=\"" . encode_url("hourglass.php?pid={$cid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}") . "\"><span "; $name = $child->getFullName(); $name = rtrim($name); if (hasRTLText($name)) { print "class=\"name2\">< "; } else { print "class=\"name1\">< "; } print PrintReady($name); print "<br /></span></a>"; } } } //-- do we need to print this arrow? print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["rarrow"]["other"] . "\" border=\"0\" alt=\"\" /> "; //-- print the siblings foreach ($cfamids as $famid => $family) { if (!is_null($family)) { if (!is_null($family->getHusband()) || !is_null($family->getWife())) { print "<span class=\"name1\"><br />" . $pgv_lang["parents"] . "<br /></span>"; $husb = $family->getHusband(); if (!empty($husb)) { $spid = $husb->getXref(); print "\n\t\t\t\t <a href=\"" . encode_url("hourglass.php?pid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}") . "\"><span "; $name = $husb->getFullName(); $name = rtrim($name); if (hasRTLText($name)) { print "class=\"name2\">"; } else { print "class=\"name1\">"; } print PrintReady($name); print "<br /></span></a>"; } $husb = $family->getWife(); if (!empty($husb)) { $spid = $husb->getXref(); print "\n\t\t\t\t <a href=\"" . encode_url("hourglass.php?pid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}") . "\"><span "; $name = $husb->getFullName(); $name = rtrim($name); if (hasRTLText($name)) { print "class=\"name2\">"; } else { print "class=\"name1\">"; } print PrintReady($name); print "<br /></span></a>"; } } $children = $family->getChildren(); $num = $family->getNumberOfChildren(); if ($num > 2) { print "<span class=\"name1\"><br />" . $pgv_lang["siblings"] . "<br /></span>"; } if ($num == 2) { print "<span class=\"name1\"><br />" . $pgv_lang["sibling"] . "<br /></span>"; } foreach ($children as $id => $child) { $cid = $child->getXref(); if ($cid != $pid) { print "\n\t\t\t\t <a href=\"" . encode_url("hourglass.php?pid={$cid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}") . "\"><span "; $name = $child->getFullName(); $name = rtrim($name); if (hasRTLText($name)) { print "class=\"name2\"> "; } else { print "class=\"name1\"> "; } print PrintReady($name); print "<br /></span></a>"; } } } } print "\n\t\t\t</td></tr></table>"; print "\n\t\t</div>"; print "\n\t\t</div>"; } } } print "</td></tr>"; print "</table>"; return $numkids; }
echo $factarray["POST"]; ?> </td><td><input type="text" <?php if ($TEXT_DIRECTION == "rtl" && !hasRTLText($POST)) { echo "dir=\"ltr\""; } ?> name="POST" value="<?php echo PrintReady(htmlspecialchars(strip_tags($POST), ENT_COMPAT, 'UTF-8')); ?> " /></td></tr> <tr><td><?php echo $factarray["CTRY"]; ?> </td><td><input type="text" <?php if ($TEXT_DIRECTION == "rtl" && !hasRTLText($CTRY)) { echo "dir=\"ltr\""; } ?> name="CTRY" value="<?php echo PrintReady(htmlspecialchars(strip_tags($CTRY), ENT_COMPAT, 'UTF-8')); ?> " /></td></tr> </table> <?php } else { ?> <textarea name="ADDR" tabindex="<?php echo $tabkey; ?>