function print_person_pedigree($pid, $count) { global $generations, $SHOW_EMPTY_BOXES, $PGV_IMAGE_DIR, $PGV_IMAGES, $bheight, $bhalfheight; if ($count >= $generations) { return; } $famids = find_family_ids($pid); $hheight = ($bhalfheight + 3) * pow(2, $generations - $count - 1); foreach ($famids as $indexval => $famid) { print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"empty-cells: show;\">\n"; $parents = find_parents($famid); $height = "100%"; print "<tr>"; if ($count < $generations - 1) { print "<td height=\"" . $hheight . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td>\n"; print "<td rowspan=\"2\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" width=\"7\" height=\"3\" alt=\"\" /></td>\n"; } print "<td rowspan=\"2\">\n"; print_pedigree_person($parents["HUSB"]); print "</td>\n"; print "<td rowspan=\"2\">\n"; print_person_pedigree($parents["HUSB"], $count + 1); print "</td>\n"; print "</tr>\n<tr>\n<td height=\"" . $hheight . "\""; if ($count < $generations - 1) { print " style=\"background: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "');\" "; } print "><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td></tr>\n<tr>\n"; if ($count < $generations - 1) { print "<td height=\"" . $hheight . "\" style=\"background: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "');\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td>"; print "<td rowspan=\"2\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" width=\"7\" height=\"3\" alt=\"\" /></td>\n"; } print "<td rowspan=\"2\">\n"; print_pedigree_person($parents["WIFE"]); print "</td>\n"; print "<td rowspan=\"2\">\n"; print_person_pedigree($parents["WIFE"], $count + 1); print "</td>\n"; print "</tr>\n"; if ($count < $generations - 1) { print "<tr>\n<td height=\"" . $hheight . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" width=\"3\" alt=\"\" /></td></tr>\n"; } print "</table>\n"; } }
/** * print children informations * @param Family family * @param Array people * @param String family type * @return html table rows */ function printChildrenRows(&$family, &$people, $type) { global $personcount, $pgv_lang, $factarray; global $PGV_IMAGE_DIR, $PGV_IMAGES; $elderdate = $family->getMarriageDate(); foreach ($people["children"] as $key => $child) { $label = $child->getLabel(); if ($label[0] == '+') { $styleadd = "blue"; } else { if ($label[0] == '-') { $styleadd = "red"; } else { $styleadd = ""; } } ?> <tr> <td class="facts_label<?php print $styleadd; ?> "><?php if ($styleadd == "red") { print $child->getLabel(); } else { print $child->getLabel($elderdate, $key + 1); } ?> </td> <td class="<?php print $this->getPersonStyle($child); ?> "> <?php print_pedigree_person($child->getXref(), 2, !$this->isPrintPreview(), 0, $personcount++); ?> </td> </tr> <?php $elderdate = $child->getBirthDate(); } if (isset($family) && !$this->isPrintPreview() && PGV_USER_CAN_EDIT && $this->indi->canDisplayDetails()) { if ($type == "spouse") { $action = "add_son_daughter"; $child_m = "son"; $child_f = "daughter"; } else { $action = "add_sibling"; $child_m = "brother"; $child_f = "sister"; } ?> <tr> <td class="facts_label"> <?php if (PGV_USER_CAN_EDIT && isset($people["children"][1])) { ?> <a href="javascript:;" onclick="reorder_children('<?php print $family->getXref(); ?> ');tabswitch(5);"><img src="images/topdown.gif" alt="" border="0" /> <?php print $pgv_lang['reorder_children']; ?> </a> <?php } ?> </td> <td class="facts_value"><?php print_help_link($action . "_help", "qm"); ?> <a href="javascript:;" onclick="return addnewchild('<?php print $family->getXref(); ?> ');"><?php print $pgv_lang[$action]; ?> </a> <span style='white-space:nowrap;'> <a href="javascript:;" onclick="return addnewchild('<?php print $family->getXref(); ?> ','M');"><?php echo Person::sexImage('M', 'small', '', $pgv_lang[$child_m]); ?> </a> <a href="javascript:;" onclick="return addnewchild('<?php print $family->getXref(); ?> ','F');"><?php echo Person::sexImage('F', 'small', '', $pgv_lang[$child_f]); ?> </a> </span> </td> </tr> <?php } }
switch ($controller->chart_style) { case 0: // List $pidarr = array(); echo '<ul id="ancestry_chart">'; $controller->print_child_ascendancy($controller->root, 1, $OLD_PGENS - 1); echo '</ul>'; echo '<br>'; break; case 1: // TODO: this should be a parameter to a function, not a global $show_cousins = $controller->show_cousins; echo '<div id="ancestry_chart">'; // Booklet // first page : show indi facts print_pedigree_person($controller->root, 1, 1); // process the tree $treeid = ancestry_array($controller->root->getXref(), $PEDIGREE_GENERATIONS - 1); foreach ($treeid as $i => $pid) { if ($pid) { $person = WT_Individual::getInstance($pid); if ($person) { foreach ($person->getChildFamilies() as $family) { print_sosa_family($family->getXref(), $pid, $i); } } } } echo '</div>'; break; case 2:
/** * print cousins list * * @param string $famid family ID */ function print_cousins($famid, $personcount = "1") { global $show_full, $bheight, $bwidth; global $PGV_IMAGE_DIR, $PGV_IMAGES, $pgv_lang, $TEXT_DIRECTION; $family = Family::getInstance($famid); $fchildren = $family->getChildrenIds(); $kids = count($fchildren); $save_show_full = $show_full; if ($save_show_full) { $bheight /= 4; $bwidth -= 40; } $show_full = false; print "<td valign=\"middle\" height=\"100%\">"; if ($kids) { print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" ><tr valign=\"middle\">"; if ($kids > 1) { print "<td rowspan=\"" . $kids . "\" valign=\"middle\" align=\"right\"><img width=\"3px\" height=\"" . ($bheight + 5) * ($kids - 1) . "px\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "\" alt=\"\" /></td>"; } $ctkids = count($fchildren); $i = 1; foreach ($fchildren as $indexval => $fchil) { print "<td><img width=\"10px\" height=\"3px\" style=\"padding-"; if ($TEXT_DIRECTION == "ltr") { print "right"; } else { print "left"; } print ": 2px;\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" alt=\"\" /></td><td>"; print_pedigree_person($fchil, 1, false, 0, $personcount); $personcount++; print "</td></tr>"; if ($i < $ctkids) { print "<tr>"; $i++; } } print "</table>"; } else { $famrec = find_family_record($famid); $ct = preg_match("/1 NCHI (\\w+)/", $famrec, $match); if ($ct > 0) { $nchi = $match[1]; } else { $nchi = ""; } if ($nchi == "0") { print " <img src=\"images/small/childless.gif\" alt=\"" . $pgv_lang["childless_family"] . "\" title=\"" . $pgv_lang["childless_family"] . "\" />"; } } $show_full = $save_show_full; if ($save_show_full) { $bheight *= 4; $bwidth += 40; } print "</td>\n"; }
public function getBlock($block_id, $template = true, $cfg = null) { global $ctype, $show_full, $PEDIGREE_FULL_DETAILS, $controller; self::updateSchema(); // make sure the favorites table has been created $action = WT_Filter::get('action'); switch ($action) { case 'deletefav': $favorite_id = WT_Filter::getInteger('favorite_id'); if ($favorite_id) { self::deleteFavorite($favorite_id); } break; case 'addfav': $gid = WT_Filter::get('gid', WT_REGEX_XREF); $favnote = WT_Filter::get('favnote'); $url = WT_Filter::getUrl('url'); $favtitle = WT_Filter::get('favtitle'); if ($gid) { $record = WT_GedcomRecord::getInstance($gid); if ($record && $record->canShow()) { self::addFavorite(array('user_id' => $ctype == 'user' ? WT_USER_ID : null, 'gedcom_id' => WT_GED_ID, 'gid' => $record->getXref(), 'type' => $record::RECORD_TYPE, 'url' => null, 'note' => $favnote, 'title' => $favtitle)); } } elseif ($url) { self::addFavorite(array('user_id' => $ctype == 'user' ? WT_USER_ID : null, 'gedcom_id' => WT_GED_ID, 'gid' => null, 'type' => 'URL', 'url' => $url, 'note' => $favnote, 'title' => $favtitle ? $favtitle : $url)); } break; } $block = get_block_setting($block_id, 'block', false); if ($cfg) { foreach (array('block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } } // Override GEDCOM configuration temporarily if (isset($show_full)) { $saveShowFull = $show_full; } $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS; $show_full = 1; $PEDIGREE_FULL_DETAILS = 1; $userfavs = $this->getFavorites($ctype == 'user' ? WT_USER_ID : WT_GED_ID); if (!is_array($userfavs)) { $userfavs = array(); } $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; $title = $this->getTitle(); if (WT_USER_ID) { $controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();'); } $content = ''; $style = 2; // 1 means "regular box", 2 means "wide box" if ($userfavs) { foreach ($userfavs as $key => $favorite) { if (isset($favorite['id'])) { $key = $favorite['id']; } $removeFavourite = '<a class="font9" href="index.php?ctype=' . $ctype . '&action=deletefav&favorite_id=' . $key . '" onclick="return confirm(\'' . WT_I18N::translate('Are you sure you want to remove this item from your list of favorites?') . '\');">' . WT_I18N::translate('Remove') . '</a> '; if ($favorite['type'] == 'URL') { $content .= '<div id="boxurl' . $key . '.0" class="person_box">'; if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) { $content .= $removeFavourite; } $content .= '<a href="' . $favorite['url'] . '"><b>' . $favorite['title'] . '</b></a>'; $content .= '<br>' . $favorite['note']; $content .= '</div>'; } else { $record = WT_GedcomRecord::getInstance($favorite['gid']); if ($record && $record->canShow()) { if ($record instanceof WT_Individual) { $content .= '<div id="box' . $favorite["gid"] . '.0" class="person_box action_header'; switch ($record->getsex()) { case 'M': break; case 'F': $content .= 'F'; break; case 'U': $content .= 'NN'; break; } $content .= '">'; if ($ctype == "user" || WT_USER_GEDCOM_ADMIN) { $content .= $removeFavourite; } ob_start(); print_pedigree_person($record, $style, 1, $key); $content .= ob_get_clean(); $content .= $favorite['note']; $content .= '</div>'; } else { $content .= '<div id="box' . $favorite['gid'] . '.0" class="person_box">'; if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) { $content .= $removeFavourite; } $content .= $record->format_list('span'); $content .= '<br>' . $favorite['note']; $content .= '</div>'; } } } } } if ($ctype == 'user' || WT_USER_GEDCOM_ADMIN) { $uniqueID = Uuid::uuid4(); // This block can theoretically appear multiple times, so use a unique ID. $content .= '<div class="add_fav_head">'; $content .= '<a href="#" onclick="return expand_layer(\'add_fav' . $uniqueID . '\');">' . WT_I18N::translate('Add a new favorite') . '<i id="add_fav' . $uniqueID . '_img" class="icon-plus"></i></a>'; $content .= '</div>'; $content .= '<div id="add_fav' . $uniqueID . '" style="display: none;">'; $content .= '<form name="addfavform" method="get" action="index.php">'; $content .= '<input type="hidden" name="action" value="addfav">'; $content .= '<input type="hidden" name="ctype" value="' . $ctype . '">'; $content .= '<input type="hidden" name="ged" value="' . WT_GEDCOM . '">'; $content .= '<div class="add_fav_ref">'; $content .= '<input type="radio" name="fav_category" value="record" checked="checked" onclick="jQuery(\'#gid' . $uniqueID . '\').removeAttr(\'disabled\'); jQuery(\'#url, #favtitle\').attr(\'disabled\',\'disabled\').val(\'\');">'; $content .= '<label for="gid' . $uniqueID . '">' . WT_I18N::translate('Enter an individual, family, or source ID') . '</label>'; $content .= '<input class="pedigree_form" data-autocomplete-type="IFSRO" type="text" name="gid" id="gid' . $uniqueID . '" size="5" value="">'; $content .= ' ' . print_findindi_link('gid' . $uniqueID); $content .= ' ' . print_findfamily_link('gid' . $uniqueID); $content .= ' ' . print_findsource_link('gid' . $uniqueID); $content .= ' ' . print_findrepository_link('gid' . $uniqueID); $content .= ' ' . print_findnote_link('gid' . $uniqueID); $content .= ' ' . print_findmedia_link('gid' . $uniqueID); $content .= '</div>'; $content .= '<div class="add_fav_url">'; $content .= '<input type="radio" name="fav_category" value="url" onclick="jQuery(\'#url, #favtitle\').removeAttr(\'disabled\'); jQuery(\'#gid' . $uniqueID . '\').attr(\'disabled\',\'disabled\').val(\'\');">'; $content .= '<input type="text" name="url" id="url" size="20" value="" placeholder="' . WT_Gedcom_Tag::getLabel('URL') . '" disabled="disabled"> '; $content .= '<input type="text" name="favtitle" id="favtitle" size="20" value="" placeholder="' . WT_I18N::translate('Title') . '" disabled="disabled">'; $content .= '<p>' . WT_I18N::translate('Enter an optional note about this favorite') . '</p>'; $content .= '<textarea name="favnote" rows="6" cols="50"></textarea>'; $content .= '</div>'; $content .= '<input type="submit" value="' . WT_I18N::translate('Add') . '">'; $content .= '</form></div>'; } if ($template) { if ($block) { require WT_THEME_DIR . 'templates/block_small_temp.php'; } else { require WT_THEME_DIR . 'templates/block_main_temp.php'; } } else { return $content; } // Restore GEDCOM configuration unset($show_full); if (isset($saveShowFull)) { $show_full = $saveShowFull; } $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails; }
/** * print a family descendancy * * @param WT_Individual $person * @param WT_Family $family * @param int $depth the descendancy depth to show * * @return void */ function print_family_descendancy(WT_Individual $person, WT_Family $family, $depth) { global $WT_IMAGES, $Dindent, $personcount; // print marriage info echo '<li>'; echo '<img src="', $WT_IMAGES['spacer'], '" height="2" width="', $Dindent + 4, '" alt="">'; echo '<span class="details1" style="white-space:nowrap;">'; echo "<a href=\"#\" onclick=\"expand_layer('" . $family->getXref() . $personcount . "'); return false;\" class=\"top\"><i id=\"" . $family->getXref() . $personcount . "_img\" class=\"icon-minus\" title=\"" . WT_I18N::translate('View family') . "\"></i></a>"; if ($family->canShow()) { foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { echo ' <a href="', $family->getHtmlUrl(), '" class="details1">', $fact->summary(), '</a>'; } } echo '</span>'; // print spouse $spouse = $family->getSpouse($person); echo '<ul style="list-style:none; display:block;" id="' . $family->getXref() . $personcount . '">'; echo '<li>'; echo '<table border="0" cellpadding="0" cellspacing="0"><tr><td>'; print_pedigree_person($spouse, 1, 0, $personcount); echo '</td>'; // check if spouse has parents and add an arrow echo '<td> </td>'; echo '<td>'; if ($spouse) { foreach ($spouse->getChildFamilies() as $cfamily) { foreach ($cfamily->getSpouses() as $parent) { print_url_arrow($parent->getXref() . $personcount . $person->getXref(), '?rootid=' . $parent->getXref() . '&generations=' . $this->generations . '&chart_style=' . $this->chart_style . '&show_full=' . $this->show_full . '&box_width=' . $this->box_width . '&ged=' . WT_GEDURL, WT_I18N::translate('Start at parents'), 2); $personcount++; // only show the arrow for one of the parents break; } } } if ($this->show_full) { echo '<br><br> '; } echo '</td></tr>'; // children $children = $family->getChildren(); echo '<tr><td colspan="3" class="details1" > '; if ($children) { echo WT_Gedcom_Tag::getLabel('NCHI') . ': ' . count($children); } else { // Distinguish between no children (NCHI 0) and no recorded // children (no CHIL records) if (strpos($family->getGedcom(), '\\n1 NCHI 0')) { echo WT_Gedcom_Tag::getLabel('NCHI') . ': ' . count($children); } else { echo WT_I18N::translate('No children'); } } echo '</td></tr></table>'; echo '</li>'; if ($depth > 1) { foreach ($children as $child) { $personcount++; $this->print_child_descendancy($child, $depth - 1); } } echo '</ul>'; echo '</li>'; }
function printFamily(WT_Family $family, $type, $label) { global $controller; global $personcount; // TODO: use a unique id instead? global $SHOW_PRIVATE_RELATIONSHIPS; if ($SHOW_PRIVATE_RELATIONSHIPS) { $access_level = WT_PRIV_HIDE; } else { $access_level = WT_USER_ACCESS_LEVEL; } ?> <table> <tr> <td> <i class="icon-cfamily"></i> </td> <td> <span class="subheaders"> <?php echo $label; ?> </span> - <a href="<?php echo $family->getHtmlUrl(); ?> "><?php echo WT_I18N::translate('View family'); ?> </a> </td> </tr> </table> <table class="facts_table"> <?php ///// HUSB ///// $found = false; foreach ($family->getFacts('HUSB', false, $access_level) as $fact) { $found |= !$fact->isOld(); $person = $fact->getTarget(); if ($person instanceof WT_Individual) { if ($fact->isNew()) { $class = 'facts_label new'; } elseif ($fact->isOld()) { $class = 'facts_label old'; } else { $class = 'facts_label'; } ?> <tr> <td class="<?php echo $class; ?> "> <?php echo get_close_relationship_name($controller->record, $person); ?> </td> <td class="<?php echo $controller->getPersonStyle($person); ?> "> <?php print_pedigree_person($person, 2, 0, $personcount++); ?> </td> </tr> <?php } } if (!$found && $family->canEdit()) { ?> <tr> <td class="facts_label"> </td> <td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php echo $family->getXref(); ?> ', 'HUSB');"><?php echo WT_I18N::translate('Add a husband to this family'); ?> </a></td> </tr> <?php } ///// WIFE ///// $found = false; foreach ($family->getFacts('WIFE', false, $access_level) as $fact) { $person = $fact->getTarget(); if ($person instanceof WT_Individual) { $found |= !$fact->isOld(); if ($fact->isNew()) { $class = 'facts_label new'; } elseif ($fact->isOld()) { $class = 'facts_label old'; } else { $class = 'facts_label'; } ?> <tr> <td class="<?php echo $class; ?> "> <?php echo get_close_relationship_name($controller->record, $person); ?> </td> <td class="<?php echo $controller->getPersonStyle($person); ?> "> <?php print_pedigree_person($person, 2, 0, $personcount++); ?> </td> </tr> <?php } } if (!$found && $family->canEdit()) { ?> <tr> <td class="facts_label"> </td> <td class="facts_value"><a href="#" onclick="return add_spouse_to_family('<?php echo $family->getXref(); ?> ', 'WIFE');"><?php echo WT_I18N::translate('Add a wife to this family'); ?> </a></td> </tr> <?php } ///// MARR ///// $found = false; $prev = new WT_Date(''); foreach ($family->getFacts(WT_EVENTS_MARR) as $fact) { $found |= !$fact->isOld(); if ($fact->isNew()) { $class = ' new'; } elseif ($fact->isOld()) { $class = ' old'; } else { $class = ''; } ?> <tr> <td class="facts_label"> </td> <td class="facts_value<?php echo $class; ?> "> <?php echo WT_Gedcom_Tag::getLabelValue($fact->getTag(), $fact->getDate()->Display(false) . ' — ' . $fact->getPlace()->getFullName()); ?> </td> </tr> <?php if (!$prev->isOK() && $fact->getDate()->isOK()) { $prev = $fact->getDate(); } } if (!$found && $family->canShow() && $family->canEdit()) { // Add a new marriage ?> <tr> <td class="facts_label"> </td> <td class="facts_value"> <a href="#" onclick="return add_new_record('<?php echo $family->getXref(); ?> ', 'MARR');"> <?php echo WT_I18N::translate('Add marriage details'); ?> </a> </td> </tr> <?php } ///// CHIL ///// $child_number = 0; foreach ($family->getFacts('CHIL', false, $access_level) as $fact) { $person = $fact->getTarget(); if ($person instanceof WT_Individual) { if ($fact->isNew()) { $child_number++; $class = 'facts_label new'; } elseif ($fact->isOld()) { $class = 'facts_label old'; } else { $child_number++; $class = 'facts_label'; } $next = new WT_Date(''); foreach ($person->getFacts(WT_EVENTS_BIRT) as $bfact) { if ($bfact->getDate()->isOK()) { $next = $bfact->getDate(); break; } } ?> <tr> <td class="<?php echo $class; ?> "> <?php echo self::ageDifference($prev, $next, $child_number); ?> <?php echo get_close_relationship_name($controller->record, $person); ?> </td> <td class="<?php echo $controller->getPersonStyle($person); ?> "> <?php print_pedigree_person($person, 2, 0, $personcount++); ?> </td> </tr> <?php $prev = $next; } } // Re-order children / add a new child if ($family->canEdit()) { if ($type == 'FAMS') { $child_u = WT_I18N::translate('Add a new son or daughter'); $child_m = WT_I18N::translate('son'); $child_f = WT_I18N::translate('daughter'); } else { $child_u = WT_I18N::translate('Add a new brother or sister'); $child_m = WT_I18N::translate('brother'); $child_f = WT_I18N::translate('sister'); } ?> <tr> <td class="facts_label"> <?php if (count($family->getChildren()) > 1) { ?> <a href="#" onclick="reorder_children('<?php echo $family->getXref(); ?> ');tabswitch(5);"><i class="icon-media-shuffle"></i> <?php echo WT_I18N::translate('Re-order children'); ?> </a> <?php } ?> </td> <td class="facts_value"> <a href="#" onclick="return add_child_to_family('<?php echo $family->getXref(); ?> ');"><?php echo $child_u; ?> </a> <span style='white-space:nowrap;'> <a href="#" class="icon-sex_m_15x15" onclick="return add_child_to_family('<?php echo $family->getXref(); ?> ','M');"></a> <a href="#" class="icon-sex_f_15x15" onclick="return add_child_to_family('<?php echo $family->getXref(); ?> ','F');"></a> </span> </td> </tr> <?php } echo '</table>'; return; }
/** * 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; }
if ($talloffset == 2) { $zindex = $PEDIGREE_GENERATIONS - $curgen; } else { $zindex = 0; } if ($talloffset == 3 && $curgen == 1) { $yoffset += 25; } if ($talloffset == 3 && $curgen == 2) { $yoffset += 10; } echo $xoffset, "px; top:", $yoffset, "px; width:", $controller->pbwidth, "px; height:", $controller->pbheight, "px; z-index:", $zindex, ";\">"; if (!isset($controller->treeid[$i])) { $controller->treeid[$i] = false; } print_pedigree_person(WT_Individual::getInstance($controller->treeid[$i]), 1, $iref, 1); if ($can_go_back) { $did = 1; if ($i > (int) ($controller->treesize / 2) + (int) ($controller->treesize / 4)) { $did++; } if ($TEXT_DIRECTION == "rtl") { $posn = 'right'; $arrow = 'icon-larrow'; } else { $posn = 'left'; $arrow = 'icon-rarrow'; } if ($talloffset == 3) { echo '<div class="ancestorarrow" style="position:absolute; ', $posn, ':', $controller->pbwidth / 2, 'px; top:', $controller->pbheight, 'px;">'; echo '<a href="pedigree.php?PEDIGREE_GENERATIONS=' . $controller->PEDIGREE_GENERATIONS . '&rootid=' . $controller->treeid[$did] . '&show_full=' . $controller->show_full . '&talloffset=' . $controller->talloffset . ' class="icon-darrow noprint"></a>';
/** * print a family descendancy * * @param string $pid individual Gedcom Id * @param Family $famid family record * @param int $depth the descendancy depth to show */ function print_family_descendancy(&$person, &$family, $depth) { global $pgv_lang, $factarray; global $GEDCOM, $PGV_IMAGE_DIR, $PGV_IMAGES, $Dindent, $personcount; if (is_null($family)) { return; } if (is_null($person)) { return; } $famrec = $family->getGedcomRecord(); $famid = $family->getXref(); $parents = find_parents($famid); if ($parents) { // spouse id $id = $parents["WIFE"]; if ($id == $person->getXref()) { $id = $parents["HUSB"]; } // print marriage info print "<li>"; print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["spacer"]["other"] . "\" height=\"2\" width=\"" . ($Dindent + 4) . "\" border=\"0\" alt=\"\" />"; print "<span class=\"details1\" style=\"white-space: nowrap; \" >"; print "<a href=\"#\" onclick=\"expand_layer('" . $famid . $personcount . "'); return false;\" class=\"top\"><img id=\"" . $famid . $personcount . "_img\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["minus"]["other"] . "\" align=\"middle\" hspace=\"0\" vspace=\"3\" border=\"0\" alt=\"" . $pgv_lang["view_family"] . "\" /></a> "; echo '<a href="', encode_url("family.php?famid={$famid}&ged={$GEDCOM}"), '" class="details1">'; $marriage = $family->getMarriage(); if ($marriage->canShow()) { $marriage->print_simple_fact(); } else { print $pgv_lang["private"]; } echo "</a>"; print "</span>"; // print spouse print "<ul style=\"list-style: none; display: block;\" id=\"" . $famid . $personcount . "\">"; print "<li>"; print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td>"; print_pedigree_person($id, 1, $this->view != "preview", '' . $personcount); print "</td>"; // check if spouse has parents and add an arrow print "<td> </td>"; print "<td>"; $sfamids = find_family_ids($id); foreach ($sfamids as $indexval => $sfamid) { $parents = find_parents($sfamid); if ($parents) { $parid = $parents["HUSB"]; if ($parid == "") { $parid = $parents["WIFE"]; } if ($parid != "") { print_url_arrow($parid . $personcount . $person->getXref(), encode_url("?pid={$parid}&generations={$this->generations}&show_full={$this->show_full}&box_width={$this->box_width}"), $pgv_lang["start_at_parents"], 2); $personcount++; } } } if ($this->show_full) { print "<br /><br /> "; } print "</td></tr>"; // children $children = $family->getChildren(); print "<tr><td colspan=\"3\" class=\"details1\" > "; if (count($children) < 1) { print $pgv_lang["no_children"]; } else { print $factarray["NCHI"] . ": " . count($children); } print "</td></tr></table>"; print "</li>\r\n"; if ($depth > 0) { foreach ($children as $child) { $personcount++; $this->print_child_descendancy($child, $depth - 1); } } print "</ul>\r\n"; print "</li>\r\n"; } }
static function _getFavorites($isged = true) { global $GEDCOM, $pgv_lang; global $pgv_lang, $factarray, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $ctype, $TEXT_DIRECTION, $INDEX_DIRECTORY; global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE; // Override GEDCOM configuration temporarily if (isset($show_full)) { $saveShowFull = $show_full; } $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS; $show_full = 1; $PEDIGREE_FULL_DETAILS = 1; if ($isged) { $userfavs = getUserFavorites($GEDCOM); } else { $userfavs = getUserFavorites(PGV_USER_ID); } $content = ''; if (!count($userfavs)) { if ($isged) { if (PGV_USER_GEDCOM_ADMIN) { $content .= print_text('no_favorites', 0, 1); } else { $content .= print_text('no_gedcom_favorites', 0, 1); } } else { print_text('no_favorites', 0, 1); } } else { if (!$isged) { $mygedcom = $GEDCOM; $current_gedcom = $GEDCOM; } $content .= "<table width=\"99%\" style=\"border:none\" cellspacing=\"3px\" class=\"center {$TEXT_DIRECTION}\">"; foreach ($userfavs as $k => $favorite) { if (isset($favorite['id'])) { $k = $favorite['id']; } $removeFavourite = "<a class=\"font9\" href=\"" . encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$k}") . "\" onclick=\"return confirm('{$pgv_lang['confirm_fav_remove']}');\">{$pgv_lang['remove']}</a><br />\n"; if (!$isged) { $current_gedcom = $GEDCOM; $GEDCOM = $favorite['file']; } $content .= '<tr><td>'; if ($favorite['type'] == 'URL') { $content .= "<div id=\"boxurl{$k}.0\" class=\"person_box\">\n"; if ($ctype == 'user' || PGV_USER_GEDCOM_ADMIN) { $content .= $removeFavourite; } $content .= "<a href=\"{$favorite['url']}\"><b>" . PrintReady($favorite['title']) . '</b></a>'; $content .= "<br />\n" . PrintReady($favorite['note'], false, true); $content .= "</div>\n"; } else { if (displayDetailsById($favorite['gid'], $favorite['type'])) { require "{$INDEX_DIRECTORY}{$GEDCOM}_conf.php"; switch ($favorite['type']) { case 'INDI': $indirec = find_person_record($favorite['gid']); $content .= "<div id=\"box{$favorite['gid']}.0\" class=\"person_box"; if (preg_match("/1 SEX F/", $indirec) > 0) { $content .= 'F'; } elseif (preg_match("/1 SEX M/", $indirec) > 0) { $content .= ''; } else { $content .= 'NN'; } $content .= "\">\n"; if ($ctype == 'user' || PGV_USER_GEDCOM_ADMIN) { $content .= $removeFavourite; } ob_start(); print_pedigree_person($favorite['gid'], 2, 1, $k); $content .= ob_get_clean(); $content .= PrintReady($favorite['note'], false, true); $content .= "</div>\n"; break; default: $record = GedcomRecord::getInstance($favorite['gid']); $content .= "<div id=\"box{$favorite['gid']}.0\" class=\"person_box\">\n"; if ($ctype == 'user' || PGV_USER_GEDCOM_ADMIN) { $content .= $removeFavourite; } $content .= $record->format_list('span'); $content .= "<br />\n" . PrintReady($favorite['note'], false, true); $content .= "</div>\n"; break; } if (!$isged) { $GEDCOM = $mygedcom; require "{$INDEX_DIRECTORY}{$GEDCOM}_conf.php"; } } } $content .= "</div>\n" . "</td></tr>\n"; } $content .= "</table>\n"; } if ($isged && PGV_USER_GEDCOM_ADMIN || !$isged) { $content .= ' <script language="JavaScript" type="text/javascript"> var pastefield; function paste_id(value) { pastefield.value=value; } </script> <br /> '; $uniqueID = floor(microtime() * 1000000); if ($isged) { $content .= print_help_link('index_add_favorites_help', 'qm', '', false, true) . "<b><a href=\"javascript://{$pgv_lang['add_favorite']} \" onclick=\"expand_layer('add_ged_fav'); return false;\"><img id=\"add_ged_fav_img\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['plus']['other']}\" border=\"0\" alt=\"\" /> {$pgv_lang['add_favorite']}</a></b>" . "<br />\n<div id=\"add_ged_fav\" style=\"display: none;\">\n" . "<form name=\"addgfavform\" method=\"post\" action=\"index.php\">\n" . "<input type=\"hidden\" name=\"favtype\" value=\"gedcom\" />\n"; } else { $content .= print_help_link('index_add_favorites_help', 'qm', '', false, true) . "<b><a href=\"javascript://{$pgv_lang['add_favorite']} \" onclick=\"expand_layer('add_user_fav'); return false;\"><img id=\"add_user_fav_img\" src=\"{$PGV_IMAGE_DIR}/{$PGV_IMAGES['plus']['other']}\" border=\"0\" alt=\"\" /> {$pgv_lang['add_favorite']}</a></b>" . "<br />\n<div id=\"add_user_fav\" style=\"display: none;\">\n" . "<form name=\"addufavform\" method=\"post\" action=\"index.php\">\n" . "<input type=\"hidden\" name=\"favtype\" value=\"user\" />\n"; } $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />\n" . "<input type=\"hidden\" name=\"ctype\" value=\"{$ctype}\" />\n" . "<input type=\"hidden\" name=\"ged\" value=\"{$GEDCOM}\" />\n" . "<table width=\"99%\" style=\"border:none\" cellspacing=\"3px\" class=\"center {$TEXT_DIRECTION}\">" . "<tr><td>{$pgv_lang['add_fav_enter_id']}<br />\n" . "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />" . print_findindi_link("gid{$uniqueID}", '', true) . print_findfamily_link("gid{$uniqueID}", '', true) . print_findsource_link("gid{$uniqueID}", '', true) . print_findrepository_link("gid{$uniqueID}", '', true) . print_findnote_link("gid{$uniqueID}", '', true) . print_findmedia_link("gid{$uniqueID}", '1', '', true) . "<br />\n{$pgv_lang['add_fav_or_enter_url']}" . "<table><tr><td>{$pgv_lang['url']}</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>" . "<tr><td>{$pgv_lang['title']}</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>" . "\n</td><td>" . "\n{$pgv_lang['add_fav_enter_note']}" . "<br />\n<textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>" . "</td></tr></table>\n" . "<br />\n<input type=\"submit\" value=\"{$pgv_lang['add']}\" style=\"font-size: 8pt; \" />" . "\n</form></div>\n"; } // Restore GEDCOM configuration unset($show_full); if (isset($saveShowFull)) { $show_full = $saveShowFull; } $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails; return $content; }
} $children[$child->getXref()] = $sortkey; } if (!empty($option) && $option == "bybirth") { asort($children); } $i = 0; $show_full = 1; // Force details to show for each child foreach ($children as $id => $child) { echo "<li style=\"cursor:move;margin-bottom:2px;\""; if (!in_array($id, $ids)) { echo " class=\"facts_valueblue\""; } echo " id=\"li_{$id}\" >"; print_pedigree_person($id, 2, false); echo "<input type=\"hidden\" name=\"order[{$id}]\" value=\"{$i}\"/>"; echo "</li>"; $i++; } ?> </ul> <?php echo PGV_JS_START; ?> new Effect.BlindDown('reorder_list', {duration: 1}); Sortable.create('reorder_list', { scroll:window, onUpdate : function() { inputs = $('reorder_list').getElementsByTagName("input");
/** * 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>'; }
function print_user_favorites($block = true, $config = "", $side, $index) { global $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $TEXT_DIRECTION, $INDEX_DIRECTORY, $MEDIA_DIRECTORY, $MULTI_MEDIA, $MEDIA_DIRECTORY_LEVELS, $ctype; global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE; // Override GEDCOM configuration temporarily if (isset($show_full)) { $saveShowFull = $show_full; } $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS; $show_full = 1; $PEDIGREE_FULL_DETAILS = 1; $userfavs = getUserFavorites(PGV_USER_NAME); if (!is_array($userfavs)) { $userfavs = array(); } $id = "user_favorites"; $title = print_help_link("mygedview_favorites_help", "qm", "", false, true); $title .= $pgv_lang["my_favorites"] . " "; if ($TEXT_DIRECTION == "rtl") { $title .= getRLM(); } $title .= "(" . count($userfavs) . ")"; if ($TEXT_DIRECTION == "rtl") { $title .= getRLM(); } if ($ENABLE_AUTOCOMPLETE) { $content = '<script type="text/javascript" src="js/jquery/jquery.min.js"></script> <script type="text/javascript" src="js/jquery/jquery.autocomplete.js"></script> <script type="text/javascript" src="js/jquery/jquery.ajaxQueue.js"></script> <script type="text/javascript"> jQuery.noConflict(); // @see http://docs.jquery.com/Using_jQuery_with_Other_Libraries/ jQuery(document).ready(function($){ $("input[name^=gid]").autocomplete("autocomplete.php", { extraParams: {field:"IFSRO"}, formatItem: function(row, i) { return row[0] + " (" + row[1] + ")"; }, formatResult: function(row) { return row[1]; }, width: 400, minChars: 2 }); }); </script>'; } else { $content = ''; } if ($block) { $style = 2; // 1 means "regular box", 2 means "wide box" $tableWidth = $BROWSERTYPE == "msie" ? "95%" : "99%"; // IE needs to have room for vertical scroll bar inside the box $cellSpacing = "1px"; } else { $style = 2; $tableWidth = "99%"; $cellSpacing = "3px"; } if (count($userfavs) == 0) { $content .= print_text("no_favorites", 0, 1); } else { $mygedcom = $GEDCOM; $current_gedcom = $GEDCOM; $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">"; foreach ($userfavs as $key => $favorite) { if (isset($favorite["id"])) { $key = $favorite["id"]; } $removeFavourite = "<a class=\"font9\" href=\"" . encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$key}") . "\" onclick=\"return confirm('" . $pgv_lang["confirm_fav_remove"] . "');\">" . $pgv_lang["remove"] . "</a><br />"; $current_gedcom = $GEDCOM; $GEDCOM = $favorite["file"]; $content .= "<tr><td>"; if ($favorite["type"] == "URL") { $content .= "<div id=\"boxurl" . $key . ".0\" class=\"person_box\">"; if ($ctype == "user" || PGV_USER_IS_ADMIN) { $content .= $removeFavourite; } $content .= "<a href=\"" . $favorite["url"] . "\">" . PrintReady($favorite["title"]) . "</a>"; $content .= "<br />" . PrintReady($favorite["note"]); } else { require $INDEX_DIRECTORY . $GEDCOM . '_conf.php'; $indirec = find_gedcom_record($favorite["gid"], PGV_GED_ID); if ($favorite["type"] == "INDI") { $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box"; if (strpos($indirec, "\n1 SEX F") !== false) { $content .= "F"; } elseif (strpos($indirec, "\n1 SEX M") !== false) { $content .= ""; } else { $content .= "NN"; } $content .= "\">"; if ($ctype == "user" || PGV_USER_IS_ADMIN) { $content .= $removeFavourite; } ob_start(); print_pedigree_person($favorite["gid"], $style, 1, $key); $content .= ob_get_clean(); $content .= PrintReady($favorite["note"]); } else { $record = GedcomRecord::getInstance($favorite['gid']); $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box\">"; if ($ctype == "user" || PGV_USER_IS_ADMIN) { $content .= $removeFavourite; } if ($record) { $content .= $record->format_list('span'); } else { $content .= $pgv_lang['invalid_id']; } $content .= "<br />" . PrintReady($favorite["note"]); } } $content .= "</div>"; $content .= "</td></tr>"; $GEDCOM = $mygedcom; require $INDEX_DIRECTORY . $GEDCOM . '_conf.php'; } $content .= "</table>"; } $content .= ' <script language="JavaScript" type="text/javascript"> var pastefield; function paste_id(value) { pastefield.value=value; } </script> <br /> '; $uniqueID = floor(microtime() * 1000000); $content .= print_help_link("index_add_favorites_help", "qm", "", false, true); $content .= "<b><a href=\"javascript: " . $pgv_lang["add_favorite"] . " \" onclick=\"expand_layer('add_user_fav'); return false;\"><img id=\"add_user_fav_img\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["plus"]["other"] . "\" border=\"0\" alt=\"\" /> " . $pgv_lang["add_favorite"] . "</a></b>"; $content .= "<br /><div id=\"add_user_fav\" style=\"display: none;\">"; $content .= "<form name=\"addufavform\" method=\"post\" action=\"index.php\">"; $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />"; $content .= "<input type=\"hidden\" name=\"ctype\" value=\"{$ctype}\" />"; $content .= "<input type=\"hidden\" name=\"favtype\" value=\"user\" />"; $content .= "<input type=\"hidden\" name=\"ged\" value=\"{$GEDCOM}\" />"; $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">"; $content .= "<tr><td>" . $pgv_lang["add_fav_enter_id"] . " <br />"; $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />"; $content .= print_findindi_link("gid{$uniqueID}", '', true) . "\n"; $content .= print_findfamily_link("gid{$uniqueID}", '', true) . "\n"; $content .= print_findsource_link("gid{$uniqueID}", '', true) . "\n"; $content .= print_findrepository_link("gid{$uniqueID}", '', true) . "\n"; $content .= print_findnote_link("gid{$uniqueID}", '', true) . "\n"; $content .= print_findmedia_link("gid{$uniqueID}", '1', '', true) . "\n"; $content .= "<br />" . $pgv_lang["add_fav_or_enter_url"]; $content .= "<table><tr><td>" . $pgv_lang["url"] . "</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>"; $content .= "<tr><td>" . $pgv_lang["title"] . "</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>"; if ($block) { $content .= "\n</td></tr><tr><td><br />"; } else { $content .= "\n</td><td>"; } $content .= $pgv_lang["add_fav_enter_note"]; $content .= "<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>"; $content .= "</td></tr></table>"; $content .= "<br /><input type=\"submit\" value=\"" . $pgv_lang["add"] . "\" style=\"font-size: 8pt; \" />"; $content .= "</form></div>"; global $THEME_DIR; if ($block) { require $THEME_DIR . 'templates/block_small_temp.php'; } else { require $THEME_DIR . 'templates/block_main_temp.php'; } // Restore GEDCOM configuration unset($show_full); if (isset($saveShowFull)) { $show_full = $saveShowFull; } $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails; }
} $children[$child->getXref()] = $sortkey; } if ($option == 'bybirth') { asort($children); } $i = 0; $show_full = 1; // Force details to show for each child foreach ($children as $id => $child) { echo '<li style="cursor:move; margin-bottom:2px; position:relative;"'; if (!in_array($id, $ids)) { echo ' class="facts_value new"'; } echo ' id="li_', $id, '">'; print_pedigree_person(WT_Individual::getInstance($id), 2); echo '<input type="hidden" name="order[', $id, ']" value="', $i, '">'; echo '</li>'; $i++; } echo '</ul>'; ?> <table> <?php echo keep_chan($family); ?> </table> <p id="save-cancel"> <input type="submit" class="save" value="<?php echo WT_I18N::translate('save'); ?>
} switch ($controller->chart_style) { case 0: // List $pidarr = array(); echo '<ul style="list-style: none; display: block;" id="ancestry_chart', $TEXT_DIRECTION == 'rtl' ? '_rtl' : '', '">'; $controller->print_child_ascendancy($controller->rootid, 1, $OLD_PGENS - 1); echo '</ul>'; echo '<br />'; break; case 1: // TODO: this should be a parameter to a function, not a global $show_cousins = $controller->show_cousins; // Booklet // first page : show indi facts print_pedigree_person($controller->rootid, 2, false, 1); // expand the layer echo PGV_JS_START, 'expandbox("', $controller->rootid, '.1", 2);', PGV_JS_END; // process the tree $treeid = ancestry_array($controller->rootid, $PEDIGREE_GENERATIONS - 1); foreach ($treeid as $i => $pid) { if ($pid) { $person = Person::getInstance($pid); if (!is_null($person)) { $famids = $person->getChildFamilies(); foreach ($famids as $famid => $family) { $parents = find_parents_in_record($family->getGedcomRecord()); if ($parents) { print_sosa_family($famid, $pid, $i); } elseif ($i == 1) { // show empty family only if it is the first and only one
/** * Prints pedigree of the person passed in */ function print_person_pedigree($person, $count) { global $WT_IMAGES, $bheight, $bwidth, $bhalfheight; if ($count >= $this->generations) { return; } //if (!$person) return; $genoffset = $this->generations; // handle pedigree n generations lines //-- calculate how tall the lines should be $lh = ($bhalfheight + 4) * pow(2, $genoffset - $count - 1); // //Prints empty table columns for children w/o parents up to the max generation //This allows vertical line spacing to be consistent if (count($person->getChildFamilies()) == 0) { echo '<table>'; $this->printEmptyBox($bwidth, $bheight); //-- recursively get the father’s family $this->print_person_pedigree($person, $count + 1); echo '</td>', '<td>', '</tr>'; $this->printEmptyBox($bwidth, $bheight); //-- recursively get the mother’s family $this->print_person_pedigree($person, $count + 1); echo '</td>', '<td>', '</tr></table>'; } //Empty box section done, now for regular pedigree foreach ($person->getChildFamilies() as $family) { echo '<table>', '<tr>', '<td class="tdbot">'; // //Determine line height for two or more spouces //And then adjust the vertical line for the root person only // $sfamilies = $person->getSpouseFamilies(); $famcount = 0; if ($this->show_spouse) { // count number of spouses foreach ($sfamilies as $sfamily) { $famcount++; } } $savlh = $lh; // Save current line height if ($count == 1 && $genoffset <= $famcount) { $linefactor = 0; $tblheight = $bheight + 8; if ($genoffset > 2) { // genoffset of 2 needs no adjustment $tblheight = $bheight + 8; if ($genoffset == 3) { if ($famcount == 3) { $linefactor = $tblheight / 2; } else { if ($famcount > 3) { $linefactor = $tblheight; } } } if ($genoffset == 4) { if ($famcount == 4) { $linefactor = $tblheight; } else { if ($famcount > 4) { $linefactor = ($famcount - $genoffset) * ($tblheight * 1.5); } } } if ($genoffset == 5) { if ($famcount == 5) { $linefactor = 0; } else { if ($famcount > 5) { $linefactor = $tblheight * ($famcount - $genoffset); } } } } $lh = ($famcount - 1) * ($bheight + 8) - $linefactor; if ($genoffset > 5) { $lh = $savlh; } } echo '<img class="line3 pvline" src="', $WT_IMAGES["vline"], '" height="', $lh - 1, '" alt=""></td>', '<td>', '<img class="line4" src="', $WT_IMAGES["hline"], '" height="3" alt=""></td>', '<td>'; $lh = $savlh; // restore original line height //-- print the father box print_pedigree_person($family->getHusband()); echo '</td>'; if ($family->getHusband()) { echo '<td>'; //-- recursively get the father’s family $this->print_person_pedigree($family->getHusband(), $count + 1); echo '</td>'; } else { echo '<td>'; if ($genoffset > $count) { echo '<table>'; for ($i = 1; $i < pow(2, $genoffset - $count) / 2; $i++) { $this->printEmptyBox($bwidth, $bheight); echo '</tr>'; } echo '</table>'; } } echo '</tr><tr>', '<td class="tdtop"><img class="pvline" src="', $WT_IMAGES["vline"], '" height="', $lh + 1, '" alt=""></td>', '<td><img class="line4" src="', $WT_IMAGES["hline"], '" height="3" alt=""></td>', '<td>'; //-- print the mother box print_pedigree_person($family->getWife()); echo '</td>'; if ($family->getWife()) { echo '<td>'; //-- recursively print the mother’s family $this->print_person_pedigree($family->getWife(), $count + 1); echo '</td>'; } else { echo '<td>'; if ($count < $genoffset - 1) { echo '<table>'; for ($i = 1; $i < pow(2, $genoffset - 1 - $count) / 2 + 1; $i++) { $this->printEmptyBox($bwidth, $bheight); echo '</tr>'; $this->printEmptyBox($bwidth, $bheight); echo '</tr>'; } echo '</table>'; } } echo '</tr>', '</table>'; break; } }
/** * print cousins list * * @param string $famid family ID * @param int $personcount */ function print_cousins($famid, $personcount = 1) { global $show_full, $bheight, $bwidth, $cbheight, $cbwidth, $WT_IMAGES, $TEXT_DIRECTION; $family = WT_Family::getInstance($famid); $fchildren = $family->getChildren(); $kids = count($fchildren); $save_show_full = $show_full; $sbheight = $bheight; $sbwidth = $bwidth; if ($save_show_full) { $bheight = $cbheight; $bwidth = $cbwidth; } $show_full = false; echo '<td valign="middle" height="100%">'; if ($kids) { echo '<table cellspacing="0" cellpadding="0" border="0" ><tr valign="middle">'; if ($kids > 1) { echo '<td rowspan="', $kids, '" valign="middle" align="right"><img width="3px" height="', ($bheight + 9) * ($kids - 1), 'px" src="', $WT_IMAGES["vline"], '" alt=""></td>'; } $ctkids = count($fchildren); $i = 1; foreach ($fchildren as $fchil) { if ($i == 1) { echo '<td><img width="10px" height="3px" align="top"'; } else { echo '<td><img width="10px" height="3px"'; } if ($TEXT_DIRECTION == 'ltr') { echo ' style="padding-right: 2px;"'; } else { echo ' style="padding-left: 2px;"'; } echo ' src="', $WT_IMAGES['hline'], '" alt=""></td><td>'; print_pedigree_person($fchil, 1, 0, $personcount); $personcount++; echo '</td></tr>'; if ($i < $ctkids) { echo '<tr>'; $i++; } } echo '</table>'; } else { // If there is known that there are no children (as opposed to no known children) if (preg_match('/\\n1 NCHI (\\d+)/', $family->getGedcom(), $match) && $match[1] == 0) { echo ' <i class="icon-childless" title="', WT_I18N::translate('This family remained childless'), '"></i>'; } } $show_full = $save_show_full; if ($save_show_full) { $bheight = $sbheight; $bwidth = $sbwidth; } echo '</td>'; }
/** * 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"; }
public function getBlock($block_id, $template = true, $cfg = null) { global $ctype, $PEDIGREE_FULL_DETAILS, $show_full, $bwidth, $bheight; $PEDIGREE_ROOT_ID = get_gedcom_setting(WT_GED_ID, 'PEDIGREE_ROOT_ID'); $details = get_block_setting($block_id, 'details', false); $type = get_block_setting($block_id, 'type', 'pedigree'); $pid = get_block_setting($block_id, 'pid', WT_USER_ID ? WT_USER_GEDCOM_ID ? WT_USER_GEDCOM_ID : $PEDIGREE_ROOT_ID : $PEDIGREE_ROOT_ID); $block = get_block_setting($block_id, 'block'); if ($cfg) { foreach (array('details', 'type', 'pid', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } } // Override GEDCOM configuration temporarily if (isset($show_full)) { $saveShowFull = $show_full; } $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS; if (!$details) { $show_full = 0; // Here we could adjust the block width & height to accommodate larger displays } else { $show_full = 1; // Here we could adjust the block width & height to accommodate larger displays } $PEDIGREE_FULL_DETAILS = $show_full; $person = WT_Individual::getInstance($pid); if (!$person) { $pid = $PEDIGREE_ROOT_ID; set_block_setting($block_id, 'pid', $pid); $person = WT_Individual::getInstance($pid); } if ($type != 'treenav' && $person) { $controller = new WT_Controller_Hourglass($person->getXref(), 0); $controller->setupJavascript(); } $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) { $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>'; } else { $title = ''; } if ($person) { switch ($type) { case 'pedigree': $title .= WT_I18N::translate('Pedigree of %s', $person->getFullName()); break; case 'descendants': $title .= WT_I18N::translate('Descendants of %s', $person->getFullName()); break; case 'hourglass': $title .= WT_I18N::translate('Hourglass chart of %s', $person->getFullName()); break; case 'treenav': $title .= WT_I18N::translate('Interactive tree of %s', $person->getFullName()); break; } $title .= help_link('index_charts', $this->getName()); $content = '<table cellspacing="0" cellpadding="0" border="0"><tr>'; if ($type == 'descendants' || $type == 'hourglass') { $content .= "<td valign=\"middle\">"; ob_start(); $controller->print_descendency($person, 1, false); $content .= ob_get_clean(); $content .= "</td>"; } if ($type == 'pedigree' || $type == 'hourglass') { //-- print out the root person if ($type != 'hourglass') { $content .= "<td valign=\"middle\">"; ob_start(); print_pedigree_person($person); $content .= ob_get_clean(); $content .= "</td>"; } $content .= "<td valign=\"middle\">"; ob_start(); $controller->print_person_pedigree($person, 1); $content .= ob_get_clean(); $content .= "</td>"; } if ($type == 'treenav') { require_once WT_MODULES_DIR . 'tree/module.php'; require_once WT_MODULES_DIR . 'tree/class_treeview.php'; $mod = new tree_WT_Module(); $tv = new TreeView(); $content .= '<td>'; $content .= '<script>jQuery("head").append(\'<link rel="stylesheet" href="' . $mod->css() . '" type="text/css" />\');</script>'; $content .= '<script src="' . $mod->js() . '"></script>'; list($html, $js) = $tv->drawViewport($person, 2); $content .= $html . '<script>' . $js . '</script>'; $content .= '</td>'; } $content .= "</tr></table>"; } else { $content = WT_I18N::translate('You must select an individual and chart type in the block configuration settings.'); } if ($template) { if ($block) { require WT_THEME_DIR . 'templates/block_small_temp.php'; } else { require WT_THEME_DIR . 'templates/block_main_temp.php'; } } else { return $content; } // Restore GEDCOM configuration unset($show_full); if (isset($saveShowFull)) { $show_full = $saveShowFull; } $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails; }
function print_charts_block($block = true, $config = "", $side, $index) { global $PGV_BLOCKS, $pgv_lang, $ctype, $PGV_IMAGE_DIR, $PGV_IMAGES, $PEDIGREE_ROOT_ID, $PEDIGREE_FULL_DETAILS; global $show_full, $bwidth, $bheight; if (empty($config)) { $config = $PGV_BLOCKS["print_charts_block"]["config"]; } if (empty($config['details'])) { $config['details'] = 'no'; } if (empty($config["pid"])) { if (!PGV_USER_ID) { $config["pid"] = $PEDIGREE_ROOT_ID; } else { if (PGV_USER_GEDCOM_ID) { $config["pid"] = PGV_USER_GEDCOM_ID; } else { $config["pid"] = $PEDIGREE_ROOT_ID; } } } // Override GEDCOM configuration temporarily if (isset($show_full)) { $saveShowFull = $show_full; } $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS; if ($config["details"] == "no") { $show_full = 0; // Here we could adjust the block width & height to accommodate larger displays } else { $show_full = 1; // Here we could adjust the block width & height to accommodate larger displays } $PEDIGREE_FULL_DETAILS = $show_full; if ($config['type'] != 'treenav') { $controller = new HourglassController(); $controller->init($config["pid"], 0, 3); $controller->setupJavascript(); } else { $nav = new TreeNav($config['pid'], 'blocknav', -1); $nav->generations = 2; } $person = Person::getInstance($config["pid"]); if ($person == null) { $config["pid"] = $PEDIGREE_ROOT_ID; $person = Person::getInstance($PEDIGREE_ROOT_ID); } $id = "charts_block"; $title = print_help_link("index_charts_help", "qm", "", false, true); if ($PGV_BLOCKS["print_charts_block"]["canconfig"]) { if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) { if ($ctype == "gedcom") { $name = PGV_GEDCOM; } else { $name = PGV_USER_NAME; } $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=700,height=400,scrollbars=1,resizable=1'); return false;\">"; $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES["admin"]["small"] . "\" width=\"15\" height=\"15\" border=\"0\" alt=\"" . $pgv_lang["config_block"] . "\" /></a>"; } } if ($person) { $name = PrintReady($person->getFullName()); switch ($config['type']) { case 'pedigree': $title .= $name . " " . $pgv_lang["index_header"]; break; case 'descendants': $title .= $name . " " . $pgv_lang["descend_chart"]; break; case 'hourglass': $title .= $name . " " . $pgv_lang["hourglass_chart"]; break; case 'treenav': $title .= $name . " " . $pgv_lang["tree"]; break; } $content = ""; $content .= "<script src=\"js/phpgedview.js\" language=\"JavaScript\" type=\"text/javascript\"></script>"; if ($show_full == 0) { $content .= '<center><span class="details2">' . $pgv_lang['charts_click_box'] . '</span></center><br />'; } $content .= '<table cellspacing="0" cellpadding="0" border="0"><tr>'; if ($config['type'] == 'descendants' || $config['type'] == 'hourglass') { $content .= "<td valign=\"middle\">"; ob_start(); $controller->print_descendency($person->getXref(), 1, false); $content .= ob_get_clean(); $content .= "</td>"; } if ($config['type'] == 'pedigree' || $config['type'] == 'hourglass') { //-- print out the root person if ($config['type'] != 'hourglass') { $content .= "<td valign=\"middle\">"; ob_start(); print_pedigree_person($person->getXref()); $content .= ob_get_clean(); $content .= "</td>"; } $content .= "<td valign=\"middle\">"; ob_start(); $controller->print_person_pedigree($person->getXref(), 1); $content .= ob_get_clean(); $content .= "</td>"; } if ($config['type'] == 'treenav') { $content .= "<td>"; ob_start(); $nav->drawViewport('blocknav', "", "240px"); $content .= ob_get_clean(); $content .= "</td>"; } $content .= "</tr></table>"; $content .= '<script language="JavaScript" type="text/javascript"> <!-- if (sizeLines) sizeLines(); --> </script>'; } else { $content = $pgv_lang['invalid_id']; } global $THEME_DIR; require $THEME_DIR . 'templates/block_small_temp.php'; // Restore GEDCOM configuration unset($show_full); if (isset($saveShowFull)) { $show_full = $saveShowFull; } $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails; }
/** * Prints descendency of passed in person * * @param WT_Individual $person person to print descendency for * @param mixed $count count of generations to print * @param bool $showNav * * @return int */ function print_descendency($person, $count, $showNav = true) { global $TEXT_DIRECTION, $WT_IMAGES, $bheight, $bwidth, $bhalfheight, $lastGenSecondFam; if ($count > $this->dgenerations) { return; } if (!$person) { return; } $pid = $person->getXref(); $tablealign = 'right'; $otablealign = 'left'; if ($TEXT_DIRECTION == 'rtl') { $tablealign = 'left'; $otablealign = 'right'; } //-- put a space between families on the last generation if ($count == $this->dgenerations - 1) { if (isset($lastGenSecondFam)) { echo "<br>"; } $lastGenSecondFam = true; } echo "<table id=\"table_{$pid}\" align=\"" . $tablealign . "\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; echo "<tr>"; echo "<td align=\"{$tablealign}\" width=\"100%\">"; $numkids = 0; $families = $person->getSpouseFamilies(); $famNum = 0; $children = array(); if ($count < $this->dgenerations) { // Put all of the children in a common array foreach ($families as $family) { $famNum++; foreach ($family->getChildren() as $child) { $children[] = $child; } } $ct = count($children); if ($ct > 0) { echo "<table style=\"position: relative; top: auto; text-align: {$tablealign};\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; for ($i = 0; $i < $ct; $i++) { $person2 = $children[$i]; $chil = $person2->getXref(); echo '<tr>'; echo "<td id=\"td_{$chil}\" class=\"{$TEXT_DIRECTION}\" align=\"{$otablealign}\">"; $kids = $this->print_descendency($person2, $count + 1); $numkids += $kids; echo '</td>'; // Print the lines if ($ct > 1) { if ($i == 0) { // First child echo "<td valign=\"bottom\"><img class=\"line1\" name=\"tvertline\" id=\"vline_{$chil}\" src=\"" . $WT_IMAGES["vline"] . "\" width=\"3\"></td>"; } elseif ($i == $ct - 1) { // Last child echo "<td valign=\"top\"><img name=\"bvertline\" id=\"vline_{$chil}\" src=\"" . $WT_IMAGES["vline"] . "\" width=\"3\"></td>"; } else { // Middle child echo "<td style=\"background: url('" . $WT_IMAGES["vline"] . "');\"><img src=\"" . $WT_IMAGES["spacer"] . "\" width=\"3\"></td>"; } } echo '</tr>'; } echo '</table>'; } echo '</td>'; echo '<td width="', $bwidth, '">'; } // Print the descendency expansion arrow if ($count == $this->dgenerations) { $numkids = 1; $tbwidth = $bwidth + 16; for ($j = $count; $j < $this->dgenerations; $j++) { echo "<div style=\"width: " . $tbwidth . "px;\"><br></div></td><td width=\"{$bwidth}\">"; } $kcount = 0; foreach ($families as $family) { $kcount += $family->getNumberOfChildren(); } if ($kcount == 0) { echo " </td><td width=\"{$bwidth}\">"; } else { echo "<a href=\"{$pid}\" onclick=\"return changeDis('td_" . $pid . "','" . $pid . "','" . $this->show_full . "','" . $this->show_spouse . "','" . $this->box_width . "')\" class=\"" . $this->left_arrow . "\"></a>"; //-- move the arrow up to line up with the correct box if ($this->show_spouse) { echo str_repeat('<br><br><br>', count($families)); } echo "</td><td width=\"{$bwidth}\">"; } } echo "<table id=\"table2_{$pid}\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td>"; print_pedigree_person($person); echo "</td><td><img class=\"line2\" src=\"" . $WT_IMAGES["hline"] . "\" width=\"7\" height=\"3\" alt=\"\">"; //----- Print the spouse if ($this->show_spouse) { foreach ($families as $family) { echo "</td></tr><tr><td align=\"{$otablealign}\">"; //-- shrink the box for the spouses $tempw = $bwidth; $temph = $bheight; $bwidth -= 10; $bheight -= 10; print_pedigree_person($family->getSpouse($person)); $bwidth = $tempw; $bheight = $temph; $numkids += 0.95; echo "</td><td></td>"; } //-- add offset divs to make things line up better if ($count == $this->dgenerations) { echo "<tr><td colspan\"2\"><div style=\"height: " . $bhalfheight / 2 . "px; width: " . $bwidth . "px;\"><br></div>"; } } echo "</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->canShowName()) { // -- 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 $family) { $num += $family->getNumberOfChildren(); } // NOTE: If statement OK if ($num > 0) { echo '<div class="center" id="childarrow" style="position:absolute; width:', $bwidth, 'px;">'; echo '<a href="#" class="icon-darrow"></a><br>'; echo '<div id="childbox">'; echo '<table class="person_box"><tr><td>'; foreach ($famids as $family) { $spouse = $family->getSpouse($person); if ($spouse) { $spid = $spouse->getXref(); echo "<a href=\"hourglass.php?rootid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\" class=\"name1\">"; echo $spouse->getFullName(); echo '</a><br>'; } foreach ($family->getChildren() as $child) { $cid = $child->getXref(); echo " <a href=\"hourglass.php?rootid={$cid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\" class=\"name1\">"; echo $child->getFullName(); echo '</a><br>'; } } //-- print the siblings foreach ($cfamids as $family) { if ($family->getHusband() || $family->getWife()) { echo "<span class=\"name1\"><br>" . WT_I18N::translate('Parents') . "<br></span>"; $husb = $family->getHusband(); if ($husb) { $spid = $husb->getXref(); echo " <a href=\"hourglass.php?rootid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\" class=\"name1\">"; echo $husb->getFullName(); echo '</a><br>'; } $wife = $family->getWife(); if ($wife) { $spid = $wife->getXref(); echo " <a href=\"hourglass.php?rootid={$spid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\" class=\"name1\">"; echo $wife->getFullName(); echo '</a><br>'; } } $num = $family->getNumberOfChildren(); if ($num > 2) { echo "<span class=\"name1\"><br>" . WT_I18N::translate('Siblings') . "<br></span>"; } if ($num == 2) { echo "<span class=\"name1\"><br>" . WT_I18N::translate('Sibling') . "<br></span>"; } foreach ($family->getChildren() as $child) { $cid = $child->getXref(); if ($cid != $pid) { echo " <a href=\"hourglass.php?rootid={$cid}&show_spouse={$this->show_spouse}&show_full={$this->show_full}&generations={$this->generations}&box_width={$this->box_width}\" class=\"name1\">"; echo $child->getFullName(); echo '</a><br>'; } } } echo '</td></tr></table>'; echo '</div>'; echo '</div>'; } } } echo '</td></tr>'; echo '</table>'; return $numkids; }
} else { echo '<div id="line', $index, '" style="background:none; position:absolute; ', $TEXT_DIRECTION == 'ltr' ? 'left' : 'right', ':', $plinex + $Dbxspacing, 'px; top:', $liney + $Dbyspacing, 'px; width:', $lw + $lh * 2, 'px;" align="', $lh == 3 ? 'center' : 'left', '"><img src="', $line, '" align="left" width="', $lw, '" height="', $lh, '" alt="">'; echo '<br>'; echo '<i class="', $arrow_img, '"></i>'; if ($lh == 3) { echo '<br>'; // note: $lh==3 means horiz arrow } echo WT_I18N::translate($node['relations'][$index]); } echo '</div>'; } // Determine the z-index for this box $zIndex = 200 - ($colNum * $depth + $rowNum); echo '<div style="position:absolute; ', $TEXT_DIRECTION == 'ltr' ? 'left' : 'right', ':', $pxoffset, 'px; top:', $pyoffset, 'px; width:', $Dbwidth, 'px; height:', $Dbheight, 'px; z-index:', $zIndex, ';">'; print_pedigree_person($person, 1); echo '</div>'; } } echo '</div>'; // close#relationship_chart } } echo '</div>'; // close #relationshippage // The contents of <div id="relationship_chart"> use relative positions. // Need to expand the div to include the children, or we'll overlap the footer. // $maxyoffset is the top edge of the lowest box. $controller->addInlineJavascript(' relationship_chart_div = document.getElementById("relationship_chart"); if (relationship_chart_div) {