function init() { // Cannot edit with a "remember me" login. if ($_SESSION["cookie_login"]) { header('Location: ' . encode_url("login.php?type=simple&url=" . urlencode("edit_interface.php?" . decode_url($QUERY_STRING)), false)); exit; } // Coming soon ??? $this->has_familysearch = file_exists('modules/FamilySearch/familySearchWrapper.php'); if ($this->has_familysearch) { require_once 'modules/FamilySearch/familySearchWrapper.php'; } // The PID can come from a URL or a form $this->pid = safe_REQUEST($_REQUEST, 'pid', PGV_REGEX_XREF); $this->person = Person::getInstance($this->pid); $this->server_list = get_server_list(); $this->gedcom_list = get_all_gedcoms(); unset($this->gedcom_list[PGV_GED_ID]); // Other input values come from the form $this->form_txtPID = safe_POST('txtPID', PGV_REGEX_XREF); $this->form_cbRelationship = safe_POST('cbRelationship'); $this->form_location = safe_POST('location'); $this->form_txtURL = safe_POST('txtURL', PGV_REGEX_URL); $this->form_txtTitle = safe_POST('txtTitle', '[^<>"%{};]+'); $this->form_txtGID = safe_POST('txtGID', $this->gedcom_list); $this->form_txtUsername = safe_POST('txtUsername', PGV_REGEX_USERNAME); $this->form_txtPassword = safe_POST('txtPassword', PGV_REGEX_PASSWORD); $this->form_cbExistingServers = safe_POST('cbExistingServers', array_keys($this->server_list)); $this->form_txtCB_Title = safe_POST('txtCB_Title', '[^<>"%{};]+'); $this->form_txtCB_GID = safe_POST('txtCB_GID', $this->gedcom_list); $this->form_txtFS_URL = safe_POST('txtFS_URL', PGV_REGEX_URL); $this->form_txtFS_Title = safe_POST('txtFS_Title', '[^<>"%{};]+'); $this->form_txtFS_GID = safe_POST('txtFS_GID', $this->gedcom_list); $this->form_txtFS_Username = safe_POST('txtFS_Username', PGV_REGEX_USERNAME); $this->form_txtFS_Password = safe_POST('txtFS_Password', PGV_REGEX_PASSWORD); if (is_null($this->form_location)) { if ($this->server_list) { $this->form_location = 'existing'; } else { $this->form_location = 'remote'; } } }
print_asso_rela_record($pid, $event->getGedComRecord(), false); continue; } $fact = $event->getTag(); $details = $event->getDetail(); print "<span class=\"details_label\">"; print $event->getLabel(); print "</span> "; $details = $event->getDetail(); if ($details != "Y" && $details != "N") { print PrintReady($details); } echo format_fact_date($event, false, false, $fact, $pid, $person->getGedcomRecord()); //-- print spouse name for marriage events $famid = $event->getFamilyId(); $spouseid = $event->getSpouseId(); if (!empty($spouseid)) { $spouse = Person::getInstance($spouseid); if (!is_null($spouse)) { print " <a href=\"" . encode_url("individual.php?pid={$spouseid}&ged={$GEDCOM}") . "\">"; print PrintReady($spouse->getFullName()); print "</a>"; print " - "; } } if (!empty($famid)) { print "<a href=\"family.php?famid={$famid}\">[" . $pgv_lang["view_family"] . "]</a>\n"; } echo format_fact_place($event, true, true); } }
/** * print ancestors on a fan chart * * @param array $treeid ancestry pid * @param int $fanw fan width in px (default=640) * @param int $fandeg fan size in deg (default=270) */ function print_fan_chart($treeid, $fanw = 640, $fandeg = 270) { global $PEDIGREE_GENERATIONS, $fan_width, $fan_style; global $name, $pgv_lang, $SHOW_ID_NUMBERS, $view, $TEXT_DIRECTION; global $stylesheet, $print_stylesheet; global $PGV_IMAGE_DIR, $PGV_IMAGES, $LINK_ICONS, $GEDCOM; // check for GD 2.x library if (!defined("IMG_ARC_PIE")) { print "<span class=\"error\">" . $pgv_lang["gd_library"] . "</span>"; print " <a href=\"" . $pgv_lang["gd_helplink"] . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["help"]["small"] . "\" class=\"icon\" alt=\"\" /></a><br /><br />"; return false; } if (!function_exists("ImageTtfBbox")) { print "<span class=\"error\">" . $pgv_lang["gd_freetype"] . "</span>"; print " <a href=\"" . $pgv_lang["gd_helplink"] . "\"><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["help"]["small"] . "\" class=\"icon\" alt=\"\" /></a><br /><br />"; return false; } // parse CSS file include "includes/cssparser.inc.php"; $css = new cssparser(false); if ($view == "preview") { $css->Parse($print_stylesheet); } else { $css->Parse($stylesheet); } // check for fontfile $fontfile = $css->Get(".fan_chart", "font-family"); $fontsize = $css->Get(".fan_chart", "font-size"); $fontfile = str_replace("url(", "", $fontfile); $fontfile = str_replace(")", "", $fontfile); if (!file_exists($fontfile)) { if (!empty($fontfile)) { print "<span class=\"error\">" . $pgv_lang["fontfile_error"] . " : {$fontfile}</span>"; } $fontfile = "./includes/fonts/DejaVuSans.ttf"; } if ($fontfile[0] != '/') { $fontfile = dirname(__FILE__) . "/" . $fontfile; } if (!file_exists($fontfile)) { print "<span class=\"error\">" . $pgv_lang["fontfile_error"] . " : {$fontfile}</span>"; return false; } if (intval($fontsize) < 2) { $fontsize = 7; } $treesize = count($treeid); if ($treesize < 1) { return; } // generations count $gen = log($treesize) / log(2) - 1; $sosa = $treesize - 1; // fan size if ($fandeg == 0) { $fandeg = 360; } $fandeg = min($fandeg, 360); $fandeg = max($fandeg, 90); $cx = $fanw / 2 - 1; // center x $cy = $cx; // center y $rx = $fanw - 1; $rw = $fanw / ($gen + 1); $fanh = $fanw; // fan height if ($fandeg == 180) { $fanh = round($fanh * ($gen + 1) / ($gen * 2)); } if ($fandeg == 270) { $fanh = round($fanh * 0.86); } $scale = $fanw / 640; // image init $image = ImageCreate($fanw, $fanh); $black = ImageColorAllocate($image, 0, 0, 0); $white = ImageColorAllocate($image, 0xff, 0xff, 0xff); ImageFilledRectangle($image, 0, 0, $fanw, $fanh, $white); ImageColorTransparent($image, $white); $rgb = $css->Get(".fan_chart", "color"); if (empty($rgb)) { $rgb = "#000000"; } $color = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2))); $rgb = $css->Get(".fan_chart", "background-color"); if (empty($rgb)) { $rgb = "#EEEEEE"; } $bgcolor = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2))); $rgb = $css->Get(".fan_chart_box", "background-color"); if (empty($rgb)) { $rgb = "#D0D0AC"; } $bgcolorM = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2))); $rgb = $css->Get(".fan_chart_boxF", "background-color"); if (empty($rgb)) { $rgb = "#D0ACD0"; } $bgcolorF = ImageColorAllocate($image, hexdec(substr($rgb, 1, 2)), hexdec(substr($rgb, 3, 2)), hexdec(substr($rgb, 5, 2))); // imagemap $imagemap = "<map id=\"fanmap\" name=\"fanmap\">"; // loop to create fan cells while ($gen >= 0) { // clean current generation area $deg2 = 360 + ($fandeg - 180) / 2; $deg1 = $deg2 - $fandeg; ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bgcolor, IMG_ARC_PIE); $rx -= 3; // calculate new angle $p2 = pow(2, $gen); $angle = $fandeg / $p2; $deg2 = 360 + ($fandeg - 180) / 2; $deg1 = $deg2 - $angle; // special case for rootid cell if ($gen == 0) { $deg1 = 90; $deg2 = 360 + $deg1; } // draw each cell while ($sosa >= $p2) { $pid = $treeid[$sosa]; if (!empty($pid)) { $indirec = find_person_record($pid); if (!$indirec) { $indirec = find_updated_record($pid); } if ($sosa % 2) { $bg = $bgcolorF; } else { $bg = $bgcolorM; } if ($sosa == 1) { $bg = $bgcolor; // sex unknown if (preg_match("/1 SEX F/", $indirec) > 0) { $bg = $bgcolorF; } else { if (preg_match("/1 SEX M/", $indirec) > 0) { $bg = $bgcolorM; } } } ImageFilledArc($image, $cx, $cy, $rx, $rx, $deg1, $deg2, $bg, IMG_ARC_PIE); $person = Person::getInstance($pid); $name = $person->getFullName(); $addname = $person->getAddName(); //$name = str_replace(array('<span class="starredname">', '</span>'), '', $name); //$addname = str_replace(array('<span class="starredname">', '</span>'), '', $addname); //$name = str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $name); //@@ //$addname = str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $addname); //@@ // ToDo - print starred names underlined - 1985154 // Todo - print Arabic letters combined - 1360209 $text = reverseText($name) . "\n"; if (!empty($addname)) { $text .= reverseText($addname) . "\n"; } if (displayDetailsById($pid)) { $birthrec = get_sub_record(1, "1 BIRT", $indirec); $ct = preg_match("/2 DATE.*(\\d\\d\\d\\d)/", $birthrec, $match); if ($ct > 0) { $text .= trim($match[1]); } $deathrec = get_sub_record(1, "1 DEAT", $indirec); $ct = preg_match("/2 DATE.*(\\d\\d\\d\\d)/", $deathrec, $match); if ($ct > 0) { $text .= "-" . trim($match[1]); } } $text = unhtmlentitiesrtl($text); $text = strip_tags($text); //Do we still need? // split and center text by lines $wmax = floor($angle * 7 / $fontsize * $scale); $wmax = min($wmax, 35 * $scale); if ($gen == 0) { $wmax = min($wmax, 17 * $scale); } $text = split_align_text($text, $wmax); // text angle $tangle = 270 - ($deg1 + $angle / 2); if ($gen == 0) { $tangle = 0; } // calculate text position $bbox = ImageTtfBbox((double) $fontsize, 0, $fontfile, $text); $textwidth = $bbox[4]; $deg = $deg1 + 0.44; if ($deg2 - $deg1 > 40) { $deg = $deg1 + ($deg2 - $deg1) / 11; } if ($deg2 - $deg1 > 80) { $deg = $deg1 + ($deg2 - $deg1) / 7; } if ($deg2 - $deg1 > 140) { $deg = $deg1 + ($deg2 - $deg1) / 4; } if ($gen == 0) { $deg = 180; } $rad = deg2rad($deg); $mr = ($rx - $rw / 4) / 2; if ($gen > 0 and $deg2 - $deg1 > 80) { $mr = $rx / 2; } $tx = $cx + $mr * cos($rad); $ty = $cy - $mr * -sin($rad); if ($sosa == 1) { $ty -= $mr / 2; } // print text ImageTtfText($image, (double) $fontsize, $tangle, $tx, $ty, $color, $fontfile, $text); $imagemap .= "<area shape=\"poly\" coords=\""; // plot upper points $mr = $rx / 2; $deg = $deg1; while ($deg <= $deg2) { $rad = deg2rad($deg); $tx = round($cx + $mr * cos($rad)); $ty = round($cy - $mr * -sin($rad)); $imagemap .= "{$tx}, {$ty}, "; $deg += ($deg2 - $deg1) / 6; } // plot lower points $mr = ($rx - $rw) / 2; $deg = $deg2; while ($deg >= $deg1) { $rad = deg2rad($deg); $tx = round($cx + $mr * cos($rad)); $ty = round($cy - $mr * -sin($rad)); $imagemap .= "{$tx}, {$ty}, "; $deg -= ($deg2 - $deg1) / 6; } // join first point $mr = $rx / 2; $deg = $deg1; $rad = deg2rad($deg); $tx = round($cx + $mr * cos($rad)); $ty = round($cy - $mr * -sin($rad)); $imagemap .= "{$tx}, {$ty}"; // add action url $tempURL = "javascript://" . htmlspecialchars(strip_tags($name)); if ($SHOW_ID_NUMBERS) { $tempURL .= " (" . $pid . ")"; } $imagemap .= "\" href=\"{$tempURL}\" "; $tempURL = "fanchart.php?rootid={$pid}&PEDIGREE_GENERATIONS={$PEDIGREE_GENERATIONS}&fan_width={$fan_width}&fan_style={$fan_style}"; if (!empty($view)) { $tempURL .= "&view={$view}"; } $count = 0; $lbwidth = 200; print "<div id=\"I" . $pid . "." . $count . "links\" style=\"position:absolute; >"; print "left:" . $tx . "px; top:" . $ty . "px; width: " . $lbwidth . "px; visibility:hidden; z-index:'100';\">"; print "<table class=\"person_box\"><tr><td class=\"details1\">"; print "<a href=\"individual.php?pid={$pid}\" class=\"name1\">" . PrintReady($name); if (!empty($addname)) { print "<br />" . PrintReady($addname); } print "</a>"; print "<br /><a href=\"pedigree.php?rootid={$pid}\" >" . $pgv_lang["index_header"] . "</a>"; print "<br /><a href=\"descendancy.php?pid={$pid}\" >" . $pgv_lang["descend_chart"] . "</a>"; if (PGV_USER_GEDCOM_ID) { print "<br /><a href=\"" . encode_url("relationship.php?pid1=" . PGV_USER_GEDCOM_ID . "&pid2={$pid}&ged={$GEDCOM}") . "\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["relationship_to_me"] . "</a>"; } print "<br /><a href=\"ancestry.php?rootid={$pid}\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["ancestry_chart"] . "</a>"; print "<br /><a href=\"compact.php?rootid={$pid}\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["compact_chart"] . "</a>"; print "<br /><a href=\"" . encode_url($tempURL) . "\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["fan_chart"] . "</a>"; print "<br /><a href=\"hourglass.php?pid={$pid}\" onmouseover=\"clear_family_box_timeout('" . $pid . "." . $count . "');\" onmouseout=\"family_box_timeout('" . $pid . "." . $count . "');\">" . $pgv_lang["hourglass_chart"] . "</a>"; if ($sosa >= 1) { $famids = find_sfamily_ids($pid); //-- make sure there is more than 1 child in the family with parents $cfamids = find_family_ids($pid); $num = 0; for ($f = 0; $f < count($cfamids); $f++) { $famrec = find_family_record($cfamids[$f]); if ($famrec) { $num += preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER); } } if ($famids || $num > 1) { //-- spouse(s) and children for ($f = 0; $f < count($famids); $f++) { $famrec = find_family_record(trim($famids[$f])); if ($famrec) { $parents = find_parents($famids[$f]); if ($parents) { if ($pid != $parents["HUSB"]) { $spid = $parents["HUSB"]; } else { $spid = $parents["WIFE"]; } $person = Person::getInstance($spid); if ($person) { echo '<br /><a href="', $person->getLinkUrl(), '" class="name1">', $person->getFullName(), '</a>'; } } $num = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER); for ($i = 0; $i < $num; $i++) { $person = Person::getInstance($smatch[$i][1]); if ($person) { echo '<br /> <a href="', $person->getLinkUrl(), '" class="name1">< ', $person->getFullName(), '</a>'; } } } } //-- siblings for ($f = 0; $f < count($cfamids); $f++) { $famrec = find_family_record($cfamids[$f]); if ($famrec) { $num = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER); if ($num > 2) { print "<br /><span class=\"name1\">" . $pgv_lang["siblings"] . "</span>"; } if ($num == 2) { print "<br /><span class=\"name1\">" . $pgv_lang["sibling"] . "</span>"; } for ($i = 0; $i < $num; $i++) { $cpid = $smatch[$i][1]; if ($cpid != $pid) { $person = Person::getInstance($cpid); if ($person) { echo '<br /> <a href="', $person->getLinkUrl(), '" class="name1"> ', $person->getFullName(), '</a>'; } } } } } } } print "</td></tr></table>"; print "</div>"; $imagemap .= " onclick=\"show_family_box('" . $pid . "." . $count . "', 'relatives'); return false;\""; $imagemap .= " onmouseout=\"family_box_timeout('" . $pid . "." . $count . "'); return false;\""; $imagemap .= " alt=\"" . PrintReady(strip_tags($name)) . "\" title=\"" . PrintReady(strip_tags($name)) . "\" />"; } $deg1 -= $angle; $deg2 -= $angle; $sosa--; } $rx -= $rw; $gen--; } $imagemap .= "</map>"; echo $imagemap; // PGV banner ;-) ImageStringUp($image, 1, $fanw - 10, $fanh / 3, PGV_PHPGEDVIEW_URL, $color); // here we cannot send image to browser ('header already sent') // and we dont want to use a tmp file // step 1. save image data in a session variable ob_start(); ImagePng($image); $image_data = ob_get_contents(); ob_end_clean(); $image_data = serialize($image_data); unset($_SESSION['image_data']); $_SESSION['image_data'] = $image_data; // step 2. call imageflush.php to read this session variable and display image // note: arg "image_name=" is to avoid image miscaching $image_name = "V" . time(); unset($_SESSION[$image_name]); // statisticsplot.php uses this to hold a file name to send to browser $image_title = preg_replace("~<.*>~", "", $name) . " " . $pgv_lang["fan_chart"]; echo "<p align=\"center\" >"; echo "<img src=\"imageflush.php?image_type=png&image_name={$image_name}&height={$fanh}&width={$fanw}\" width=\"{$fanw}\" height=\"{$fanh}\" border=\"0\" alt=\"{$image_title}\" title=\"{$image_title}\" usemap=\"#fanmap\" />"; echo "</p>"; ImageDestroy($image); }
function print_td_person($n) { global $treeid, $PGV_IMAGE_DIR, $PGV_IMAGES, $pgv_lang; global $TEXT_DIRECTION, $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $USE_SILHOUETTE, $PGV_IMAGES; global $showids, $showthumbs; $text = ""; $pid = $treeid[$n]; if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["indi_info"] . ": " . $pid; } else { $title = $pid . " :" . $pgv_lang["indi_info"]; } if ($pid) { $indi = Person::getInstance($pid); $name = $indi->getFullName(); $addname = $indi->getAddName(); if ($showthumbs && $MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES) { if (showFact("OBJE", $pid)) { $object = find_highlighted_object($pid, PGV_GED_ID, $indi->gedrec); if (!empty($object)) { $whichFile = thumb_or_main($object); // Do we send the main image or a thumbnail? $size = findImageSize($whichFile); $class = "pedigree_image_portrait"; if ($size[0] > $size[1]) { $class = "pedigree_image_landscape"; } if ($TEXT_DIRECTION == "rtl") { $class .= "_rtl"; } // NOTE: IMG ID $imgsize = findImageSize($object["file"]); $imgwidth = $imgsize[0] + 50; $imgheight = $imgsize[1] + 150; if (PGV_USE_LIGHTBOX) { $text .= "<a href=\"" . $object["file"] . "\" rel=\"clearbox[general]\" rev=\"" . $object['mid'] . "::" . PGV_GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_QUOTES, 'UTF-8')) . "\">" . "\n"; } else { $text .= "<a href=\"javascript:;\" onclick=\"return openImage('" . rawurlencode($object["file"]) . "',{$imgwidth}, {$imgheight});\">"; } $birth_date = $indi->getBirthDate(); $death_date = $indi->getDeathDate(); $text .= "<img id=\"box-{$pid}\" src=\"" . $whichFile . "\"vspace=\"0\" hspace=\"0\" class=\"{$class}\" alt =\"\" title=\"" . PrintReady(htmlspecialchars(strip_tags($name), ENT_QUOTES, 'UTF-8')) . " - " . strip_tags(html_entity_decode($birth_date->Display(false) . " - " . $death_date->Display(false), ENT_QUOTES, 'UTF-8')) . "\""; if ($imgsize) { $text .= " /></a>\n"; } else { $text .= " />\n"; } } else { if ($USE_SILHOUETTE && isset($PGV_IMAGES["default_image_U"]["other"])) { $class = "pedigree_image_portrait"; if ($TEXT_DIRECTION == "rtl") { $class .= "_rtl"; } $sex = $indi->getSex(); $text = "<img src=\""; if ($sex == 'F') { $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_F"]["other"]; } else { if ($sex == 'M') { $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_M"]["other"]; } else { $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_U"]["other"]; } } $text .= "\" class=\"" . $class . "\" border=\"none\" alt=\"\" />"; } } } else { if ($USE_SILHOUETTE && isset($PGV_IMAGES["default_image_U"]["other"])) { $class = "pedigree_image_portrait"; if ($TEXT_DIRECTION == "rtl") { $class .= "_rtl"; } $sex = $indi->getSex(); $text = "<img src=\""; if ($sex == 'F') { $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_F"]["other"]; } else { if ($sex == 'M') { $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_M"]["other"]; } else { $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_U"]["other"]; } } $text .= "\" class=\"" . $class . "\" border=\"none\" alt=\"\" />"; } } } $text .= "<a class=\"name1\" href=\"individual.php?pid={$pid}\" title=\"{$title}\"> "; $text .= PrintReady(htmlspecialchars(strip_tags($name), ENT_QUOTES, 'UTF-8')); if ($addname) { $text .= "<br />" . PrintReady($addname); } $text .= "</a>"; if ($showids) { $text .= " <span class='details1' "; if ($TEXT_DIRECTION == "ltr") { $text .= "dir=\"ltr\">"; } else { $text .= "dir=\"rtl\">"; } $text .= "(" . $pid . ")</span>"; } $text .= "<br />"; if ($indi->canDisplayDetails()) { $text .= "<span class='details1'>"; $text .= $indi->getBirthYear() . '-' . $indi->getDeathYear(); $age = GedcomDate::GetAgeYears($indi->getBirthDate(), $indi->getDeathDate()); if ($age) { $text .= " <span class=\"age\">" . PrintReady("({$age})") . "</span>"; } $text .= "</span>"; } } //Removed by BH causing problems with nicknames not printing //$text = unhtmlentities($text); // -- empty box if (empty($text)) { $text = " <br /> <br />"; } // -- box color $isF = ""; if ($n == 1) { if ($indi->getSex() == 'F') { $isF = "F"; } } elseif ($n % 2) { $isF = "F"; } // -- box size if ($n == 1) { echo "<td"; } else { echo "<td width='15%'"; } // -- print box content echo " class=\"person_box", $isF, "\" style=\"text-align:center; vertical-align:top;\" >"; echo $text; echo "</td>"; }
function print_time_fact($event) { global $basexoffset, $baseyoffset, $factcount, $TEXT_DIRECTION; global $factarray, $pgv_lang, $lang_short_cut, $LANGUAGE, $PGV_IMAGE_DIR, $PGV_IMAGES, $SHOW_PEDIGREE_PLACES, $placements; global $familyfacts, $GEDCOM; /* @var $event Event */ $factrec = $event->getGedComRecord(); $fact = $event->getTag(); $desc = $event->getDetail(); if ($fact == "EVEN" || $fact == "FACT") { $fact = $event->getType(); } //-- check if this is a family fact $famid = $event->getFamilyId(); if ($famid != null) { //-- if we already showed this family fact then don't print it if (isset($familyfacts[$famid . $fact]) && $familyfacts[$famid . $fact] != $event->temp) { return; } $familyfacts[$famid . $fact] = $event->temp; } $gdate = $event->getDate(); $date = $gdate->MinDate(); $date = $date->convert_to_cal('gregorian'); $year = $date->y; $month = max(1, $date->m); $day = max(1, $date->d); $xoffset = $basexoffset + 22; $yoffset = $baseyoffset + ($year - $this->baseyear) * $this->scale - $this->scale; $yoffset = $yoffset + $month / 12 * $this->scale; $yoffset = $yoffset + $day / 30 * ($this->scale / 12); $yoffset = floor($yoffset); $place = round($yoffset / $this->bheight); $i = 1; $j = 0; $tyoffset = 0; while (isset($placements[$place])) { if ($i == $j) { $tyoffset = $this->bheight * $i; $i++; } else { $tyoffset = -1 * $this->bheight * $j; $j++; } $place = round(($yoffset + $tyoffset) / $this->bheight); } $yoffset += $tyoffset; $xoffset += abs($tyoffset); $placements[$place] = $yoffset; print "\n\t\t<div id=\"fact{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . $xoffset : "right: " . $xoffset) . "px; top:" . $yoffset . "px; font-size: 8pt; height: " . $this->bheight . "px; \" onmousedown=\"factMD(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ");\">\n"; print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"cursor: hand;\"><tr><td>\n"; print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" name=\"boxline{$factcount}\" id=\"boxline{$factcount}\" height=\"3\" align=\"left\" hspace=\"0\" width=\"10\" vspace=\"0\" alt=\"\" style=\"padding-"; if ($TEXT_DIRECTION == "ltr") { print "left"; } else { print "right"; } print ": 3px;\" />\n"; $col = $event->temp % 6; print "</td><td valign=\"top\" class=\"person" . $col . "\">\n"; if (count($this->pids) > 6) { print $event->getParentObject()->getFullName() . " - "; } $indi = $event->getParentObject(); if ($fact == "_AKAN" || $fact == "_AKA" || $fact == "ALIA" || $fact == "_INTE") { // Allow special processing for different languages $func = "fact_AKA_localisation_{$lang_short_cut[$LANGUAGE]}"; if (function_exists($func) && get_class($indi) == "Person") { // Localise the facts $func($fact, $indi->getXref()); print $factarray[$fact]; } else { print $event->getLabel(); } } else { print $event->getLabel(); } print " -- "; if (get_class($indi) == "Person") { print format_fact_date($event); } if (get_class($indi) == "Family") { print $gdate->Display(false); $family = $indi; $husbid = $family->getHusbId(); $wifeid = $family->getWifeId(); //-- Retrieve husband and wife age for ($p = 0; $p < count($this->pids); $p++) { if ($this->pids[$p] == $husbid) { $husb = $family->getHusband(); if (is_null($husb)) { $husb = new Person(''); } $hdate = $husb->getBirthDate(); if ($hdate->isOK()) { $ageh = get_age_at_event(GedcomDate::GetAgeGedcom($hdate, $gdate), false); } } else { if ($this->pids[$p] == $wifeid) { $wife = $family->getWife(); if (is_null($wife)) { $wife = new Person(''); } $wdate = $wife->getBirthDate(); if ($wdate->isOK()) { $agew = get_age_at_event(GedcomDate::GetAgeGedcom($wdate, $gdate), false); } } } } if (!empty($ageh) && $ageh > 0) { if (empty($agew)) { print '<span class="age"> ' . PrintReady("({$pgv_lang["age"]} {$ageh})") . '</span>'; } else { print '<span class="age"> ' . PrintReady("({$pgv_lang["husb_age"]} {$ageh},") . ' '; } } if (!empty($agew) && $agew > 0) { if (empty($ageh)) { print '<span class="age"> ' . PrintReady("({$pgv_lang["age"]} {$agew})") . '</span>'; } else { print PrintReady("{$pgv_lang["wife_age"]} {$agew})") . '</span>'; } } } print " " . PrintReady($desc); if ($SHOW_PEDIGREE_PLACES > 0) { $place = $event->getPlace(); if ($place != null) { if ($desc != null) { print " - "; } $plevels = explode(',', $place); for ($plevel = 0; $plevel < $SHOW_PEDIGREE_PLACES; $plevel++) { if (!empty($plevels[$plevel])) { if ($plevel > 0) { print ", "; } print PrintReady($plevels[$plevel]); } } } } //-- print spouse name for marriage events $spouse = Person::getInstance($event->getSpouseId()); if ($spouse) { for ($p = 0; $p < count($this->pids); $p++) { if ($this->pids[$p] == $spouse->getXref()) { break; } } if ($p == count($this->pids)) { $p = $event->temp; } $col = $p % 6; if ($spouse->getXref() != $this->pids[$p]) { echo ' <a href="', $spouse->getLinkUrl(), '">', $spouse->getFullName(), '</a>'; } else { $ct = preg_match("/2 _PGVFS @(.*)@/", $factrec, $match); if ($ct > 0) { print " <a href=\"" . encode_url("family.php?famid={$match[1]}&ged={$GEDCOM}") . "\">"; if (displayDetailsById($match[1]) || showLivingNameById($match[1])) { print $event->getParentObject()->getFullName(); } else { print $pgv_lang["private"]; } print "</a>"; } } } print "</td></tr></table>\n"; print "</div>"; if ($TEXT_DIRECTION == 'ltr') { $img = "dline2"; $ypos = "0%"; } else { $img = "dline"; $ypos = "100%"; } $dyoffset = $yoffset - $tyoffset + $this->bheight / 3; if ($tyoffset < 0) { $dyoffset = $yoffset + $this->bheight / 3; if ($TEXT_DIRECTION == 'ltr') { $img = "dline"; $ypos = "100%"; } else { $img = "dline2"; $ypos = "0%"; } } //-- print the diagnal line print "\n\t\t<div id=\"dbox{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . ($basexoffset + 25) : "right: " . ($basexoffset + 25)) . "px; top:" . $dyoffset . "px; font-size: 8pt; height: " . abs($tyoffset) . "px; width: " . abs($tyoffset) . "px;"; print " background-image: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES[$img]["other"] . "');"; print " background-position: 0% {$ypos}; \" >\n"; print "</div>\n"; }
function indis_array($surn, $soundex_std, $soundex_dm) { global $TBLPREFIX; $sql = "SELECT DISTINCT n_id" . " FROM {$TBLPREFIX}name" . " WHERE n_file=?" . " AND n_type!=?" . " AND (n_surn=? OR n_surname=?"; $args = array(PGV_GED_ID, '_MARNM', $surn, $surn); if ($soundex_std) { $sql .= " OR n_soundex_surn_std=?"; $args[] = soundex_std($surn); } if ($soundex_dm) { $sql .= " OR n_soundex_surn_dm=?"; $args[] = soundex_dm($surn); } $sql .= ") ORDER BY n_sort"; $rows = PGV_DB::prepare($sql)->execute($args)->fetchAll(); // var_dump($sql); var_dump($rows); $data = array(); foreach ($rows as $row) { $data[$row->n_id] = Person::getInstance($row->n_id); } return $data; }
function print_family_book($pid, $descent) { global $generations, $dgenerations, $pgv_lang, $firstrun; if ($descent == 0) { return; } $famids = find_sfamily_ids($pid); if (count($famids) > 0 || empty($firstrun)) { $firstrun = true; $pid = check_rootid($pid); $person = Person::getInstance($pid); $name = $person->getFullName(); print "\n\t<h2 style=\"text-align: center\">" . $pgv_lang["family_of"] . PrintReady($name) . "</h2>"; print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr>\n"; //-- descendancy print "<td valign=\"middle\">\n"; $dgenerations = $generations; // $dgenerations = max_descendency_generations($pid, 0); print_descendency($pid, 1); print "</td>\n"; //-- pedigree print "<td valign=\"middle\">\n"; print_person_pedigree($pid, 1); print "</td>\n"; print "</tr></table>\n"; print "<br /><br />\n"; print "<hr style=\"page-break-after:always;\"/>\n"; print "<br /><br />\n"; foreach ($famids as $indexval => $famid) { $famrec = find_family_record($famid, PGV_GED_ID); $ct = preg_match_all("/1 CHIL @(.*)@/", $famrec, $match, PREG_SET_ORDER); for ($i = 0; $i < $ct; $i++) { $chil = trim($match[$i][1]); if (showLivingNameById($chil) || displayDetailsById($chil)) { print_family_book($chil, $descent - 1); } } } } }
/** * Initialization function */ function init() { global $PEDIGREE_FULL_DETAILS, $PEDIGREE_LAYOUT, $MAX_PEDIGREE_GENERATIONS; global $DEFAULT_PEDIGREE_GENERATIONS, $SHOW_EMPTY_BOXES; global $bwidth, $bheight, $baseyoffset, $basexoffset, $byspacing, $bxspacing; global $TEXT_DIRECTION, $BROWSER_TYPE, $show_full, $talloffset; $this->log2 = log(2); if ($this->isPrintPreview()) { $this->show_famlink = false; } $this->rootid = safe_GET_xref('rootid'); $this->show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS); $this->talloffset = safe_GET('talloffset', array('0', '1', '2', '3'), $PEDIGREE_LAYOUT); $this->PEDIGREE_GENERATIONS = safe_GET_integer('PEDIGREE_GENERATIONS', 2, $MAX_PEDIGREE_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); if ($this->talloffset == 1) { $this->talloffset = 1; } // Make SURE this is an integer if ($this->talloffset > 1 && $this->PEDIGREE_GENERATIONS > 8) { $this->PEDIGREE_GENERATIONS = 8; } // TODO: some library functions expect this as a global. // Passing a function parameter would be much better. global $PEDIGREE_GENERATIONS; $PEDIGREE_GENERATIONS = $this->PEDIGREE_GENERATIONS; // This is passed as a global. A parameter would be better... $this->show_full = $this->show_full ? 1 : 0; // Make SURE this is an integer if ($this->talloffset > 3) { $this->talloffset = 3; } else { if ($this->talloffset < 0) { $this->talloffset = 0; } } $show_full = $this->show_full; $talloffset = $this->talloffset; // Validate parameters $this->rootid = check_rootid($this->rootid); $this->rootPerson = Person::getInstance($this->rootid); if (is_null($this->rootPerson)) { $this->rootPerson = new Person(''); } $this->name = $this->rootPerson->getFullName(); $this->addname = $this->rootPerson->getAddName(); //-- adjustments for hide details if ($this->show_full == false) { $bheight = 30; if ($this->talloffset < 2) { $bwidth -= 30; } else { $bwidth -= 50; } } //-- adjustments for portrait mode if ($this->talloffset == 0) { $bxspacing += 12; $bwidth += 20; $baseyoffset -= 20 * ($this->PEDIGREE_GENERATIONS - 1); } $this->pbwidth = $bwidth + 6; $this->pbheight = $bheight + 5; $this->treeid = ancestry_array($this->rootid); $this->treesize = pow(2, (int) $this->PEDIGREE_GENERATIONS) - 1; //-- ancestry_array puts everyone at $i+1 for ($i = 0; $i < $this->treesize; $i++) { $this->treeid[$i] = $this->treeid[$i + 1]; } if (!$this->show_full) { if ($this->talloffset == 0) { $baseyoffset = 160 + $bheight * 2; } else { if ($this->talloffset == 1) { $baseyoffset = 180 + $bheight * 2; } else { if ($this->talloffset > 1) { if ($this->PEDIGREE_GENERATIONS == 3) { $baseyoffset = 30; } else { $baseyoffset = -85; } } } } } else { if ($this->talloffset == 0) { $baseyoffset = 100 + $bheight / 2; } else { if ($this->talloffset == 1) { $baseyoffset = 160 + $bheight / 2; } else { if ($this->talloffset > 1) { if ($this->PEDIGREE_GENERATIONS == 3) { $baseyoffset = 30; } else { $baseyoffset = -85; } } } } } //-- adjustments for preview if ($this->isPrintPreview() && $this->talloffset < 2) { $baseyoffset -= 230; } // -- this next section will create and position the DIV layers for the pedigree tree $this->curgen = 1; // -- variable to track which generation the algorithm is currently working on $this->yoffset = 0; // -- used to offset the position of each box as it is generated $this->xoffset = 0; $this->prevyoffset = 0; // -- used to track the y position of the previous box $this->offsetarray = array(); $this->minyoffset = 0; if ($this->treesize < 3) { $this->treesize = 3; } // -- loop through all of id's in the array starting at the last and working to the first //-- calculation the box positions for ($i = $this->treesize - 1; $i >= 0; $i--) { // -- check to see if we have moved to the next generation if ($i < floor($this->treesize / pow(2, $this->curgen))) { $this->curgen++; } //-- box position in current generation $boxpos = $i - pow(2, $this->PEDIGREE_GENERATIONS - $this->curgen); //-- offset multiple for current generation if ($this->talloffset < 2) { $genoffset = pow(2, $this->curgen - $this->talloffset); $boxspacing = $this->pbheight + $byspacing; } else { $genoffset = pow(2, $this->curgen - 1); $boxspacing = $this->pbwidth + $byspacing; } // -- calculate the yoffset Position in the generation Spacing between boxes put child between parents $this->yoffset = $baseyoffset + $boxpos * ($boxspacing * $genoffset) + $boxspacing / 2 * $genoffset + $boxspacing * $genoffset; // -- calculate the xoffset if ($this->talloffset == 0) { if ($this->PEDIGREE_GENERATIONS < 6) { $addxoffset = $basexoffset + (10 + 60 * (5 - $this->PEDIGREE_GENERATIONS)); $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + $addxoffset; } else { $addxoffset = $basexoffset + 10; $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + $addxoffset; } //-- compact the tree if ($this->curgen < $this->PEDIGREE_GENERATIONS) { $parent = floor(($i - 1) / 2); if ($i % 2 == 0) { $this->yoffset = $this->yoffset - $boxspacing / 2 * ($this->curgen - 1); } else { $this->yoffset = $this->yoffset + $boxspacing / 2 * ($this->curgen - 1); } $pgen = $this->curgen; while ($parent > 0) { if ($parent % 2 == 0) { $this->yoffset = $this->yoffset - $boxspacing / 2 * $pgen; } else { $this->yoffset = $this->yoffset + $boxspacing / 2 * $pgen; } $pgen++; if ($pgen > 3) { $temp = 0; for ($j = 1; $j < $pgen - 2; $j++) { $temp += pow(2, $j) - 1; } if ($parent % 2 == 0) { $this->yoffset = $this->yoffset - $boxspacing / 2 * $temp; } else { $this->yoffset = $this->yoffset + $boxspacing / 2 * $temp; } } $parent = floor(($parent - 1) / 2); } if ($this->curgen > 3) { $temp = 0; for ($j = 1; $j < $this->curgen - 2; $j++) { $temp += pow(2, $j) - 1; } if ($i % 2 == 0) { $this->yoffset = $this->yoffset - $boxspacing / 2 * $temp; } else { $this->yoffset = $this->yoffset + $boxspacing / 2 * $temp; } } } $this->yoffset -= $boxspacing / 2 * pow(2, $this->PEDIGREE_GENERATIONS - 2) - $boxspacing / 2; } else { if ($this->talloffset == 1) { $this->xoffset = 10 + $basexoffset + ($this->PEDIGREE_GENERATIONS - $this->curgen) * ($this->pbwidth + $bxspacing); if ($this->curgen == $this->PEDIGREE_GENERATIONS) { $this->xoffset += 10; } if ($this->PEDIGREE_GENERATIONS < 4) { $this->xoffset += 60; } } else { if ($this->talloffset == 2) { if ($this->show_full) { $this->xoffset = $this->curgen * (($this->pbwidth + $bxspacing) / 2) + $this->curgen * 10 + 136.5; } else { $this->xoffset = $this->curgen * (($this->pbwidth + $bxspacing) / 4) + $this->curgen * 10 + 215.75; } if ($this->isPrintPreview()) { $this->xoffset -= 260; } } else { if ($this->show_full) { $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 2) + 260; } else { $this->xoffset = ($this->PEDIGREE_GENERATIONS - $this->curgen) * (($this->pbwidth + $bxspacing) / 4) + 270; } if ($this->isPrintPreview()) { $this->xoffset -= 260; } } } } if ($this->curgen == 1 && $this->talloffset == 1) { $this->xoffset += 10; } $this->offsetarray[$i]["x"] = $this->xoffset; $this->offsetarray[$i]["y"] = $this->yoffset; } //-- collapse the tree if boxes are missing if (!$SHOW_EMPTY_BOXES) { if ($this->PEDIGREE_GENERATIONS > 1) { $this->collapse_tree(0, 1, 0); } } //-- calculate the smallest yoffset and adjust the tree to that offset $minyoffset = 0; for ($i = 0; $i < count($this->treeid); $i++) { if ($SHOW_EMPTY_BOXES || !empty($treeid[$i])) { if (!empty($offsetarray[$i])) { if ($minyoffset == 0 || $minyoffset > $this->offsetarray[$i]["y"]) { $minyoffset = $this->offsetarray[$i]["y"]; } } } } $ydiff = $baseyoffset + 35 - $minyoffset; $this->adjust_subtree(0, $ydiff); //-- if no father keep the tree off of the pedigree form if ($this->isPrintPreview() && $this->offsetarray[0]["y"] + $baseyoffset < 300) { $this->adjust_subtree(0, 300 - ($this->offsetarray[0]["y"] + $baseyoffset)); } }
function advancedSearch($justSql = false, $table = "individuals", $prefix = "i") { global $TBLPREFIX, $gedcom_record_cache; DMsoundex("", "opencache"); $this->myindilist = array(); $fct = count($this->fields); if ($fct == 0) { return; } $namesTable = false; $datesTable = false; $placesTable = false; $famsTable = false; $famcTable = false; $sql = ''; if ($justSql) { $sqlfields = "SELECT DISTINCT {$prefix}_id, {$prefix}_file"; } else { $sqlfields = "SELECT i_id, i_gedcom, i_isdead, i_file, i_sex"; } $sqltables = " FROM " . $TBLPREFIX . $table; $sqlwhere = " WHERE " . $prefix . "_file=" . PGV_GED_ID; $keepfields = $this->fields; for ($i = 0; $i < $fct; $i++) { $field = $this->fields[$i]; if (empty($field)) { continue; } $value = ''; if (isset($this->values[$i])) { $value = $this->values[$i]; } if (empty($value)) { continue; } $parts = preg_split("/:/", $field); //-- handle names seperately if ($parts[0] == "NAME") { // The pgv_name table contains both names and soundex values if (!$namesTable) { $sqltables .= " JOIN {$TBLPREFIX}name ON (i_file=n_file AND i_id=n_id) "; $namesTable = true; } switch (end($parts)) { case 'SDX_STD': $sdx = explode(':', soundex_std($value)); foreach ($sdx as $k => $v) { if ($parts[1] == 'GIVN') { $sdx[$k] = 'n_soundex_givn_std ' . PGV_DB::$LIKE . " '%{$v}%'"; } else { $sdx[$k] = 'n_soundex_surn_std ' . PGV_DB::$LIKE . " '%{$v}%'"; } } $sqlwhere .= ' AND (' . implode(' OR ', $sdx) . ')'; break; case 'SDX': // SDX uses DM by default. // SDX uses DM by default. case 'SDX_DM': $sdx = explode(':', soundex_dm($value)); foreach ($sdx as $k => $v) { if ($parts[1] == 'GIVN') { $sdx[$k] = 'n_soundex_givn_dm ' . PGV_DB::$LIKE . " '%{$v}%'"; } else { $sdx[$k] = 'n_soundex_surn_dm ' . PGV_DB::$LIKE . " '%{$v}%'"; } } $sqlwhere .= ' AND (' . implode(' OR ', $sdx) . ')'; break; case 'EXACT': // Exact match. switch ($parts[1]) { case 'GIVN': // Allow for exact match on multiple given names. $sqlwhere .= ' AND (n_givn ' . PGV_DB::$LIKE . " " . PGV_DB::quote($value) . " OR n_givn " . PGV_DB::$LIKE . " " . PGV_DB::quote("{$value} %") . " OR n_givn " . PGV_DB::$LIKE . " " . PGV_DB::quote("% {$value}") . " OR n_givn " . PGV_DB::$LIKE . " " . PGV_DB::quote("% {$value} %") . ")"; break; case 'SURN': $sqlwhere .= ' AND n_surname ' . PGV_DB::$LIKE . " " . PGV_DB::quote($value); break; default: $sqlwhere .= ' AND n_full ' . PGV_DB::$LIKE . " " . PGV_DB::quote($value); break; } break; case 'BEGINS': // "Begins with" match. switch ($parts[1]) { case 'GIVN': // Allow for match on start of multiple given names $sqlwhere .= ' AND (n_givn ' . PGV_DB::$LIKE . " " . PGV_DB::quote("{$value}%") . " OR n_givn " . PGV_DB::$LIKE . " " . PGV_DB::quote("% {$value}%") . ")"; break; case 'SURN': $sqlwhere .= ' AND n_surname ' . PGV_DB::$LIKE . " " . PGV_DB::quote("{$value}%"); break; default: $sqlwhere .= ' AND n_full ' . PGV_DB::$LIKE . " " . PGV_DB::quote("{$value}%"); break; } break; case 'CONTAINS': default: // Partial match. switch ($parts[1]) { case 'GIVN': $sqlwhere .= ' AND n_givn ' . PGV_DB::$LIKE . " " . PGV_DB::quote("%{$value}%"); break; case 'SURN': $sqlwhere .= ' AND n_surname ' . PGV_DB::$LIKE . " " . PGV_DB::quote("%{$value}%"); break; default: $sqlwhere .= ' AND n_full ' . PGV_DB::$LIKE . " " . PGV_DB::quote("%{$value}%"); break; } break; } } else { if (isset($parts[1]) && $parts[1] == "DATE") { if (!$datesTable) { $sqltables .= ", " . $TBLPREFIX . "dates"; $sqlwhere .= " AND " . $prefix . "_file=d_file AND " . $prefix . "_id=d_gid"; $datesTable = true; } $sqlwhere .= " AND (d_fact='" . $parts[0] . "'"; $date = new GedcomDate($value); if ($date->isOK()) { $jd1 = $date->date1->minJD; if ($date->date2) { $jd2 = $date->date2->maxJD; } else { $jd2 = $date->date1->maxJD; } if (!empty($this->plusminus[$i])) { $adjd = $this->plusminus[$i] * 365; //print $jd1.":".$jd2.":".$adjd; $jd1 = $jd1 - $adjd; $jd2 = $jd2 + $adjd; } $sqlwhere .= " AND d_julianday1>=" . $jd1 . " AND d_julianday2<=" . $jd2; } $sqlwhere .= ") "; } else { if (isset($parts[1]) && $parts[1] == "PLAC") { if (!$placesTable) { $sqltables .= ", " . $TBLPREFIX . "places, " . $TBLPREFIX . "placelinks"; $sqlwhere .= " AND " . $prefix . "_file=p_file AND p_file=pl_file AND " . $prefix . "_id=pl_gid AND pl_p_id=p_id"; $placesTable = true; } //-- soundex search //if (end($parts)=="SDX") { $places = preg_split("/[, ]+/", $value); $parr = array(); for ($j = 0; $j < count($places); $j++) { $parr[$j] = DMsoundex($places[$j]); } $sqlwhere .= " AND ("; $fnc = 0; $field = "p_dm_soundex"; foreach ($parr as $name) { foreach ($name as $name1) { if ($fnc > 0) { $sqlwhere .= " OR "; } $fnc++; $sqlwhere .= $field . " " . PGV_DB::$LIKE . " " . PGV_DB::quote("%{$name1}%"); } } $sqlwhere .= ") "; //} } else { if ($parts[0] == 'FAMS') { if (!$famsTable) { $sqltables .= ", " . $TBLPREFIX . "families as FAMS"; $sqlwhere .= " AND i_file=FAMS.f_file"; $famsTable = true; } //-- alter the fields and recurse to generate a subquery for spouse/parent fields $oldfields = $this->fields; for ($j = 0; $j < $fct; $j++) { //-- if it doesn't start with FAMS or FAMC then remove that field if (preg_match("/^" . $parts[0] . ":/", $this->fields[$j]) == 0) { $this->fields[$j] = ''; } else { $this->fields[$j] = preg_replace("/^" . $parts[0] . ":/", "", $this->fields[$j]); } } $sqlwhere .= " AND (FAMS.f_husb=i_id OR FAMS.f_wife=i_id)"; $subsql = $this->advancedSearch(true, "families", "f"); $sqlwhere .= " AND ROW(FAMS.f_id, FAMS.f_file) IN (" . $subsql . ")"; $this->fields = $oldfields; //-- remove all of the fam fields so they don't show up again for ($j = 0; $j < $fct; $j++) { //-- if it does start with FAMS or FAMC then remove that field if (preg_match("/^" . $parts[0] . ":/", $this->fields[$j]) > 0) { $this->fields[$j] = ''; } } } else { if ($parts[0] == 'FAMC') { if (!$famcTable) { $sqltables .= ", " . $TBLPREFIX . "families as FAMC"; $sqlwhere .= " AND i_file=FAMC.f_file"; $famcTable = true; } //-- alter the fields and recurse to generate a subquery for spouse/parent fields $oldfields = $this->fields; for ($j = 0; $j < $fct; $j++) { //-- if it doesn't start with FAMS or FAMC then remove that field if (preg_match("/^" . $parts[0] . ":/", $this->fields[$j]) == 0) { $this->fields[$j] = ''; } else { $this->fields[$j] = preg_replace("/^" . $parts[0] . ":/", "", $this->fields[$j]); } } $sqlwhere .= " AND (FAMC.f_chil " . PGV_DB::$LIKE . " CONCAT('%',i_id,';%'))"; $subsql = $this->advancedSearch(true, "families", "f"); $sqlwhere .= " AND ROW(FAMC.f_id, FAMC.f_file) IN (" . $subsql . ")"; $this->fields = $oldfields; //-- remove all of the fam fields so they don't show up again for ($j = 0; $j < $fct; $j++) { //-- if it does start with FAMS or FAMC then remove that field if (preg_match("/^" . $parts[0] . ":/", $this->fields[$j]) > 0) { $this->fields[$j] = ''; } } } else { if ($parts[0] == 'HUSB' || $parts[0] == 'WIFE') { if (!$famsTable) { $sqltables .= ", " . $TBLPREFIX . "individuals"; $sqlwhere .= " AND i_file=f_file"; $famsTable = true; } //-- alter the fields and recurse to generate a subquery for spouse/parent fields $oldfields = $this->fields; for ($j = 0; $j < $fct; $j++) { //-- if it doesn't start with FAMS or FAMC then remove that field if (preg_match("/^" . $parts[0] . ":/", $this->fields[$j]) == 0) { $this->fields[$j] = ''; } else { $this->fields[$j] = preg_replace("/^" . $parts[0] . ":/", "", $this->fields[$j]); } } $subsql = $this->advancedSearch(true, "individuals", "i"); if ($parts[0] == 'HUSB') { $sqlwhere .= " AND ROW(f_husb, f_file) IN (" . $subsql . ")"; } if ($parts[0] == 'WIFE') { $sqlwhere .= " AND ROW(f_wife, f_file) IN (" . $subsql . ")"; } $this->fields = $oldfields; //-- remove all of the fam fields so they don't show up again for ($j = 0; $j < $fct; $j++) { //-- if it does start with HUSB or WIFE then remove that field if (preg_match("/^" . $parts[0] . ":/", $this->fields[$j]) > 0) { $this->fields[$j] = ''; } } } else { $sqlwhere .= " AND i_gedcom " . PGV_DB::$LIKE . " "; $ct = count($parts); $liketmp = ''; for ($j = 0; $j < $ct; $j++) { $liketmp .= "%" . ($j + 1) . " " . $parts[$j] . " %"; // if ($j<$ct-1) { // $sqlwhere .= "%"; // } else { $liketmp .= "%{$value}%"; // } } $sqlwhere .= PGV_DB::quote($liketmp); } } } } } } } $sql = $sqlfields . $sqltables . $sqlwhere; // print $sql; if ($justSql) { return $sql; } $rows = PGV_DB::prepare($sql)->fetchAll(PDO::FETCH_ASSOC); foreach ($rows as $row) { $row['xref'] = $row['i_id']; $row['ged_id'] = $row['i_file']; $row['type'] = 'INDI'; $row['gedrec'] = $row['i_gedcom']; $object = Person::getInstance($row); $this->myindilist[$row['i_id']] = $object; } $this->fields = $keepfields; }
/** * 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"; }
/** * get the menu for the charts * @return Menu the menu item */ static function &getChartsMenu($rootid = '', $myid = '') { global $TEXT_DIRECTION, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $pgv_lang, $SEARCH_SPIDER; global $PEDIGREE_FULL_DETAILS, $PEDIGREE_LAYOUT; if ($TEXT_DIRECTION == "rtl") { $ff = "_rtl"; } else { $ff = ""; } if (!empty($SEARCH_SPIDER)) { $menu = new Menu("", "", ""); return $menu; } $showFull = $PEDIGREE_FULL_DETAILS ? 1 : 0; $showLayout = $PEDIGREE_LAYOUT ? 1 : 0; //-- main charts menu item $link = "pedigree.php?ged={$GEDCOM}&show_full={$showFull}&talloffset={$showLayout}"; if ($rootid) { $link .= "&rootid={$rootid}"; $menu = new Menu($pgv_lang["charts"], encode_url($link)); if (!empty($PGV_IMAGES["pedigree"]["small"])) { $menu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["pedigree"]["small"]); } $menu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "submenu{$ff}", "", "icon_small_pedigree"); } else { // top menubar $menu = new Menu($pgv_lang["charts"], encode_url($link), "down"); if (!empty($PGV_IMAGES["pedigree"]["large"])) { $menu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["pedigree"]["large"]); } $menu->addClass("menuitem{$ff}", "menuitem_hover{$ff}", "submenu{$ff}", "icon_large_pedigree"); } // Build a sortable list of submenu items and then sort it in localized name order $menuList = array(); $menuList["pedigree"] = $pgv_lang["pedigree_chart"]; if (file_exists("descendancy.php")) { $menuList["descendancy"] = $pgv_lang["descend_chart"]; } if (file_exists("ancestry.php")) { $menuList["ancestry"] = $pgv_lang["ancestry_chart"]; } if (file_exists("compact.php")) { $menuList["compact"] = $pgv_lang["compact_chart"]; } if (file_exists("fanchart.php") && function_exists("imagettftext")) { $menuList["fanchart"] = $pgv_lang["fan_chart"]; } if (file_exists("hourglass.php")) { $menuList["hourglass"] = $pgv_lang["hourglass_chart"]; } if (file_exists("familybook.php")) { $menuList["familybook"] = $pgv_lang["familybook_chart"]; } if (file_exists("timeline.php")) { $menuList["timeline"] = $pgv_lang["timeline_chart"]; } if (file_exists("lifespan.php")) { $menuList["lifespan"] = $pgv_lang["lifespan_chart"]; } if (file_exists("relationship.php")) { $menuList["relationship"] = $pgv_lang["relationship_chart"]; } if (file_exists("statistics.php")) { $menuList["statistics"] = $pgv_lang["statistics"]; } if (file_exists("treenav.php")) { $menuList["treenav"] = $pgv_lang["interactive_tree"]; } asort($menuList); // Produce the submenus in localized name order foreach ($menuList as $menuType => $menuName) { switch ($menuType) { case "pedigree": //-- pedigree $link = "pedigree.php?ged={$GEDCOM}&show_full={$showFull}&talloffset={$showLayout}"; if ($rootid) { $link .= "&rootid={$rootid}"; } $submenu = new Menu($pgv_lang["pedigree_chart"], encode_url($link)); if (!empty($PGV_IMAGES["pedigree"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["pedigree"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_pedigree"); $menu->addSubmenu($submenu); break; case "descendancy": //-- descendancy $link = "descendancy.php?ged={$GEDCOM}"; if ($rootid) { $link .= "&pid={$rootid}&show_full={$showFull}"; } $submenu = new Menu($pgv_lang["descend_chart"], encode_url($link)); if (!empty($PGV_IMAGES["descendant"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["descendant"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_descendant"); $menu->addSubmenu($submenu); break; case "ancestry": //-- ancestry $link = "ancestry.php?ged=" . $GEDCOM; if ($rootid) { $link .= "&rootid={$rootid}&show_full={$showFull}"; } $submenu = new Menu($pgv_lang["ancestry_chart"], encode_url($link)); if (!empty($PGV_IMAGES["ancestry"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["ancestry"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_ancestry"); $menu->addSubmenu($submenu); break; case "compact": //-- compact $link = "compact.php?ged=" . $GEDCOM; if ($rootid) { $link .= "&rootid=" . $rootid; } $submenu = new Menu($pgv_lang["compact_chart"], encode_url($link)); if (!empty($PGV_IMAGES["ancestry"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["ancestry"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_ancestry"); $menu->addSubmenu($submenu); break; case "fanchart": //-- fan chart $link = "fanchart.php?ged=" . $GEDCOM; if ($rootid) { $link .= "&rootid=" . $rootid; } $submenu = new Menu($pgv_lang["fan_chart"], encode_url($link)); if (!empty($PGV_IMAGES["fanchart"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["fanchart"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_fanchart"); $menu->addSubmenu($submenu); break; case "hourglass": //-- hourglass $link = "hourglass.php?ged=" . $GEDCOM; if ($rootid) { $link .= "&pid={$rootid}&show_full={$showFull}"; } $submenu = new Menu($pgv_lang["hourglass_chart"], encode_url($link)); if (!empty($PGV_IMAGES["hourglass"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hourglass"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_hourglass"); $menu->addSubmenu($submenu); break; case "familybook": //-- familybook $link = "familybook.php?ged=" . $GEDCOM; if ($rootid) { $link .= "&pid={$rootid}&show_full={$showFull}"; } $submenu = new Menu($pgv_lang["familybook_chart"], encode_url($link)); if (!empty($PGV_IMAGES["fambook"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["fambook"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_fambook"); $menu->addSubmenu($submenu); break; case "timeline": //-- timeline $link = "timeline.php?ged=" . $GEDCOM; if ($rootid) { $link .= "&pids[]=" . $rootid; } $submenu = new Menu($pgv_lang["timeline_chart"], $link); if (!empty($PGV_IMAGES["timeline"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["timeline"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_timeline"); $menu->addSubmenu($submenu); break; case "lifespan": //-- lifespan $link = "lifespan.php?ged=" . $GEDCOM; if ($rootid) { $link .= "&pids[]={$rootid}&addFamily=1"; } $submenu = new Menu($pgv_lang["lifespan_chart"], encode_url($link)); if (!empty($PGV_IMAGES["timeline"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["timeline"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_timeline"); $menu->addSubmenu($submenu); break; case "relationship": //-- relationship $pids[] = $myid; if ($rootid && empty($myid)) { if (PGV_USER_ID) { $pids[] = PGV_USER_GEDCOM_ID; $pids[] = PGV_USER_ROOT_ID; } } if ($rootid) { foreach (getUserFavorites(PGV_USER_NAME) as $key => $favorite) { $pid = $favorite["gid"]; if (displayDetailsById($pid, $favorite["type"])) { if ($favorite["type"] == "INDI" && $favorite["file"] == $GEDCOM) { $pids[] = $pid; } } } } $pids = array_unique($pids); foreach ($pids as $key => $pid) { $person = Person::getInstance($pid); if ($person && $pid != $rootid || empty($rootid)) { $link = "relationship.php?ged=" . $GEDCOM; if ($rootid) { $link .= "&pid1={$pid}&pid2={$rootid}&pretty=2&followspouse=1"; $label = $pgv_lang["relationship_chart"] . ": " . PrintReady(strip_tags($person->getFullName())); $submenu = new Menu($label, encode_url($link)); } else { $submenu = new Menu($pgv_lang["relationship_chart"], encode_url($link)); } if (!empty($PGV_IMAGES["relationship"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["relationship"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_relationship"); $menu->addSubmenu($submenu); } } break; case "statistics": //-- statistics plot $submenu = new Menu($pgv_lang["statistics"], "statistics.php"); if (!empty($PGV_IMAGES["statistic"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["statistic"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_statistic"); $menu->addSubmenu($submenu); break; case "treenav": //-- interactive tree $link = "treenav.php?ged={$GEDCOM}&rootid={$rootid}"; $submenu = new Menu($pgv_lang["interactive_tree"], encode_url($link)); if (!empty($PGV_IMAGES["gedcom"]["small"])) { $submenu->addIcon($PGV_IMAGE_DIR . "/" . $PGV_IMAGES["gedcom"]["small"]); } $submenu->addClass("submenuitem{$ff}", "submenuitem_hover{$ff}", "", "icon_small_gedcom"); $menu->addSubmenu($submenu); break; } } return $menu; }
/** * print the information for an individual chart box * * find and print a given individuals information for a pedigree chart * @param string $pid the Gedcom Xref ID of the to print * @param int $style the style to print the box in, 1 for smaller boxes, 2 for larger boxes * @param boolean $show_famlink set to true to show the icons for the popup links and the zoomboxes * @param int $count on some charts it is important to keep a count of how many boxes were printed */ function print_pedigree_person_nav($pid, $style = 1, $show_famlink = true, $count = 0, $personcount = "1") { global $HIDE_LIVE_PEOPLE, $SHOW_LIVING_NAMES, $PRIV_PUBLIC, $factarray, $ZOOM_BOXES, $LINK_ICONS, $view, $SCRIPT_NAME, $GEDCOM; global $pgv_lang, $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $bwidth, $bheight, $PEDIGREE_FULL_DETAILS, $SHOW_ID_NUMBERS, $SHOW_PEDIGREE_PLACES; global $CONTACT_EMAIL, $CONTACT_METHOD, $TEXT_DIRECTION, $DEFAULT_PEDIGREE_GENERATIONS, $OLD_PGENS, $talloffset, $PEDIGREE_LAYOUT, $MEDIA_DIRECTORY; global $PGV_IMAGE_DIR, $PGV_IMAGES, $ABBREVIATE_CHART_LABELS, $USE_MEDIA_VIEWER; global $chart_style, $box_width, $generations, $show_spouse, $show_full; global $CHART_BOX_TAGS, $SHOW_LDS_AT_GLANCE, $PEDIGREE_SHOW_GENDER; global $SEARCH_SPIDER; global $spouselinks, $parentlinks, $step_parentlinks, $persons, $person_step, $person_parent, $tabno, $theme_name, $spousetag; global $natdad, $natmom; if ($style != 2) { $style = 1; } if (empty($show_full)) { $show_full = 0; } if (empty($PEDIGREE_FULL_DETAILS)) { $PEDIGREE_FULL_DETAILS = 0; } if (!isset($OLD_PGENS)) { $OLD_PGENS = $DEFAULT_PEDIGREE_GENERATIONS; } if (!isset($talloffset)) { $talloffset = $PEDIGREE_LAYOUT; } $person = Person::getInstance($pid); if ($pid == false || empty($person)) { $spouselinks = false; $parentlinks = false; $step_parentlinks = false; } $tmp = array('M' => '', 'F' => 'F', 'U' => 'NN'); $isF = $tmp[$person->getSex()]; $spouselinks = ""; $parentlinks = ""; $step_parentlinks = ""; $disp = $person->canDisplayDetails(); if ($person->canDisplayName()) { if ($show_famlink && empty($SEARCH_SPIDER)) { if ($LINK_ICONS != "disabled") { //-- draw a box for the family popup $spouselinks .= "<span class=\"flyout\"><b>" . $pgv_lang['family'] . "</b></span><br />"; $parentlinks .= "<span class=\"flyout\"><b>" . $pgv_lang['parents'] . "</b></span><br />"; $step_parentlinks .= "<span class=\"flyout\"><b>" . $pgv_lang['parents'] . "</b></span><br />"; $persons = ""; $person_parent = ""; $person_step = ""; //-- parent families -------------------------------------- $fams = $person->getChildFamilies(); foreach ($fams as $famid => $family) { if (!is_null($family)) { $husb = $family->getHusband($person); $wife = $family->getWife($person); // $spouse = $family->getSpouse($person); $children = $family->getChildren(); $num = count($children); // Husband ------------------------------ if ($husb || $num > 0) { if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["familybook_chart"] . ": " . $famid; } else { $title = $famid . " :" . $pgv_lang["familybook_chart"]; } if ($husb) { $person_parent = "Yes"; if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["indi_info"] . ": " . $husb->getXref(); } else { $title = $husb->getXref() . " :" . $pgv_lang["indi_info"]; } $parentlinks .= "<a href=\"" . encode_url($husb->getLinkUrl() . "&tab={$tabno}") . "\">"; $parentlinks .= " " . PrintReady($husb->getFullName()); $parentlinks .= "</a>"; $parentlinks .= "<br />"; $natdad = "yes"; } } // Wife ------------------------------ if ($wife || $num > 0) { if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["familybook_chart"] . ": " . $famid; } else { $title = $famid . " :" . $pgv_lang["familybook_chart"]; } if ($wife) { $person_parent = "Yes"; if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["indi_info"] . ": " . $wife->getXref(); } else { $title = $wife->getXref() . " :" . $pgv_lang["indi_info"]; } $parentlinks .= "<a href=\"" . encode_url($wife->getLinkUrl() . "&tab={$tabno}") . "\">"; $parentlinks .= " " . PrintReady($wife->getFullName()); $parentlinks .= "</a>"; $parentlinks .= "<br />"; $natmom = "yes"; } } } } //-- step families ----------------------------------------- $fams = $person->getStepFamilies(); foreach ($fams as $famid => $family) { if (!is_null($family)) { $husb = $family->getHusband($person); $wife = $family->getWife($person); // $spouse = $family->getSpouse($person); $children = $family->getChildren(); $num = count($children); if ($natdad == "yes") { } else { // Husband ----------------------- if ($husb || $num > 0) { if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["familybook_chart"] . ": " . $famid; } else { $title = $famid . " :" . $pgv_lang["familybook_chart"]; } if ($husb) { $person_step = "Yes"; if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["indi_info"] . ": " . $husb->getXref(); } else { $title = $husb->getXref() . " :" . $pgv_lang["indi_info"]; } $parentlinks .= "<a href=\"" . encode_url($husb->getLinkUrl() . "&tab={$tabno}") . "\">"; $parentlinks .= " " . PrintReady($husb->getFullName()); $parentlinks .= "</a>"; $parentlinks .= "<br />"; } } } if ($natmom == "yes") { } else { // Wife ---------------------------- if ($wife || $num > 0) { if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["familybook_chart"] . ": " . $famid; } else { $title = $famid . " :" . $pgv_lang["familybook_chart"]; } if ($wife) { $person_step = "Yes"; if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["indi_info"] . ": " . $wife->getXref(); } else { $title = $wife->getXref() . " :" . $pgv_lang["indi_info"]; } $parentlinks .= "<a href=\"" . encode_url($wife->getLinkUrl() . "&tab={$tabno}") . "\">"; $parentlinks .= " " . PrintReady($wife->getFullName()); $parentlinks .= "</a>"; $parentlinks .= "<br />"; } } } } } // Spouse Families -------------------------------------- @var $family Family $fams = $person->getSpouseFamilies(); foreach ($fams as $famid => $family) { if (!is_null($family)) { $spouse = $family->getSpouse($person); $children = $family->getChildren(); $num = count($children); // Spouse ------------------------------ if ($spouse || $num > 0) { if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["familybook_chart"] . ": " . $famid; } else { $title = $famid . " :" . $pgv_lang["familybook_chart"]; } if ($spouse) { if ($TEXT_DIRECTION == "ltr") { $title = $pgv_lang["indi_info"] . ": " . $spouse->getXref(); } else { $title = $spouse->getXref() . " :" . $pgv_lang["indi_info"]; } $spouselinks .= "<a href=\"" . encode_url($spouse->getLinkUrl() . "&tab={$tabno}") . "\">"; $spouselinks .= " " . PrintReady($spouse->getFullName()); $spouselinks .= "</a>"; if ($spouse->getFullName() != "") { $persons = "Yes"; } } } $spouselinks .= "<ul class=\"clist " . $TEXT_DIRECTION . "\">\n"; // Children ------------------------------ @var $child Person foreach ($children as $c => $child) { if ($child) { $persons = "Yes"; $title = $pgv_lang["indi_info"] . ": " . $child->getXref(); $spouselinks .= "<li>"; $spouselinks .= "<a href=\"" . encode_url($child->getLinkUrl() . "&tab={$tabno}") . "\">"; $spouselinks .= PrintReady($child->getFullName()); $spouselinks .= "</a>"; $spouselinks .= "</li>\n"; } } $spouselinks .= "</ul>"; } } if ($persons != "Yes") { $spouselinks .= " (" . $pgv_lang['none'] . ")\n\t\t"; } if ($person_parent != "Yes") { $parentlinks .= " (" . $pgv_lang['unknown'] . ")\n\t\t"; } if ($person_step != "Yes") { $step_parentlinks .= " (" . $pgv_lang['unknown'] . ")\n\t\t"; } } } } }
/** * returns INDI:SOUR:PAGE matching filter * @return Array of string */ function autocomplete_INDI_SOUR_PAGE($FILTER, $OPTION) { $rows = get_autocomplete_INDI_SOUR_PAGE($FILTER, $OPTION); $data = array(); foreach ($rows as $row) { $person = Person::getInstance($row); if ($person->canDisplayDetails()) { // a single INDI may have multiple level 1 and level 2 sources for ($level = 1; $level <= 2; $level++) { $i = 1; do { $srec = get_sub_record("SOUR @{$OPTION}@", $level, $person->gedrec, $i++); $page = get_gedcom_value("PAGE", $level + 1, $srec); if (stripos($page, $FILTER) !== false || empty($FILTER)) { $data[] = $page; } } while ($srec); } } } return $data; }
/** * Initialization function */ function init() { global $USE_RIN, $MAX_ALIVE_AGE, $bwidth, $bheight, $pbwidth, $pbheight, $GEDCOM, $GEDCOM_DEFAULT_TAB, $pgv_lang, $PEDIGREE_FULL_DETAILS, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS, $show_full; $this->sexarray["M"] = $pgv_lang["male"]; $this->sexarray["F"] = $pgv_lang["female"]; $this->sexarray["U"] = $pgv_lang["unknown"]; // Extract parameters from form $this->pid = safe_GET_xref('pid'); $this->show_full = safe_GET('show_full', array('0', '1'), $PEDIGREE_FULL_DETAILS); $this->chart_style = safe_GET_integer('chart_style', 0, 3, 0); $this->generations = safe_GET_integer('generations', 2, $MAX_DESCENDANCY_GENERATIONS, $DEFAULT_PEDIGREE_GENERATIONS); $this->box_width = safe_GET_integer('box_width', 50, 300, 100); // This is passed as a global. A parameter would be better... $show_full = $this->show_full; if (!isset($this->view)) { $this->view = ""; } if (!isset($this->personcount)) { $this->personcount = 1; } $this->Dbwidth *= $this->box_width / 100; if (!$this->show_full) { $bwidth *= $this->box_width / 150; } else { $bwidth *= $this->box_width / 100; } if (!$this->show_full) { $bheight = $bheight / 1.5; } $pbwidth = $bwidth + 12; $pbheight = $bheight + 14; $this->show_changes = safe_GET('show_changes'); $this->action = safe_GET('action'); // Validate form variables $this->pid = check_rootid($this->pid); if (strlen($this->name) < 30) { $this->cellwidth = "420"; } else { $this->cellwidth = strlen($this->name) * 14; } $this->descPerson = Person::getInstance($this->pid); $this->name = $this->descPerson->getFullName(); //-- if the person is from another gedcom then forward to the correct site /* if ($this->indi->isRemote()) { header('Location: '.encode_url(decode_url($this->indi->getLinkUrl(), false))); exit; } */ if (!$this->isPrintPreview()) { $this->visibility = "hidden"; $this->position = "absolute"; $this->display = "none"; } //-- perform the desired action switch ($this->action) { case "addfav": $this->addFavorite(); break; case "accept": $this->acceptChanges(); break; case "undo": $this->desc->undoChange(); break; } }
function print_charts_block_config($config) { global $pgv_lang, $ctype, $PGV_BLOCKS, $TEXT_DIRECTION, $PEDIGREE_ROOT_ID, $ENABLE_AUTOCOMPLETE; if (empty($config)) { $config = $PGV_BLOCKS["print_charts_block"]["config"]; } if (empty($config["rootId"])) { $config["rootId"] = $PEDIGREE_ROOT_ID; } if (empty($config['details'])) { $config['details'] = 'no'; } if ($ENABLE_AUTOCOMPLETE) { require PGV_ROOT . 'js/autocomplete.js.htm'; } ?> <tr><td class="descriptionbox wrap width33"><?php print $pgv_lang["chart_type"]; ?> </td> <td class="optionbox"> <select name="type"> <option value="pedigree"<?php if ($config["type"] == "pedigree") { print " selected=\"selected\""; } ?> ><?php print $pgv_lang["index_header"]; ?> </option> <option value="descendants"<?php if ($config["type"] == "descendants") { print " selected=\"selected\""; } ?> ><?php print $pgv_lang["descend_chart"]; ?> </option> <option value="hourglass"<?php if ($config["type"] == "hourglass") { print " selected=\"selected\""; } ?> ><?php print $pgv_lang["hourglass_chart"]; ?> </option> <?php if (file_exists(PGV_ROOT . 'includes/classes/class_treenav.php')) { ?> <option value="treenav"<?php if ($config["type"] == "treenav") { print " selected=\"selected\""; } ?> ><?php print $pgv_lang["interactive_tree"]; ?> </option> <?php } ?> </select> </td></tr> <tr> <td class="descriptionbox wrap width33"><?php print $pgv_lang["show_details"]; ?> </td> <td class="optionbox"> <select name="details"> <option value="no" <?php if ($config["details"] == "no") { print " selected=\"selected\""; } ?> ><?php print $pgv_lang['no']; ?> </option> <option value="yes" <?php if ($config["details"] == "yes") { print " selected=\"selected\""; } ?> ><?php print $pgv_lang['yes']; ?> </option> </select> </td> </tr> <tr> <td class="descriptionbox wrap width33"><?php print $pgv_lang["root_person"]; ?> </td> <td class="optionbox"> <input type="text" name="pid" id="pid" value="<?php print $config['pid']; ?> " size="5" /> <?php print_findindi_link('pid', ''); $root = Person::getInstance($config['pid']); if ($root) { echo ' <span class="list_item">', $root->getFullName(), $root->format_first_major_fact(PGV_EVENTS_BIRT, 1), '</span>'; } ?> </td> </tr> <?php // Cache file life if ($ctype == "gedcom") { print "<tr><td class=\"descriptionbox wrap width33\">"; print_help_link("cache_life_help", "qm"); print $pgv_lang["cache_life"]; print "</td><td class=\"optionbox\">"; print "<input type=\"text\" name=\"cache\" size=\"2\" value=\"" . $config["cache"] . "\" />"; print "</td></tr>"; } }
/** * Creates the lds_ord element and appends the correct information depending * on the type of lds_ord (Endowment, Sealing, Baptism). If there is a sealing, * the function will search if the family is in the clippings cart and if the * family is created or not. If the family is not created yet, it will be created * and added to the DOMDocument * * @param $indirec - The full INDI GEDCOM record of the person the lds_ord is being created * @param $eventName - the name of the LDS event (Baptism, Sealing, Endowment, etc...) * @param $eventABV - the event abbreviation in the GEDCOM (ie. SLGC, BAPL, ENDL) * @param $eParent - The parent element the lds event is attached to */ function create_lds_event($indirec, $eventName, $eventABV, $eParent) { global $ePerson, $TEMPLE_CODES, $clipping; require_once "includes/classes/class_person.php"; if (($hasldsevent = get_sub_record(1, "1 " . $eventABV, $indirec)) != null) { // Create <lds_ord> and attaches the type attribute $eLdsEvent = $this->dom->createElement("lds_ord"); $eLdsEvent->setAttribute("type", $eventName); if (($dateRec = get_sub_record(1, "2 DATE", $hasldsevent)) != null) { $this->create_date($eLdsEvent, $dateRec, 2); } // Create <temple>, this element is common with all lds ords if (($temple = get_gedcom_value($eventABV . ":TEMP", 1, $indirec)) != null) { $eTemple = $this->dom->createElement("temple"); $eTemple->setAttribute("val", $temple); $eTemple = $eLdsEvent->appendChild($eTemple); } if (($place = get_gedcom_value($eventABV . ":PLAC", 1, $indirec)) != null) { $hlink = $this->query_dom("./places/placeobj[@title=\"{$place}\"]/@handle"); if ($hlink == null) { $hlink = $this->generateHandle(); $this->create_placeobj($place, $hlink); $this->create_place($eLdsEvent, $hlink); } else { $this->create_place($eLdsEvent, $hlink); } } // Check to see if the STAT of the ordinance is set and add it to the // <lds_ord> element if (($stat = get_gedcom_value($eventABV . ":STAT", 1, $indirec)) != null) { $eStatus = $this->dom->createElement("status"); $stat = get_gedcom_value($eventABV . ":STAT", 1, $indirec); $eStatus->setAttribute("val", isset($stat)); $eStatus = $eLdsEvent->appendChild($eStatus); } // If the event is a sealing if ($eventABV == "SLGC") { // Create an instance of person and look for their family record $person = Person::getInstance($clipping["id"]); $famId = $person->getChildFamilyIds(); $famrec = find_family_record($famId[0]); $fid = $famId[0]; $handle = $this->query_dom("./families/family[@id=\"{$fid}\"]/@handle"); if ($handle == null && id_in_cart($fid)) { /* * If the family does not exist and their ID is in the clippings cart, * you must create the family before you can query them in the dom to get * their hlink. The hlink is generated when the person element is created. * This causes overhead creating objects that are never added to the XML file * perhaps there is some other way this can be done reducing the overhead? * */ $this->create_family($famrec, $famId[0]); $handle = $this->query_dom("./families/family[@id=\"{$fid}\"]/@handle"); $eFam = $this->dom->createElement("sealed_to"); $eFam->setAttribute("hlink", $handle); $eFam = $eLdsEvent->appendChild($eFam); $person = null; } else { if ($handle != null && id_in_cart($fid)) { $eFam = $this->dom->createElement("sealed_to"); $eFam->setAttribute("hlink", $handle); $eFam = $eLdsEvent->appendChild($eFam); $person = null; } } } if (($note = get_sub_record(1, "2 NOTE", $hasldsevent)) != null) { $this->create_note($eLdsEvent, $note, 2); } $num = 1; while (($sourcerefRec = get_sub_record(2, "2 SOUR", $hasldsevent, $num)) != null) { $this->create_sourceref($eLdsEvent, $sourcerefRec, 2); $num++; } $eLdsEvent = $eParent->appendChild($eLdsEvent); } }
</td> <td class="descriptionbox"><?php echo $factarray["BIRT"]; ?> </td> <td class="descriptionbox"><?php echo $pgv_lang["remove"]; ?> <input type="hidden" name="F<?php echo $i; ?> CDEL" value="" /></td> </tr> <?php foreach ($chil as $c => $child) { $person = Person::getInstance($child); echo "<tr><td class=\"optionbox\">"; $name = $person->getFullName(); if ($SHOW_ID_NUMBERS) { $name .= " (" . $child . ")"; } $name .= " [" . $pgv_lang["edit"] . "]"; echo "<a href=\"#\" onclick=\"return quickEdit('", $child, "', '', '", PGV_GEDCOM, "');\">"; echo PrintReady(stripLRMRLM($name)); echo "</a>"; echo "</td>\n<td class=\"optionbox center\">"; $sex = $person->getSex(); if ($sex == 'M') { echo Person::sexImage('M', 'small'), $pgv_lang['male']; } elseif ($sex == 'F') { echo Person::sexImage('F', 'small'), $pgv_lang['female'];
echo '<input type="text" name="form_firstname" tabindex="', ++$tab, '" value="', get_user_setting(PGV_USER_ID, 'firstname'), '" />'; echo '</td></tr>'; echo '<tr><td class="descriptionbox wrap">'; echo print_help_link('edituser_lastname_help', 'qm', '', false, true); echo $pgv_lang['lastname'], '</td><td class="optionbox">'; echo '<input type="text" name="form_lastname" tabindex="', ++$tab, '" value="', get_user_setting(PGV_USER_ID, 'lastname'), '" />'; echo '</td></tr>'; $person = Person::getInstance(PGV_USER_GEDCOM_ID); if ($person) { echo '<tr><td class="descriptionbox wrap">'; echo print_help_link("edituser_gedcomid_help", "qm", '', false, true); echo $pgv_lang['gedcomid'], '</td><td class="optionbox">'; echo $person->format_list('span'); echo '</td></tr>'; } $person = Person::getInstance(PGV_USER_ROOT_ID); echo '<tr><td class="descriptionbox wrap">'; echo print_help_link('edituser_rootid_help', 'qm', '', false, true); echo $pgv_lang['rootid'], '</td><td class="optionbox">'; echo '<input type="text" name="form_rootid" id="rootid" tabindex="', ++$tab, '" value="', PGV_USER_ROOT_ID, '" />'; echo print_findindi_link('rootid', '', true), '<br/>'; if ($person) { echo $person->format_list('span'); } echo '</td></tr>'; echo '<tr><td class="descriptionbox wrap">'; echo print_help_link('edituser_password_help', 'qm', '', false, true); echo $pgv_lang['password'], '</td><td class="optionbox">'; echo '<input type="password" name="form_pass1" tabindex="', ++$tab, '" /> ', $pgv_lang['leave_blank'], '</td></tr>'; echo '<tr><td class="descriptionbox wrap">'; echo print_help_link('edituser_conf_password_help', 'qm', '', false, true);
/** * creates an array with all of the individual ids to be displayed on an ascendancy chart * * the id in position 1 is the root person. The other positions are filled according to the following algorithm * if an individual is at position $i then individual $i's father will occupy position ($i*2) and $i's mother * will occupy ($i*2)+1 * * @param string $rootid * @return array $treeid */ function ancestry_array($rootid, $maxgen = 0) { global $PEDIGREE_GENERATIONS, $SHOW_EMPTY_BOXES; // -- maximum size of the id array if ($maxgen == 0) { $maxgen = $PEDIGREE_GENERATIONS; } $treesize = pow(2, $maxgen); $treeid = array(); $treeid[0] = ""; $treeid[1] = $rootid; // -- fill in the id array for ($i = 1; $i < $treesize / 2; $i++) { $treeid[$i * 2] = false; // -- father $treeid[$i * 2 + 1] = false; // -- mother if (!empty($treeid[$i])) { $person = Person::getInstance($treeid[$i]); $family = $person->getPrimaryChildFamily(); // Store the prefered parents if (!empty($family)) { $treeid[$i * 2] = $family->getHusbId(); $treeid[$i * 2 + 1] = $family->getWifeId(); } } } return $treeid; }
/** * Add a person and his or her immediate family members to * the pids array * @param string $newpid */ function addFamily($newpid, $gen = 0) { if (!empty($newpid)) { $person = Person::getInstance($newpid); if (is_null($person)) { return; } $this->pids[] = $newpid; $families = $person->getSpouseFamilies(); //-- foreach gets the spouse and children of the individual. foreach ($families as $famID => $family) { if ($newpid != $family->getHusbId()) { if ($gen > 0) { $this->pids[] = addFamily($family->getHusbId(), $gen - 1); } else { $this->pids[] = $family->getHusbId(); } } if ($newpid != $family->getWifeId()) { if ($gen > 0) { $this->pids[] = addFamily($family->getWifeId(), $gen - 1); } else { $this->pids[] = $family->getWifeId(); } } $children = $family->getChildren(); foreach ($children as $childID => $child) { if ($gen > 0) { $this->pids[] = addFamily($child->getXref(), $gen - 1); } else { $this->pids[] = $child->getXref(); } } } $families = $person->getChildFamilies(); //-- foreach gets the father, mother and sibblings of the individual. foreach ($families as $famID => $family) { if ($gen > 0) { $this->pids[] = addFamily($family->getHusbId(), $gen - 1); } else { $this->pids[] = $family->getHusbId(); } if ($gen > 0) { $this->pids[] = addFamily($family->getWifeId(), $gen - 1); } else { $this->pids[] = $family->getWifeId(); } $children = $family->getChildren(); foreach ($children as $childID => $child) { if ($newpid != $child->getXref()) { if ($gen > 0) { $this->pids[] = addFamily($child->getXref(), $gen - 1); } else { $this->pids[] = $child->getXref(); } } } } } }
function add_descendancy(&$list, $pid, $parents = false, $generations = -1) { $person = Person::getInstance($pid); if ($person == null) { return; } if (!isset($list[$pid])) { $list[$pid] = $person; } if (!isset($list[$pid]->generation)) { $list[$pid]->generation = 0; } $famids = $person->getSpouseFamilies(); if (count($famids) > 0) { foreach ($famids as $famid => $family) { if ($family) { if ($parents) { $husband = $family->getHusband(); $wife = $family->getWife(); if ($husband) { $list[$husband->getXref()] = $husband; if (isset($list[$pid]->generation)) { $list[$husband->getXref()]->generation = $list[$pid]->generation - 1; } else { $list[$husband->getXref()]->generation = 1; } } if ($wife) { $list[$wife->getXref()] = $wife; if (isset($list[$pid]->generation)) { $list[$wife->getXref()]->generation = $list[$pid]->generation - 1; } else { $list[$wife->getXref()]->generation = 1; } } } $children = $family->getChildren(); foreach ($children as $child) { if ($child) { $list[$child->getXref()] = $child; if (isset($list[$pid]->generation)) { $list[$child->getXref()]->generation = $list[$pid]->generation + 1; } else { $list[$child->getXref()]->generation = 2; } } } if ($generations == -1 || $list[$pid]->generation + 1 < $generations) { foreach ($children as $child) { add_descendancy($list, $child->getXref(), $parents, $generations); // recurse on the childs family } } } } } }
function fact_AKA_localisation_sl(&$fact, &$pid) { global $factarray; $person = Person::getInstance($pid); $sex = $person->getSex(); if ($fact == "_INTE") { if ($sex == "M") { $factarray[$fact] = "Pokopan"; } else { if ($sex == "F") { $factarray[$fact] = "Pokopana"; } } // ženska } else { if ($sex == "M") { $factarray[$fact] = "Znan tudi kot"; } else { if ($sex == "F") { $factarray[$fact] = "Znana tudi kot "; } } // ženska } }
/** * creates an array with all of the individual ids to be displayed on an ascendancy chart * * the id in position 1 is the root person. The other positions are filled according to the following algorithm * if an individual is at position $i then individual $i's father will occupy position ($i*2) and $i's mother * will occupy ($i*2)+1 * * @param string $rootid * @return array $treeid */ function ancestryArray($id = 0, $maxgen = 0) { global $gBitSystem; // -- maximum size of the id array if ($id == 0) { $tid = $this->mRootId; } else { $tid = $id; } if ($maxgen == 0) { $maxgen = $gBitSystem->getConfig('pgv_default_pedigree_generations', 4); } $treesize = pow(2, $maxgen + 1); $treeid = array(); $treeid[0] = ""; $treeid[1] = $tid; // -- fill in the id array for ($i = 1; $i < $treesize / 2; $i++) { $treeid[$i * 2] = false; // -- father $treeid[$i * 2 + 1] = false; // -- mother if (!empty($treeid[$i])) { $person = Person::getInstance($treeid[$i]); $families = $person->getChildFamilies(); foreach ($families as $famid => $family) { /*@var $family Family */ if (empty($treeid[$i * 2])) { $treeid[$i * 2] = $family->getHusbId(); } // -- set father id if (empty($treeid[$i * 2 + 1])) { $treeid[$i * 2 + 1] = $family->getWifeId(); } // -- set mother id } } } return $treeid; }
function getFirstRelationsName_fi($pid) { // In Finnish we want the genitive form of the name $person = Person::getInstance($pid); if ($person) { $name = $person->getFullName(); } else { $name = ''; } // for now I have been asked to remove the body of this function - if any Finnish // speaker can sort this out I would be grateful. return $name; // First we look for Consonant gradation if (preg_match("/kki\$/", $name)) { preg_replace("/kki\$/", "kin", $name); } else { if (preg_match("/kka\$/", $name)) { preg_replace("/kka\$/", "kan", $name); } else { if (preg_match("/ppi\$/", $name)) { preg_replace("/ppi\$/", "pin", $name); } else { if (preg_match("/ppa\$/", $name)) { preg_replace("/ppa\$/", "pan", $name); } else { if (preg_match("/tti\$/", $name)) { preg_replace("/tti\$/", "tin", $name); } else { if (preg_match("/tta\$/", $name)) { preg_replace("/tta\$/", "tan", $name); } else { if (preg_match("/nti\$/", $name)) { preg_replace("/nti\$/", "nnin", $name); } else { if (preg_match("/nta\$/", $name)) { preg_replace("/nta\$/", "nnan", $name); } else { if (preg_match("/e\$/", $name)) { $name = $name . "en"; } else { if (preg_match("/nen\$/", $name)) { preg_replace("/nen\$/", "sen", $name); } else { if (preg_match("/n\$/", $name)) { preg_replace("/n\$/", "men", $name); } else { if (preg_match("/si\$/", $name)) { preg_replace("/si\$/", "den", $name); } else { if (preg_match("/is\$/", $name)) { preg_replace("/is\$/", "iin", $name); } else { if (preg_match("/as\$/", $name)) { preg_replace("/as\$/", "aan", $name); } else { if (preg_match("/a\$/", $name)) { preg_replace("/a\$/", "aan", $name); } else { if (preg_match("/us\$/", $name)) { preg_replace("/us\$/", "ksen", $name); } else { if (preg_match("/ys\$/", $name)) { preg_replace("/ys\$/", "ksen", $name); } else { if (preg_match("/os\$/", $name)) { preg_replace("/os\$/", "ksen", $name); } else { if (preg_match("/ös\$/", $name)) { preg_replace("/ös\$/", "ksen", $name); } else { $name = $name . "n"; } } } } } } } } } } } } } } } } } } } return $name; }
} } } } break; case 2: // Individual list $treeid = ancestry_array($controller->rootid, $PEDIGREE_GENERATIONS); echo '<div class="center">'; print_indi_table($treeid, $pgv_lang["ancestry_chart"] . ' : ' . PrintReady($controller->name), 'sosa'); echo '</div>'; break; case 3: // Family list $treeid = ancestry_array($controller->rootid, $PEDIGREE_GENERATIONS - 1); $famlist = array(); foreach ($treeid as $pid) { $person = Person::getInstance($pid); if (is_null($person)) { continue; } foreach ($person->getChildFamilies() as $famc) { $famlist[$famc->getXref()] = $famc; } } echo '<div class="center">'; print_fam_table($famlist, $pgv_lang["ancestry_chart"] . ' : ' . PrintReady($controller->name)); echo '</div>'; break; } print_footer();
function getFirstRelationsName_pl($pid) { // In Polish we want the genitive form of the name $person = Person::getInstance($pid); if ($person) { $fname = $person->getFullName(); } else { $fname = ''; } return $fname; // tested $pname = ''; $sex = Person::getInstance($pid)->getSex(); if ($sex == "M") { $names = explode(" ", $fname); foreach ($names as $name) { if (preg_match('/ski$/', $name)) { $pname .= " " . preg_replace('/ski$/', 'skiego', $name); } else { if (preg_match('/cki$/', $name)) { $pname .= " " . preg_replace('/cki$/', 'ckiego', $name); } else { if (preg_match('/dzki$/', $name)) { $pname .= " " . preg_replace('/dzki$/', 'dzkiego', $name); } else { if (preg_match('/żki$/', $name)) { $pname .= " " . preg_replace('/żki$/', 'żkiego', $name); } else { if (preg_match('/y$/', $name)) { $pname .= " " . preg_replace('/y$/', 'ego', $name); } else { if (preg_match('/i$/', $name)) { $pname .= " " . preg_replace('/i$/', 'iego', $name); } else { if (preg_match('/ek$/', $name)) { $pname .= " " . preg_replace('/ek$/', 'ka', $name); } else { if (preg_match('/eł$/', $name)) { $pname .= " " . preg_replace('/eł$/', 'ła', $name); } else { if (preg_match('/el$/', $name)) { $pname .= " " . preg_replace('/el$/', 'la', $name); } else { if (preg_match('/ń$/', $name)) { $pname .= " " . preg_replace('/ń$/', 'nia', $name); } else { if (preg_match('/ź$/', $name)) { $pname .= " " . preg_replace('/ź$/', 'zia', $name); } else { if (preg_match('/niec$/', $name)) { $pname .= " " . preg_replace('/niec$/', 'ńca', $name); } else { if (preg_match('/iec$/', $name)) { $pname .= " " . preg_replace('/iec$/', 'ca', $name); } else { if (preg_match('/ec$/', $name)) { $pname .= " " . preg_replace('/ec$/', 'ca', $name); } else { if (preg_match('/er$/', $name)) { $pname .= " " . preg_replace('/er$/', 'ra', $name); } else { if (preg_match('/go$/', $name)) { $pname .= " " . preg_replace('/go$/', 'gi', $name); } else { if (preg_match('/io$/', $name)) { $pname .= " " . preg_replace('/io$/', 'ii', $name); } else { if (preg_match('/jo$/', $name)) { $pname .= " " . preg_replace('/jo$/', 'ji', $name); } else { if (preg_match('/ko$/', $name)) { $pname .= " " . preg_replace('/ko$/', 'ki', $name); } else { if (preg_match('/o$/', $name)) { $pname .= " " . preg_replace('/o$/', 'y', $name); } else { if (preg_match('/ga$/', $name)) { $pname .= " " . preg_replace('/ga$/', 'gi', $name); } else { if (preg_match('/ia$/', $name)) { $pname .= " " . preg_replace('/ia$/', 'i', $name); } else { if (preg_match('/ja$/', $name)) { $pname .= " " . preg_replace('/ja$/', 'ji', $name); } else { if (preg_match('/ka$/', $name)) { $pname .= " " . preg_replace('/ka$/', 'ki', $name); } else { if (preg_match('/a$/', $name)) { $pname .= " " . preg_replace('/a$/', 'y', $name); } else { if (preg_match('/ek]$/', $name)) { $pname .= " " . preg_replace('/ek]$/', 'ka]', $name); } else { if (preg_match('/"$/', $name)) { $pname .= " " . preg_replace('/"$/', 'a"', $name); } else { $pname .= " " . $name . "a"; } } } } } } } } } } } } } } } } } } } } } } } } } } } } } else { if ($sex == "F") { $names = explode(" ", $fname); foreach ($names as $name) { if (preg_match('/raska$/', $name)) { $pname .= " " . preg_replace('/ska$/', 'ski', $name); } else { if (preg_match('/ska$/', $name)) { $pname .= " " . preg_replace('/ska$/', 'skiej', $name); } else { if (preg_match('/cka$/', $name)) { $pname .= " " . preg_replace('/cka$/', 'ckiej', $name); } else { if (preg_match('/dzka$/', $name)) { $pname .= " " . preg_replace('/dzka$/', 'dzkiej', $name); } else { if (preg_match('/żka$/', $name)) { $pname .= " " . preg_replace('/żka$/', 'żkiej', $name); } else { if (preg_match('/ska]$/', $name)) { $pname .= " " . preg_replace('/ska]$/', 'skiej]', $name); } else { if (preg_match('/cka]$/', $name)) { $pname .= " " . preg_replace('/cka]$/', 'ckiej]', $name); } else { if (preg_match('/dzka]$/', $name)) { $pname .= " " . preg_replace('/dzka]$/', 'dzkiej]', $name); } else { if (preg_match('/żka]$/', $name)) { $pname .= " " . preg_replace('/żka]$/', 'żkiej]', $name); } else { if (preg_match('/ka]$/', $name)) { $pname .= " " . preg_replace('/ka]$/', 'ki]', $name); } else { if (preg_match('/a]$/', $name)) { $pname .= " " . preg_replace('/a]$/', 'y]', $name); } else { if (preg_match('/ka"$/', $name)) { $pname .= " " . preg_replace('/ka"$/', 'ki"', $name); } else { $pname .= " " . preg_replace(array('/eja$/', '/ja$/', '/ia$/', '/la$/', '/ga$/', '/ea$/', '/a$/'), array('ei', 'ji', 'ii', 'li', 'gi', 'ei', 'y'), $name); } } } } } } } } } } } } } } else { $pname = "osoby: " . $pname; } } if (!empty($pname)) { return trim($pname); } else { return $fname; } }
/** * Calculates number of generations a person has * * @param mixed $pid ID of person to see how far down the descendency goes * @param mixed $depth Pass in 0 and it calculates how far down descendency goes * @access public * @return maxdc Amount of generations the descendency actually goes */ function max_descendency_generations($pid, $depth) { if ($depth > $this->generations) { return $depth; } $person = Person::getInstance($pid); if (is_null($person)) { return $depth; } $famids = $person->getSpouseFamilies(); if ($person->getNumberOfChildren() == 0) { return $depth - 1; } $maxdc = $depth; foreach ($famids as $famid => $family) { $ct = preg_match_all("/1 CHIL @(.*)@/", $family->gedrec, $match, PREG_SET_ORDER); for ($i = 0; $i < $ct; $i++) { $chil = trim($match[$i][1]); $dc = $this->max_descendency_generations($chil, $depth + 1); if ($dc >= $this->generations) { return $dc; } if ($dc > $maxdc) { $maxdc = $dc; } } } $maxdc++; if ($maxdc == 1) { $maxdc++; } return $maxdc; }
/** * Load the children from the database * We used to load the children when the family was created, but that has performance issues * because we often don't need all the children * now, children are only loaded as needed */ function loadChildren() { if ($this->children_loaded) { return; } $this->childrenIds = array(); $this->numChildren = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $this->gedrec, $smatch, PREG_SET_ORDER); for ($i = 0; $i < $this->numChildren; $i++) { //-- get the childs ids $chil = trim($smatch[$i][1]); $this->childrenIds[] = $chil; } foreach ($this->childrenIds as $t => $chil) { $child = Person::getInstance($chil); if (!is_null($child)) { $this->children[] = $child; } } $this->children_loaded = true; }
<td class="optionbox"><input type="text" name="NEW_PEDIGREE_ROOT_ID" id="NEW_PEDIGREE_ROOT_ID" value="<?php print $PEDIGREE_ROOT_ID; ?> " size="5" tabindex="<?php $i++; print $i; ?> " onfocus="getHelp('PEDIGREE_ROOT_ID_help');" /> <?php // We can only show the person's details if we're editing an existing // gedcom. Otherwise there could be a mismatch between DB and FILE, // or we could be uploading a new file, which we haven't seen yet. if ($source == '') { print_findindi_link("NEW_PEDIGREE_ROOT_ID", ""); if ($PEDIGREE_ROOT_ID) { $person = Person::getInstance($PEDIGREE_ROOT_ID); if ($person) { echo ' <span class="list_item">', $person->getFullName(), ' ', $person->format_first_major_fact(PGV_EVENTS_BIRT, 1), '</span>'; } else { echo ' <span class="error">', $pgv_lang['unable_to_find_record'], '</span>'; } } } ?> </td> </tr> <tr> <td class="descriptionbox wrap width20"> <?php print_help_link("CALENDAR_FORMAT_help", "qm", "CALENDAR_FORMAT"); print $pgv_lang["CALENDAR_FORMAT"];
header("content-type:text/html;charset=utf-8"); class Person { public $userName = "******"; public function show() { echo "用户名为:{$this->userName}<br>"; } //防止实例化 private function __construct() { } //防止克隆 private function __clone() { } //获得当前类的对象 public static function getInstance() { static $p = NULL; if ($p == NULL) { $p = new Person(); } return $p; } } $p1 = Person::getInstance(); $p1->show(); $p2 = Person::getInstance(); $p2->userName = "******"; $p1->show();