/** * print ASSO RELA information * * Ex1: * <code>1 ASSO @I1@ * 2 RELA Twin</code> * * Ex2: * <code>1 CHR * 2 ASSO @I1@ * 3 RELA Godfather * 2 ASSO @I2@ * 3 RELA Godmother</code> * * @param string $pid person or family ID * @param string $factrec the raw gedcom record to print * @param string $linebr optional linebreak */ function print_asso_rela_record($pid, $factrec, $linebr = false) { global $GEDCOM, $SHOW_ID_NUMBERS, $TEXT_DIRECTION, $pgv_lang, $factarray, $PGV_IMAGE_DIR, $PGV_IMAGES, $view; // get ASSOciate(s) ID(s) $ct = preg_match_all("/\\d ASSO @(.*)@/", $factrec, $match, PREG_SET_ORDER); for ($i = 0; $i < $ct; $i++) { $level = substr($match[$i][0], 0, 1); $pid2 = $match[$i][1]; // get RELAtionship field $assorec = get_sub_record($level, "{$level} ASSO ", $factrec, $i + 1); // if (substr($_SERVER["SCRIPT_NAME"],1) == "pedigree.php") { $rct = preg_match("/\\d RELA (.*)/", $assorec, $rmatch); if ($rct > 0) { // RELAtionship name in user language $key = strtolower(trim($rmatch[1])); $cr = preg_match_all("/sosa_(.*)/", $key, $relamatch, PREG_SET_ORDER); if ($cr > 0) { $rela = get_sosa_name($relamatch[0][1]); } else { if (isset($pgv_lang["{$key}"])) { $rela = $pgv_lang[$key]; } else { $rela = $rmatch[1]; } } $p = strpos($rela, "(="); if ($p > 0) { $rela = trim(substr($rela, 0, $p)); } if ($pid2 == $pid) { print "<span class=\"details_label\">"; } print $rela . ": "; if ($pid2 == $pid) { print "</span>"; } } else { $rela = $factarray["RELA"]; } // default // } // ASSOciate ID link $gedrec = find_gedcom_record($pid2); if (strstr($gedrec, "@ INDI") !== false or strstr($gedrec, "@ SUBM") !== false) { // ID name if (DisplayDetailsByID($pid2) || showLivingNameByID($pid2)) { $name = get_person_name($pid2); $addname = get_add_person_name($pid2); } else { $name = $pgv_lang["private"]; $addname = ""; } print "<a href=\"individual.php?pid={$pid2}&ged={$GEDCOM}\">" . PrintReady($name); // if (!empty($addname)) print "<br />" . PrintReady($addname); if (!empty($addname)) { print " - " . PrintReady($addname); } if ($SHOW_ID_NUMBERS) { print " "; if ($TEXT_DIRECTION == "rtl") { print "‏"; } print "(" . $pid2 . ")"; if ($TEXT_DIRECTION == "rtl") { print "‏"; } } print "</a>"; // ID age if (!strstr($factrec, "_BIRT_")) { $dct = preg_match("/2 DATE (.*)/", $factrec, $dmatch); if ($dct > 0) { print " <span class=\"age\">" . get_age($gedrec, $dmatch[1]) . "</span>"; } } // RELAtionship calculation : for a family print relationship to both spouses if ($view != "preview") { $famrec = find_family_record($pid); if ($famrec) { $parents = find_parents_in_record($famrec); $pid1 = $parents["HUSB"]; if ($pid1 and $pid1 != $pid2) { print " - <a href=\"relationship.php?pid1={$pid1}&pid2={$pid2}&followspouse=1&ged={$GEDCOM}\">[" . $pgv_lang["relationship_chart"] . "<img src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES["sex"]["small"] . "\" title=\"" . $pgv_lang["husband"] . "\" alt=\"" . $pgv_lang["husband"] . "\" class=\"sex_image\" />]</a>"; } $pid1 = $parents["WIFE"]; if ($pid1 and $pid1 != $pid2) { print " - <a href=\"relationship.php?pid1={$pid1}&pid2={$pid2}&followspouse=1&ged={$GEDCOM}\">[" . $pgv_lang["relationship_chart"] . "<img src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES["sexf"]["small"] . "\" title=\"" . $pgv_lang["wife"] . "\" alt=\"" . $pgv_lang["wife"] . "\" class=\"sex_image\" />]</a>"; } } else { if ($pid != $pid2) { print " - <a href=\"relationship.php?pid1={$pid}&pid2={$pid2}&followspouse=1&ged={$GEDCOM}\">[" . $pgv_lang["relationship_chart"] . "]</a>"; } } } } else { if (strstr($gedrec, "@ FAM") !== false) { print "<a href=\"family.php?famid={$pid2}\">"; if ($TEXT_DIRECTION == "ltr") { print " ‎"; } else { print " ‏"; } print "[" . $pgv_lang["view_family"]; if ($SHOW_ID_NUMBERS) { print " ‎({$pid2})‎"; } if ($TEXT_DIRECTION == "ltr") { print "‎]</a>\n"; } else { print "‏]</a>\n"; } } else { print $pgv_lang["unknown"]; if ($SHOW_ID_NUMBERS) { print " "; if ($TEXT_DIRECTION == "rtl") { print "‏"; } print "(" . $pid2 . ")"; if ($TEXT_DIRECTION == "rtl") { print "‏"; } } } } if ($linebr) { print "<br />\n"; } print_fact_notes($assorec, $level + 1); if (substr($_SERVER["SCRIPT_NAME"], 1) == "pedigree.php") { print "<br />"; if (function_exists('print_fact_sources')) { print_fact_sources($assorec, $level + 1); } } } }
/** * print a child ascendancy * * @param string $pid individual Gedcom Id * @param int $sosa child sosa number * @param int $depth the ascendancy depth to show */ function print_child_ascendancy($pid, $sosa, $depth) { global $pgv_lang, $TEXT_DIRECTION, $OLD_PGENS; global $PGV_IMAGE_DIR, $PGV_IMAGES, $Dindent; global $SHOW_EMPTY_BOXES, $pidarr, $box_width; $person = Person::getInstance($pid); // child print "\r\n<li>"; print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><a name=\"sosa" . $sosa . "\"></a>"; $new = ($pid == "" or !isset($pidarr["{$pid}"])); if ($sosa == 1) { print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" height=\"3\" width=\"{$Dindent}\" border=\"0\" alt=\"\" /></td><td>\n"; } else { print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" height=\"3\" width=\"2\" border=\"0\" alt=\"\" />"; print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" height=\"3\" width=\"" . ($Dindent - 2) . "\" border=\"0\" alt=\"\" /></td><td>\n"; } print_pedigree_person($pid, 1, $this->view != "preview"); print "</td>"; print "<td>"; if ($TEXT_DIRECTION == "ltr") { $label = $pgv_lang["ancestry_chart"] . ": " . $pid; } else { $label = $pid . " :" . $pgv_lang["ancestry_chart"]; } if ($sosa > 1) { print_url_arrow($pid, encode_url("?rootid={$pid}&PEDIGREE_GENERATIONS={$OLD_PGENS}&show_full={$this->show_full}&box_width={$box_width}&chart_style={$this->chart_style}"), $label, 3); } print "</td>"; print "<td class=\"details1\"> <span dir=\"ltr\" class=\"person_box" . ($sosa == 1 ? "NN" : ($sosa % 2 ? "F" : "")) . "\"> {$sosa} </span> "; print "</td><td class=\"details1\">"; $relation = ""; if (!$new) { $relation = "<br />[=<a href=\"#sosa" . $pidarr["{$pid}"] . "\">" . $pidarr["{$pid}"] . "</a> - " . get_sosa_name($pidarr["{$pid}"]) . "]"; } else { $pidarr["{$pid}"] = $sosa; } print get_sosa_name($sosa) . $relation; print "</td>"; print "</tr></table>"; if (is_null($person)) { print "</li>"; return; } // parents $famids = $person->getChildFamilies(); $parents = false; $famrec = ""; $famid = ""; foreach ($famids as $famid => $family) { if (!is_null($family)) { $famrec = $family->getGedcomRecord(); $parents = find_parents_in_record($famrec); if ($parents) { break; } } } if (($parents || $SHOW_EMPTY_BOXES) && $new && $depth > 0) { // print marriage info print "<span class=\"details1\" style=\"white-space: nowrap;\" >"; print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" height=\"2\" width=\"{$Dindent}\" border=\"0\" align=\"middle\" alt=\"\" /><a href=\"javascript: " . $pgv_lang["view_family"] . "\" onclick=\"expand_layer('sosa_" . $sosa . "'); return false;\" class=\"top\"><img id=\"sosa_" . $sosa . "_img\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["minus"]["other"] . "\" align=\"middle\" hspace=\"0\" vspace=\"3\" border=\"0\" alt=\"" . $pgv_lang["view_family"] . "\" /></a> "; print " <span class=\"person_box\"> " . $sosa * 2 . " </span> " . $pgv_lang["and"]; print " <span class=\"person_boxF\"> " . ($sosa * 2 + 1) . " </span> "; if (!empty($family)) { $marriage = $family->getMarriage(); if ($marriage->canShow()) { $marriage->print_simple_fact(); } else { print $pgv_lang["private"]; } } print "</span>"; // display parents recursively print "\r\n<ul style=\"list-style: none; display: block;\" id=\"sosa_{$sosa}\">"; $this->print_child_ascendancy($parents["HUSB"], $sosa * 2, $depth - 1); $this->print_child_ascendancy($parents["WIFE"], $sosa * 2 + 1, $depth - 1); print "</ul>\r\n"; } print "</li>\r\n"; }
/** * print the parents table for a family * * @param string $famid family gedcom ID * @param int $sosa optional child sosa number * @param string $label optional indi label (descendancy booklet) * @param string $parid optional parent ID (descendancy booklet) * @param string $gparid optional gd-parent ID (descendancy booklet) */ function print_family_parents($famid, $sosa = 0, $label = "", $parid = "", $gparid = "", $personcount = "1") { global $pgv_lang, $view, $show_full, $show_famlink; global $TEXT_DIRECTION, $SHOW_EMPTY_BOXES, $SHOW_ID_NUMBERS, $LANGUAGE; global $pbwidth, $pbheight; global $PGV_IMAGE_DIR, $PGV_IMAGES; global $show_changes, $pgv_changes, $GEDCOM; $family = Family::getInstance($famid); if (is_null($family)) { return; } $husb = $family->getHusband(); if (is_null($husb)) { $husb = new Person(''); } $wife = $family->getWife(); if (is_null($wife)) { $wife = new Person(''); } if (!is_null($husb)) { $tempID = $husb->getXref(); if (!empty($tempID)) { print "<a name=\"{$tempID}\"></a>\r\n"; } } if (!is_null($wife)) { $tempID = $wife->getXref(); if (!empty($tempID)) { print "<a name=\"{$tempID}\"></a>\r\n"; } } print_family_header($famid); // -- get the new record and parents if in editing show changes mode if (PGV_USER_CAN_EDIT && isset($pgv_changes[$famid . "_" . $GEDCOM])) { $newrec = find_updated_record($famid); $newparents = find_parents_in_record($newrec); } /** * husband side */ print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td rowspan=\"2\">"; print "<span class=\"subheaders\">" . get_sosa_name($sosa * 2) . "</span>"; print "\n\t<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>"; if ($parid) { if ($husb->getXref() == $parid) { print_sosa_number($label); } else { print_sosa_number($label, "", "blank"); } } else { if ($sosa > 0) { print_sosa_number($sosa * 2); } } if (isset($newparents) && $husb->getXref() != $newparents["HUSB"]) { print "\n\t<td valign=\"top\" class=\"facts_valueblue\">"; print_pedigree_person($newparents['HUSB'], 1, $show_famlink, 2, $personcount); } else { print "\n\t<td valign=\"top\">"; print_pedigree_person($husb->getXref(), 1, $show_famlink, 2, $personcount); } print "</td></tr></table>"; print "</td>\n"; // husband's parents $hfams = $husb->getChildFamilies(); $hparents = false; $upfamid = ""; if (count($hfams) > 0 or $sosa != 0 and $SHOW_EMPTY_BOXES) { print "<td rowspan=\"2\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" alt=\"\" /></td><td rowspan=\"2\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "\" width=\"3\" height=\"" . $pbheight . "\" alt=\"\" /></td>"; print "<td><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" alt=\"\" /></td><td>"; $hparents = false; foreach ($hfams as $hfamid => $hfamily) { if (!is_null($hfamily)) { $hparents = find_parents_in_record($hfamily->getGedcomRecord()); $upfamid = $hfamid; break; } } if ($hparents or $sosa != 0 and $SHOW_EMPTY_BOXES) { // husband's father print "\n\t<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>"; if ($sosa > 0) { print_sosa_number($sosa * 4, $hparents['HUSB'], "down"); } if (!empty($gparid) and $hparents['HUSB'] == $gparid) { print_sosa_number(trim(substr($label, 0, -3), ".") . "."); } print "\n\t<td valign=\"top\">"; print_pedigree_person($hparents['HUSB'], 1, $show_famlink, 4, $personcount); print "</td></tr></table>"; } print "</td>"; } if (!empty($upfamid) and $sosa != -1 and $view != "preview") { print "<td valign=\"middle\" rowspan=\"2\">"; print_url_arrow($upfamid, $sosa == 0 ? "?famid={$upfamid}&show_full={$show_full}" : "#{$upfamid}", "{$upfamid}", 1); print "</td>\n"; } if ($hparents or $sosa != 0 and $SHOW_EMPTY_BOXES) { // husband's mother print "</tr><tr><td><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" alt=\"\" /></td><td>"; print "\n\t<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>"; if ($sosa > 0) { print_sosa_number($sosa * 4 + 1, $hparents['WIFE'], "down"); } if (!empty($gparid) and $hparents['WIFE'] == $gparid) { print_sosa_number(trim(substr($label, 0, -3), ".") . "."); } print "\n\t<td valign=\"top\">"; print_pedigree_person($hparents['WIFE'], 1, $show_famlink, 5, $personcount); print "</td></tr></table>"; print "</td>\n"; } print "</tr></table>\n\n"; if ($sosa != 0) { print "<a href=\"family.php?famid={$famid}\" class=\"details1\">"; if ($SHOW_ID_NUMBERS) { print getLRM() . "({$famid})" . getLRM() . " "; } else { print str_repeat(" ", 10); } $marriage = $family->getMarriage(); if ($marriage->canShow()) { $marriage->print_simple_fact(); } else { print $pgv_lang["private"]; } print "</a>"; } else { print "<br />\n"; } /** * wife side */ print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td rowspan=\"2\">"; print "<span class=\"subheaders\">" . get_sosa_name($sosa * 2 + 1) . "</span>"; print "\n\t<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\"><tr>"; if ($parid) { if ($wife->getXref() == $parid) { print_sosa_number($label); } else { print_sosa_number($label, "", "blank"); } } else { if ($sosa > 0) { print_sosa_number($sosa * 2 + 1); } } if (isset($newparents) && $wife->getXref() != $newparents["WIFE"]) { print "\n\t<td valign=\"top\" class=\"facts_valueblue\">"; print_pedigree_person($newparents['WIFE'], 1, $show_famlink, 3, $personcount); } else { print "\n\t<td valign=\"top\">"; print_pedigree_person($wife->getXref(), 1, $show_famlink, 3, $personcount); } print "</td></tr></table>"; print "</td>\n"; // wife's parents $hfams = $wife->getChildFamilies(); $hparents = false; $upfamid = ""; if (count($hfams) > 0 or $sosa != 0 and $SHOW_EMPTY_BOXES) { print "<td rowspan=\"2\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" alt=\"\" /></td><td rowspan=\"2\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "\" width=\"3\" height=\"" . $pbheight . "\" alt=\"\" /></td>"; print "<td><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" alt=\"\" /></td><td>"; $j = 0; foreach ($hfams as $hfamid => $hfamily) { if (!is_null($hfamily)) { $hparents = find_parents_in_record($hfamily->getGedcomRecord()); $upfamid = $hfamid; break; } } if ($hparents or $sosa != 0 and $SHOW_EMPTY_BOXES) { // wife's father print "\n\t<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\"><tr>"; if ($sosa > 0) { print_sosa_number($sosa * 4 + 2, $hparents['HUSB'], "down"); } if (!empty($gparid) and $hparents['HUSB'] == $gparid) { print_sosa_number(trim(substr($label, 0, -3), ".") . "."); } print "\n\t<td valign=\"top\">"; print_pedigree_person($hparents['HUSB'], 1, $show_famlink, 6, $personcount); print "</td></tr></table>"; } print "</td>\n"; } if (!empty($upfamid) and $sosa != -1 and $view != "preview") { print "<td valign=\"middle\" rowspan=\"2\">"; print_url_arrow($upfamid, $sosa == 0 ? "?famid={$upfamid}&show_full={$show_full}" : "#{$upfamid}", "{$upfamid}", 1); print "</td>\n"; } if ($hparents or $sosa != 0 and $SHOW_EMPTY_BOXES) { // wife's mother print "</tr><tr><td><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" alt=\"\" /></td><td>"; print "\n\t<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\"><tr>"; if ($sosa > 0) { print_sosa_number($sosa * 4 + 3, $hparents['WIFE'], "down"); } if (!empty($gparid) and $hparents['WIFE'] == $gparid) { print_sosa_number(trim(substr($label, 0, -3), ".") . "."); } print "\n\t<td valign=\"top\">"; print_pedigree_person($hparents['WIFE'], 1, $show_famlink, 7, $personcount); print "</td></tr></table>\n"; print "</td>\n"; } print "</tr></table>\n\n"; }
/** * print a child ascendancy * * @param $person * @param int $sosa child sosa number * @param int $depth the ascendancy depth to show */ function print_child_ascendancy($person, $sosa, $depth) { global $OLD_PGENS, $WT_IMAGES, $Dindent, $pidarr, $box_width; if ($person) { $pid = $person->getXref(); $label = WT_I18N::translate('Ancestors of %s', $person->getFullName()); } else { $pid = ''; $label = ''; } // child echo '<li>'; echo '<table border="0" cellpadding="0" cellspacing="0"><tr><td><a name="sosa', $sosa, '"></a>'; if ($sosa == 1) { echo '<img src="', $WT_IMAGES['spacer'], '" height="3" width="', $Dindent, '" alt=""></td><td>'; } else { echo '<img src="', $WT_IMAGES['spacer'], '" height="3" width="2" alt="">'; echo '<img src="', $WT_IMAGES['hline'], '" height="3" width="', $Dindent - 2, '" alt=""></td><td>'; } print_pedigree_person($person, 1); echo '</td>'; echo '<td>'; if ($sosa > 1) { print_url_arrow($pid, '?rootid=' . $pid . '&PEDIGREE_GENERATIONS=' . $OLD_PGENS . '&show_full=' . $this->show_full . '&box_width=' . $box_width . '&chart_style=' . $this->chart_style . '&ged=' . WT_GEDURL, $label, 3); } echo '</td>'; echo '<td class="details1"> <span dir="ltr" class="person_box' . ($sosa == 1 ? 'NN' : ($sosa % 2 ? 'F' : '')) . '"> ', $sosa, ' </span> '; echo '</td><td class="details1">'; $relation = ''; $new = ($pid == '' or !isset($pidarr[$pid])); if (!$new) { $relation = '<br>[=<a href="#sosa' . $pidarr[$pid] . '">' . $pidarr[$pid] . '</a> - ' . get_sosa_name($pidarr[$pid]) . ']'; } else { $pidarr[$pid] = $sosa; } echo get_sosa_name($sosa) . $relation; echo '</td>'; echo '</tr></table>'; if (is_null($person)) { echo '</li>'; return; } // parents $family = $person->getPrimaryChildFamily(); if ($family && $new && $depth > 0) { // print marriage info echo '<span class="details1" style="white-space: nowrap;" >'; echo '<img src="', $WT_IMAGES['spacer'], '" height="2" width="', $Dindent, '" align="middle" alt=""><a href="#" onclick="return expand_layer(\'sosa_', $sosa, '\');" class="top"><i id="sosa_', $sosa, '_img" class="icon-minus" title="', WT_I18N::translate('View family'), '"></i></a>'; echo ' <span dir="ltr" class="person_box"> ', $sosa * 2, ' </span> ', WT_I18N::translate('and'); echo ' <span dir="ltr" class="person_boxF"> ', $sosa * 2 + 1, ' </span> '; if ($family->canShow()) { foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>'; } } echo '</span>'; // display parents recursively - or show empty boxes echo '<ul style="list-style: none; display: block;" id="sosa_', $sosa, '">'; $this->print_child_ascendancy($family->getHusband(), $sosa * 2, $depth - 1); $this->print_child_ascendancy($family->getWife(), $sosa * 2 + 1, $depth - 1); echo '</ul>'; } echo '</li>'; }