/** * get the person box stylesheet class for the given person * * @param WT_Individual $person * * @return string returns 'person_box', 'person_boxF', or 'person_boxNN' */ function getPersonStyle($person) { switch ($person->getSex()) { case 'M': $class = 'person_box'; break; case 'F': $class = 'person_boxF'; break; default: $class = 'person_boxNN'; break; } if ($person->isOld()) { $class .= ' old'; } elseif ($person->isNew()) { $class .= ' new'; } return $class; }
/** * print the parents table for a family * * @param WT_Family $family family gedcom ID * @param int $sosa child sosa number * @param string $label indi label (descendancy booklet) * @param string $parid parent ID (descendancy booklet) * @param string $gparid gd-parent ID (descendancy booklet) * @param int $personcount */ function print_family_parents(WT_Family $family, $sosa = 0, $label = '', $parid = '', $gparid = '', $personcount = 1) { global $pbwidth, $pbheight, $WT_IMAGES; $husb = $family->getHusband(); if ($husb) { echo '<a name="', $husb->getXref(), '"></a>'; } else { $husb = new WT_Individual('M', "0 @M@ INDI\n1 SEX M", null, WT_GED_ID); } $wife = $family->getWife(); if ($wife) { echo '<a name="', $wife->getXref(), '"></a>'; } else { $wife = new WT_Individual('F', "0 @F@ INDI\n1 SEX F", null, WT_GED_ID); } if ($sosa) { echo '<p class="name_head">', $family->getFullName(), '</p>'; } /** * husband side */ echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td rowspan=\"2\">"; echo "<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"); } } elseif ($sosa) { print_sosa_number($sosa * 2); } if ($husb->isNew()) { echo '<td valign="top" class="facts_value new">'; } elseif ($husb->isOld()) { echo '<td valign="top" class="facts_value old">'; } else { echo '<td valign="top">'; } print_pedigree_person($husb, 1, 2, $personcount); echo "</td></tr></table>"; echo "</td>"; // husband’s parents $hfam = $husb->getPrimaryChildFamily(); if ($hfam) { // remove the|| test for $sosa echo "<td rowspan=\"2\"><img src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td rowspan=\"2\"><img src=\"" . $WT_IMAGES["vline"] . "\" width=\"3\" height=\"" . ($pbheight + 9) . "\" alt=\"\"></td>"; echo "<td><img class=\"line5\" src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td>"; // husband’s father if ($hfam && $hfam->getHusband()) { echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>"; if ($sosa > 0) { print_sosa_number($sosa * 4, $hfam->getHusband()->getXref(), "down"); } if (!empty($gparid) && $hfam->getHusband()->getXref() == $gparid) { print_sosa_number(trim(substr($label, 0, -3), ".") . "."); } echo "<td valign=\"top\">"; print_pedigree_person(WT_Individual::getInstance($hfam->getHusband()->getXref()), 1, 4, $personcount); echo "</td></tr></table>"; } elseif ($hfam && !$hfam->getHusband()) { // here for empty box for grandfather echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>"; echo '<td valign="top">'; print_pedigree_person($hfam->getHusband()); echo '</td></tr></table>'; } echo "</td>"; } if ($hfam && $sosa != -1) { echo '<td valign="middle" rowspan="2">'; print_url_arrow($hfam->getXref(), $sosa == 0 ? '?famid=' . $hfam->getXref() . '&ged=' . WT_GEDURL : '#' . $hfam->getXref(), $hfam->getXref(), 1); echo '</td>'; } if ($hfam) { // remove the|| test for $sosa // husband’s mother echo "</tr><tr><td><img src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td>"; if ($hfam && $hfam->getWife()) { echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>"; if ($sosa > 0) { print_sosa_number($sosa * 4 + 1, $hfam->getWife()->getXref(), "down"); } if (!empty($gparid) && $hfam->getWife()->getXref() == $gparid) { print_sosa_number(trim(substr($label, 0, -3), ".") . "."); } echo '<td valign="top">'; print_pedigree_person(WT_Individual::getInstance($hfam->getWife()->getXref()), 1, 5, $personcount); echo '</td></tr></table>'; } elseif ($hfam && !$hfam->getWife()) { // here for empty box for grandmother echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>"; echo '<td valign="top">'; print_pedigree_person($hfam->getWife()); echo '</td></tr></table>'; } echo '</td>'; } echo '</tr></table>'; if ($sosa && $family->canShow()) { foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { echo '<a href="', $family->getHtmlUrl(), '" class="details1">'; echo str_repeat(' ', 10); echo $fact->summary(); echo '</a>'; } } else { echo '<br>'; } /** * wife side */ echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td rowspan=\"2\">"; echo "<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"); } } elseif ($sosa) { print_sosa_number($sosa * 2 + 1); } if ($wife->isNew()) { echo '<td valign="top" class="facts_value new">'; } elseif ($wife->isOld()) { echo '<td valign="top" class="facts_value old">'; } else { echo '<td valign="top">'; } print_pedigree_person($wife, 1, 3, $personcount); echo "</td></tr></table>"; echo "</td>"; // wife’s parents $hfam = $wife->getPrimaryChildFamily(); if ($hfam) { // remove the|| test for $sosa echo "<td rowspan=\"2\"><img src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td rowspan=\"2\"><img src=\"" . $WT_IMAGES["vline"] . "\" width=\"3\" height=\"" . ($pbheight + 9) . "\" alt=\"\"></td>"; echo "<td><img class=\"line5\" src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td>"; // wife’s father if ($hfam && $hfam->getHusband()) { echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\"><tr>"; if ($sosa > 0) { print_sosa_number($sosa * 4 + 2, $hfam->getHusband()->getXref(), "down"); } if (!empty($gparid) && $hfam->getHusband()->getXref() == $gparid) { print_sosa_number(trim(substr($label, 0, -3), ".") . "."); } echo "<td valign=\"top\">"; print_pedigree_person(WT_Individual::getInstance($hfam->getHusband()->getXref()), 1, 6, $personcount); echo "</td></tr></table>"; } elseif ($hfam && !$hfam->getHusband()) { // here for empty box for grandfather echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>"; echo '<td valign="top">'; print_pedigree_person($hfam->getHusband()); echo '</td></tr></table>'; } echo "</td>"; } if ($hfam && $sosa != -1) { echo '<td valign="middle" rowspan="2">'; print_url_arrow($hfam->getXref(), $sosa == 0 ? '?famid=' . $hfam->getXref() . '&ged=' . WT_GEDURL : '#' . $hfam->getXref(), $hfam->getXref(), 1); echo '</td>'; } if ($hfam) { // remove the|| test for $sosa // wife’s mother echo "</tr><tr><td><img src=\"" . $WT_IMAGES["hline"] . "\" alt=\"\"></td><td>"; if ($hfam && $hfam->getWife()) { echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\"><tr>"; if ($sosa > 0) { print_sosa_number($sosa * 4 + 3, $hfam->getWife()->getXref(), "down"); } if (!empty($gparid) && $hfam->getWife()->getXref() == $gparid) { print_sosa_number(trim(substr($label, 0, -3), ".") . "."); } echo "<td valign=\"top\">"; print_pedigree_person(WT_Individual::getInstance($hfam->getWife()->getXref()), 1, 7, $personcount); echo "</td></tr></table>"; } elseif ($hfam && !$hfam->getWife()) { // here for empty box for grandmother echo "<table style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\" border=\"0\"><tr>"; echo '<td valign="top">'; print_pedigree_person($hfam->getWife()); echo '</td></tr></table>'; } echo '</td>'; } echo "</tr></table>"; }