示例#1
0
 static function &getInstance($data, $simple = true)
 {
     global $gedcom_record_cache, $GEDCOM, $pgv_changes;
     if (is_array($data)) {
         $ged_id = $data['ged_id'];
         $pid = $data['xref'];
     } else {
         $ged_id = get_id_from_gedcom($GEDCOM);
         $pid = $data;
     }
     // Check the cache first
     if (isset($gedcom_record_cache[$pid][$ged_id])) {
         return $gedcom_record_cache[$pid][$ged_id];
     }
     // Look for the record in the database
     if (!is_array($data)) {
         $data = fetch_other_record($pid, $ged_id);
         // If we didn't find the record in the database, it may be remote
         if (!$data && strpos($pid, ':')) {
             list($servid, $remoteid) = explode(':', $pid);
             $service = ServiceClient::getInstance($servid);
             if ($service) {
                 // TYPE will be replaced with the type from the remote record
                 $data = $service->mergeGedcomRecord($remoteid, "0 @{$pid}@ TYPE\n1 RFN {$pid}", false);
             }
         }
         // If we didn't find the record in the database, it may be new/pending
         if (!$data && PGV_USER_CAN_EDIT && isset($pgv_changes[$pid . '_' . $GEDCOM])) {
             $data = find_updated_record($pid);
             $fromfile = true;
         }
         // If we still didn't find it, it doesn't exist
         if (!$data) {
             return null;
         }
     }
     // Create the object
     $object = new Repository($data, $simple);
     if (!empty($fromfile)) {
         $object->setChanged(true);
     }
     // Store it in the cache
     $gedcom_record_cache[$object->xref][$object->ged_id] =& $object;
     //-- also store it using its reference id (sid:pid and local gedcom for remote links)
     $gedcom_record_cache[$pid][$ged_id] =& $object;
     return $object;
 }
示例#2
0
 function init()
 {
     global $Dbwidth, $bwidth, $pbwidth, $pbheight, $bheight, $GEDCOM, $pgv_lang, $CONTACT_EMAIL, $show_famlink, $pgv_changes;
     $bwidth = $Dbwidth;
     $pbwidth = $bwidth + 12;
     $pbheight = $bheight + 14;
     $show_famlink = $this->view != 'preview';
     $this->famid = safe_GET_xref('famid');
     $this->family = Family::getInstance($this->famid);
     if (empty($this->famrec)) {
         $ct = preg_match("/(\\w+):(.+)/", $this->famid, $match);
         if ($ct > 0) {
             $servid = trim($match[1]);
             $remoteid = trim($match[2]);
             include_once 'includes/classes/class_serviceclient.php';
             $service = ServiceClient::getInstance($servid);
             if (!is_null($service)) {
                 $newrec = $service->mergeGedcomRecord($remoteid, "0 @" . $this->famid . "@ FAM\n1 RFN " . $this->famid, false);
                 $this->famrec = $newrec;
             }
         }
         //-- if no record was found create a default empty one
         if (isset($pgv_changes[$this->famid . "_" . $GEDCOM])) {
             $this->famrec = "0 @" . $this->famid . "@ FAM\n";
             $this->family = new Family($this->famrec);
         } else {
             if (empty($this->family)) {
                 return false;
             }
         }
     }
     $this->famrec = $this->family->getGedcomRecord();
     $this->display = displayDetailsById($this->famid, 'FAM');
     //-- if the user can edit and there are changes then get the new changes
     if ($this->show_changes && PGV_USER_CAN_EDIT && isset($pgv_changes[$this->famid . "_" . $GEDCOM])) {
         $newrec = find_updated_record($this->famid);
         if (empty($newrec)) {
             $newrec = find_family_record($this->famid);
         }
         $this->difffam = new Family($newrec);
         $this->difffam->setChanged(true);
         $this->family->diffMerge($this->difffam);
         //$this->famrec = $newrec;
         //$this->family = new Family($this->famrec);
     }
     $this->parents = array('HUSB' => $this->family->getHusbId(), 'WIFE' => $this->family->getWifeId());
     //-- check if we can display both parents
     if ($this->display == false) {
         $this->showLivingHusb = showLivingNameById($this->parents['HUSB']);
         $this->showLivingWife = showLivingNameById($this->parents['WIFE']);
     }
     //-- add favorites action
     if ($this->action == 'addfav' && !empty($_REQUEST['gid']) && PGV_USER_NAME) {
         $_REQUEST['gid'] = strtoupper($_REQUEST['gid']);
         $indirec = find_family_record($_REQUEST['gid']);
         if ($indirec) {
             $favorite = array('username' => PGV_USER_NAME, 'gid' => $_REQUEST['gid'], 'type' => 'FAM', 'file' => $GEDCOM, 'url' => '', 'note' => '', 'title' => '');
             addFavorite($favorite);
         }
     }
     if (PGV_USER_CAN_ACCEPT) {
         if ($this->action == 'accept') {
             if (accept_changes($_REQUEST['famid'] . '_' . $GEDCOM)) {
                 $this->show_changes = false;
                 $this->accept_success = true;
                 //-- check if we just deleted the record and redirect to index
                 $famrec = find_family_record($_REQUEST['famid']);
                 if (empty($famrec)) {
                     header("Location: index.php?ctype=gedcom");
                     exit;
                 }
                 $this->family = new Family($famrec);
                 $this->parents = find_parents($_REQUEST['famid']);
             }
         }
         if ($this->action == 'undo') {
             $this->family->undoChange();
             $this->parents = find_parents($_REQUEST['famid']);
         }
     }
     //-- make sure we have the true id from the record
     $ct = preg_match("/0 @(.*)@/", $this->famrec, $match);
     if ($ct > 0) {
         $this->famid = trim($match[1]);
     }
     if ($this->showLivingHusb == false && $this->showLivingWife == false) {
         print_header($pgv_lang['private'] . " " . $pgv_lang['family_info']);
         print_privacy_error($CONTACT_EMAIL);
         print_footer();
         exit;
     }
     $this->title = $this->family->getFullName();
     if (empty($this->parents['HUSB']) || empty($this->parents['WIFE'])) {
         $this->link_relation = 0;
     } else {
         $this->link_relation = 1;
     }
 }
示例#3
0
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=<?php 
print $CHARACTER_SET;
?>
" />
		<title><?php 
print "{$pid} Record";
?>
</title>
	</head>
	<body><?php 
if (!$SHOW_GEDCOM_RECORD && !PGV_USER_CAN_ACCEPT) {
    print "<span class=\"error\">" . $pgv_lang["ged_noshow"] . "</span>\n";
    print "</body></html>";
    exit;
}
$obj = GedcomRecord::getInstance($pid);
if (is_null($obj) || !$obj->canDisplayDetails()) {
    print_privacy_error($CONTACT_EMAIL);
    print "</body></html>";
    exit;
}
if (!isset($fromfile)) {
    $indirec = $obj->getGedcomRecord();
} else {
    $indirec = find_updated_record($pid);
    $indirec = privatize_gedcom($indirec);
}
$indirec = preg_replace("/@(\\w+)@/", "@<a href=\"gedrecord.php?pid=\$1\">\$1</a>@", $indirec);
print "<pre>{$indirec}</pre>";
print "</body></html>";
示例#4
0
 if (!in_array($child->getXref(), $newchildren)) {
     //-- remove the CHIL link from the family record
     $pos1 = strpos($gedrec, "1 CHIL @" . $child->getXref() . "@");
     if ($pos1 !== false) {
         $pos2 = strpos($gedrec, "\n1", $pos1 + 5);
         if ($pos2 === false) {
             $pos2 = strlen($gedrec);
         } else {
             $pos2++;
         }
         $gedrec = substr($gedrec, 0, $pos1) . substr($gedrec, $pos2);
         $updated = true;
     }
     //-- remove the FAMC link from the child record
     if (isset($pgv_changes[$child->getXref() . "_" . $GEDCOM])) {
         $indirec = find_updated_record($child->getXref());
     } else {
         $indirec = find_person_record($child->getXref());
     }
     $pos1 = strpos($indirec, "1 FAMC @{$famid}@");
     if ($pos1 !== false) {
         $pos2 = strpos($indirec, "\n1", $pos1 + 5);
         if ($pos2 === false) {
             $pos2 = strlen($indirec);
         } else {
             $pos2++;
         }
         $indirec = substr($indirec, 0, $pos1) . substr($indirec, $pos2);
         replace_gedrec($child->getXref(), $indirec);
     }
 }
示例#5
0
/**
 * 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($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, $show_full, $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;
    global $SEARCH_SPIDER;
    if ($style != 2) {
        $style = 1;
    }
    flush();
    if (!isset($OLD_PGENS)) {
        $OLD_PGENS = $DEFAULT_PEDIGREE_GENERATIONS;
    }
    if (!isset($talloffset)) {
        $talloffset = $PEDIGREE_LAYOUT;
    }
    if (!isset($show_full)) {
        $show_full = $PEDIGREE_FULL_DETAILS;
    }
    // NOTE: Start div out-rand()
    if ($pid == false) {
        print "\n\t\t\t<div id=\"out-" . rand() . "\" class=\"person_boxNN\" style=\"width: " . $bwidth . "px; height: " . $bheight . "px; padding: 2px; overflow: hidden;\">";
        print "<br />";
        print "\n\t\t\t</div>";
        return false;
    }
    if ($count == 0) {
        $count = rand();
    }
    $lbwidth = $bwidth * 0.75;
    if ($lbwidth < 150) {
        $lbwidth = 150;
    }
    $indirec = find_person_record($pid);
    if (!$indirec) {
        $indirec = find_updated_record($pid);
    }
    $isF = "NN";
    if (preg_match("/1 SEX F/", $indirec) > 0) {
        $isF = "F";
    } else {
        if (preg_match("/1 SEX M/", $indirec) > 0) {
            $isF = "";
        }
    }
    $disp = displayDetailsByID($pid, "INDI");
    $boxID = $pid . "." . $personcount . "." . $count;
    $mouseAction1 = "onmouseover=\"clear_family_box_timeout('" . $boxID . "');\" onmouseout=\"family_box_timeout('" . $boxID . "');\"";
    $mouseAction2 = " onmouseover=\"expandbox('" . $boxID . "', {$style}); return false;\" onmouseout=\"restorebox('" . $boxID . "', {$style}); return false;\"";
    $mouseAction3 = " onmousedown=\"expandbox('" . $boxID . "', {$style}); return false;\" onmouseup=\"restorebox('" . $boxID . "', {$style}); return false;\"";
    $mouseAction4 = " onclick=\"expandbox('" . $boxID . "', {$style}); return false;\"";
    if ($disp || showLivingNameByID($pid)) {
        if ($show_famlink && empty($SEARCH_SPIDER)) {
            if ($LINK_ICONS != "disabled") {
                //-- draw a box for the family popup
                // NOTE: Start div I.$pid.$personcount.$count.links
                print "\n\t\t<div id=\"I" . $boxID . "links\" style=\"position:absolute; ";
                print "left: 0px; top:0px; width: " . $lbwidth . "px; visibility:hidden; z-index:'100';\">";
                print "\n\t\t\t<table class=\"person_box{$isF}\"><tr><td class=\"details1\">";
                // NOTE: Zoom
                if ($TEXT_DIRECTION == "ltr") {
                    $title = $pgv_lang["pedigree_chart"] . ": " . $pid;
                } else {
                    $title = $pid . " :" . $pgv_lang["pedigree_chart"];
                }
                print "<a href=\"pedigree.php?rootid={$pid}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;talloffset={$talloffset}&amp;ged={$GEDCOM}\" title=\"{$title}\" {$mouseAction1}><b>" . $pgv_lang["index_header"] . "</b></a>\n";
                if ($TEXT_DIRECTION == "ltr") {
                    $title = $pgv_lang["descend_chart"] . ": " . $pid;
                } else {
                    $title = $pid . " :" . $pgv_lang["descend_chart"];
                }
                print "<br /><a href=\"descendancy.php?pid={$pid}&amp;show_full={$show_full}&amp;generations={$generations}&amp;box_width={$box_width}&amp;ged={$GEDCOM}\" title=\"{$title}\" {$mouseAction1}><b>" . $pgv_lang["descend_chart"] . "</b></a><br />\n";
                //					$username = getUserName();
                /*					if (!empty($username)) {
                						 $tuser=getUser($username);
                						 if (!empty($tuser["gedcomid"][$GEDCOM])) {
                	 						  if ($TEXT_DIRECTION=="ltr") $title = $pgv_lang["relationship_chart"].": ".$pid;
                	 						  else $title = $pid." :".$pgv_lang["relationship_chart"];
                							  print "<a href=\"relationship.php?pid1=".$tuser["gedcomid"][$GEDCOM]."&amp;pid2=".$pid."&amp;ged=$GEDCOM\" title=\"$title\" ".$mouseAction1."><b>".$pgv_lang["relationship_to_me"]."</b></a><br />\n";
                						 }
                					}
                */
                // NOTE: Zoom
                if (file_exists("ancestry.php")) {
                    if ($TEXT_DIRECTION == "ltr") {
                        $title = $pgv_lang["ancestry_chart"] . ": " . $pid;
                    } else {
                        $title = $pid . " :" . $pgv_lang["ancestry_chart"];
                    }
                    print "<a href=\"ancestry.php?rootid={$pid}&amp;chart_style={$chart_style}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;box_width={$box_width}&amp;ged={$GEDCOM}\" title=\"{$title}\" " . $mouseAction1 . "><b>" . $pgv_lang["ancestry_chart"] . "</b></a><br />\n";
                }
                if (file_exists("compact.php")) {
                    if ($TEXT_DIRECTION == "ltr") {
                        $title = $pgv_lang["compact_chart"] . ": " . $pid;
                    } else {
                        $title = $pid . " :" . $pgv_lang["compact_chart"];
                    }
                    print "<a href=\"compact.php?rootid={$pid}&amp;ged={$GEDCOM}\" title=\"{$title}\" " . $mouseAction1 . "><b>" . $pgv_lang["compact_chart"] . "</b></a><br />\n";
                }
                if (file_exists("fanchart.php") and defined("IMG_ARC_PIE") and function_exists("imagettftext")) {
                    if ($TEXT_DIRECTION == "ltr") {
                        $title = $pgv_lang["fan_chart"] . ": " . $pid;
                    } else {
                        $title = $pid . " :" . $pgv_lang["fan_chart"];
                    }
                    print "<a href=\"fanchart.php?rootid={$pid}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;ged={$GEDCOM}\" title=\"{$title}\" " . $mouseAction1 . "><b>" . $pgv_lang["fan_chart"] . "</b></a><br />\n";
                }
                if (file_exists("hourglass.php")) {
                    if ($TEXT_DIRECTION == "ltr") {
                        $title = $pgv_lang["hourglass_chart"] . ": " . $pid;
                    } else {
                        $title = $pid . " :" . $pgv_lang["hourglass_chart"];
                    }
                    print "<a href=\"hourglass.php?pid={$pid}&amp;chart_style={$chart_style}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;box_width={$box_width}&amp;ged={$GEDCOM}&amp;show_spouse={$show_spouse}&amp;show_full={$show_full}\" title=\"{$title}\" " . $mouseAction1 . "><b>" . $pgv_lang["hourglass_chart"] . "</b></a><br />\n";
                }
                $ct = preg_match_all("/1\\s*FAMS\\s*@(.*)@/", $indirec, $match, PREG_SET_ORDER);
                for ($i = 0; $i < $ct; $i++) {
                    $famid = $match[$i][1];
                    $famrec = find_family_record($famid);
                    if ($famrec) {
                        $parents = find_parents_in_record($famrec);
                        $spouse = "";
                        if ($pid == $parents["HUSB"]) {
                            $spouse = $parents["WIFE"];
                        }
                        if ($pid == $parents["WIFE"]) {
                            $spouse = $parents["HUSB"];
                        }
                        $num = preg_match_all("/1\\s*CHIL\\s*@(.*)@/", $famrec, $smatch, PREG_SET_ORDER);
                        if (!empty($spouse) || $num > 0) {
                            if ($TEXT_DIRECTION == "ltr") {
                                $title = $pgv_lang["familybook_chart"] . ": " . $famid;
                            } else {
                                $title = $famid . " :" . $pgv_lang["familybook_chart"];
                            }
                            print "<a href=\"family.php?famid={$famid}&amp;ged={$GEDCOM}\" title=\"{$title}\" " . $mouseAction1 . "><b>" . $pgv_lang["fam_spouse"] . "</b></a><br /> \n";
                            if (!empty($spouse)) {
                                if ($TEXT_DIRECTION == "ltr") {
                                    $title = $pgv_lang["indi_info"] . ": " . $spouse;
                                } else {
                                    $title = $spouse . " :" . $pgv_lang["indi_info"];
                                }
                                print "<a href=\"individual.php?pid={$spouse}&amp;ged={$GEDCOM}\" title=\"{$title}\" {$mouseAction1}>";
                                if ($SHOW_LIVING_NAMES >= $PRIV_PUBLIC || displayDetailsByID($spouse) || showLivingNameByID($spouse)) {
                                    print PrintReady(get_person_name($spouse));
                                } else {
                                    print $pgv_lang["private"];
                                }
                                print "</a><br />\n";
                            }
                        }
                        for ($j = 0; $j < $num; $j++) {
                            $cpid = $smatch[$j][1];
                            if ($TEXT_DIRECTION == "ltr") {
                                $title = $pgv_lang["indi_info"] . ": " . $cpid;
                            } else {
                                $title = $cpid . " :" . $pgv_lang["indi_info"];
                            }
                            print "\n\t\t\t\t&nbsp;&nbsp;<a href=\"individual.php?pid={$cpid}&amp;ged={$GEDCOM}\" title=\"{$title}\" {$mouseAction1}>";
                            if ($SHOW_LIVING_NAMES >= $PRIV_PUBLIC || displayDetailsByID($cpid) || showLivingNameByID($cpid)) {
                                print PrintReady(get_person_name($cpid));
                            } else {
                                print $pgv_lang["private"];
                            }
                            print "<br /></a>";
                        }
                    }
                }
                print "</td></tr></table>\n\t\t</div>";
            }
            // NOTE: Start div out-$pid.$personcount.$count
            print "\n\t\t\t<div id=\"out-{$boxID}\"";
            if ($style == 1) {
                print " class=\"person_box{$isF}\" style=\"width: " . $bwidth . "px; height: " . $bheight . "px; padding: 2px; overflow: hidden; z-index:'-1';\"";
            } else {
                print " style=\"padding: 2px;\"";
            }
            // NOTE: Zoom
            if ($ZOOM_BOXES != "disabled" && !$show_full) {
                if ($ZOOM_BOXES == "mouseover") {
                    print $mouseAction2;
                }
                if ($ZOOM_BOXES == "mousedown") {
                    print $mouseAction3;
                }
                if ($ZOOM_BOXES == "click" && $view != "preview") {
                    print $mouseAction4;
                }
            }
            print "><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\">";
            //-- links and zoom icons
            // NOTE: Start div icons-$personcount.$pid.$count
            if ($TEXT_DIRECTION == "rtl") {
                print "<div id=\"icons-{$boxID}\" style=\"float:left; width: 25px; height: 50px;";
            } else {
                print "<div id=\"icons-{$boxID}\" style=\"float:right; width: 25px; height: 50px;";
            }
            if ($show_full) {
                print " display: block;";
            } else {
                print " display: none;";
            }
            print "\">";
            // NOTE: Zoom
            if ($ZOOM_BOXES != "disabled" && $show_full) {
                print "<a href=\"javascript:;\"";
                if ($ZOOM_BOXES == "mouseover") {
                    print $mouseAction2;
                }
                if ($ZOOM_BOXES == "mousedown") {
                    print $mouseAction3;
                }
                if ($ZOOM_BOXES == "click") {
                    print $mouseAction4;
                }
                print "><img id=\"iconz-{$boxID}\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["zoomin"]["other"] . "\" width=\"25\" height=\"25\" border=\"0\" alt=\"" . $pgv_lang["zoom_box"] . "\" title=\"" . $pgv_lang["zoom_box"] . "\" /></a>";
            }
            if ($LINK_ICONS != "disabled") {
                $click_link = "javascript:;";
                $whichChart = "";
                if (preg_match("/pedigree.php/", $SCRIPT_NAME) > 0) {
                    $click_link = "pedigree.php?rootid={$pid}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;talloffset={$talloffset}&amp;ged={$GEDCOM}";
                    $whichChart = "pedigree_chart";
                    $whichID = $pid;
                }
                if (preg_match("/hourglass.php/", $SCRIPT_NAME) > 0) {
                    $click_link = "hourglass.php?pid={$pid}&amp;generations={$generations}&amp;box_width={$box_width}&amp;ged={$GEDCOM}";
                    $whichChart = "hourglass_chart";
                    $whichID = $pid;
                }
                if (preg_match("/ancestry.php/", $SCRIPT_NAME) > 0) {
                    $click_link = "ancestry.php?rootid={$pid}&amp;chart_style={$chart_style}&amp;PEDIGREE_GENERATIONS={$OLD_PGENS}&amp;box_width={$box_width}&amp;ged={$GEDCOM}";
                    $whichChart = "ancestry_chart";
                    $whichID = $pid;
                }
                if (preg_match("/descendancy.php/", $SCRIPT_NAME) > 0) {
                    $click_link = "descendancy.php?pid={$pid}&amp;show_full={$show_full}&amp;generations={$generations}&amp;box_width={$box_width}&amp;ged={$GEDCOM}";
                    $whichChart = "descend_chart";
                    $whichID = $pid;
                }
                if (preg_match("/family.php/", $SCRIPT_NAME) > 0 && !empty($famid)) {
                    $click_link = "family.php?famid={$famid}&amp;ged={$GEDCOM}";
                    $whichChart = "familybook_chart";
                    $whichID = $famid;
                }
                if (preg_match("/individual.php/", $SCRIPT_NAME) > 0) {
                    $click_link = "individual.php?pid={$pid}&amp;ged={$GEDCOM}";
                    $whichChart = "indi_info";
                    $whichID = $pid;
                }
                if (empty($whichChart)) {
                    $title = "";
                } else {
                    if ($TEXT_DIRECTION == "ltr") {
                        $title = $pgv_lang[$whichChart] . ": " . $whichID;
                    } else {
                        $title = $whichID . " :" . $pgv_lang[$whichChart];
                    }
                }
                print "<a href=\"{$click_link}\" title=\"{$title}\"";
                // NOTE: Zoom
                if ($LINK_ICONS == "mouseover") {
                    print "onmouseover=\"show_family_box('" . $boxID . "', '";
                }
                if ($LINK_ICONS == "click") {
                    print "onclick=\"toggle_family_box('" . $boxID . "', '";
                }
                if ($style == 1) {
                    print "box{$pid}";
                } else {
                    print "relatives";
                }
                print "');";
                print " return false;\" ";
                // NOTE: Zoom
                print "onmouseout=\"family_box_timeout('" . $boxID . "');";
                print " return false;\"";
                if ($click_link == "#" && $LINK_ICONS != "click") {
                    print "onclick=\"return false;\"";
                }
                print "><img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["pedigree"]["small"] . "\" width=\"25\" border=\"0\" vspace=\"0\" hspace=\"0\" alt=\"" . $pgv_lang["person_links"] . "\" title=\"" . $pgv_lang["person_links"] . "\" /></a>";
            }
            // NOTE: Close div icons-$personcount.$pid.$count
            print "</div>\n";
        } else {
            if ($style == 1) {
                print "\n\t\t\t<div id=\"out-{$boxID}\" class=\"person_box{$isF}\" style=\"width: " . $bwidth . "px; height: " . $bheight . "px; padding: 2px; overflow: hidden;\"";
            } else {
                print "\n\t\t\t<div id=\"out-{$boxID}\" class=\"person_box{$isF}\" style=\"padding: 2px; overflow: hidden;\"";
            }
            // NOTE: Zoom
            if ($ZOOM_BOXES != "disabled" && empty($SEARCH_SPIDER)) {
                if ($ZOOM_BOXES == "mouseover") {
                    print $mouseAction2;
                }
                if ($ZOOM_BOXES == "mousedown") {
                    print $mouseAction3;
                }
                if ($ZOOM_BOXES == "click" && $view != "preview") {
                    print $mouseAction4;
                }
            }
            print "><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\">";
        }
    } else {
        if ($style == 1) {
            print "\n\t\t\t<div id=\"out-{$boxID}\" class=\"person_box{$isF}\" style=\"width: " . $bwidth . "px; height: " . $bheight . "px; padding: 2px; overflow: hidden;\"><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\">";
        } else {
            print "\n\t\t\t<div id=\"out-{$boxID}\" class=\"person_box{$isF}\" style=\"padding: 2px; overflow: hidden;\"><table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td valign=\"top\">";
        }
    }
    //-- find the name
    $name = get_person_name($pid);
    if ($MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES && showFact("OBJE", $pid)) {
        $object = find_highlighted_object($pid, $indirec);
        if (!empty($object["thumb"])) {
            $size = findImageSize($object["thumb"]);
            $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 (!empty($object['mid']) && $USE_MEDIA_VIEWER) {
                print "<a href=\"mediaviewer.php?mid=" . $object['mid'] . "\" >";
            } else {
                print "<a href=\"javascript:;\" onclick=\"return openImage('" . rawurlencode($object["file"]) . "',{$imgwidth}, {$imgheight});\">";
            }
            print "<img id=\"box-{$boxID}-thumb\" src=\"" . $object["thumb"] . "\" vspace=\"0\" hspace=\"0\" class=\"{$class}\" alt =\"\" title=\"\" ";
            if (!$show_full) {
                print " style=\"display: none;\"";
            }
            if ($imgsize) {
                print " /></a>\n";
            } else {
                print " />\n";
            }
        }
    }
    //-- find additional name
    $addname = get_add_person_name($pid);
    //-- check if the persion is visible
    if (!$disp) {
        if (showLivingName($indirec)) {
            // NOTE: Start span namedef-$personcount.$pid.$count
            if ($TEXT_DIRECTION == "ltr") {
                $title = $pgv_lang["indi_info"] . ": " . $pid;
            } else {
                $title = $pid . " :" . $pgv_lang["indi_info"];
            }
            print "<a href=\"individual.php?pid={$pid}&amp;ged={$GEDCOM}\" title=\"{$title}\" onmouseover=\"change_class('namedef-{$boxID}','name" . $style . "Hover'); return false;\" onmouseout=\"change_class('namedef-{$boxID}','name{$style}'); return false;\"><span id=\"namedef-{$boxID}\" class=\"name{$style}\">";
            print PrintReady($name);
            // NOTE: IMG ID
            print "<img id=\"box-{$boxID}-sex\" src=\"{$PGV_IMAGE_DIR}/";
            if ($isF == "") {
                print $PGV_IMAGES["sex"]["small"] . "\" title=\"" . $pgv_lang["male"] . "\" alt=\"" . $pgv_lang["male"];
            } else {
                if ($isF == "F") {
                    print $PGV_IMAGES["sexf"]["small"] . "\" title=\"" . $pgv_lang["female"] . "\" alt=\"" . $pgv_lang["female"];
                } else {
                    print $PGV_IMAGES["sexn"]["small"] . "\" title=\"" . $pgv_lang["unknown"] . "\" alt=\"" . $pgv_lang["unknown"];
                }
            }
            print "\" class=\"sex_image\" />";
            if ($SHOW_ID_NUMBERS) {
                print "</span><span class=\"details{$style}\">";
                if ($TEXT_DIRECTION == "ltr") {
                    print "&lrm;({$pid})&lrm;";
                } else {
                    print "&rlm;({$pid})&rlm;";
                }
                // NOTE: Close span namedef-$personcount.$pid.$count
                print "</span>";
            }
            if (strlen($addname) > 0) {
                print "<br />";
                // NOTE: Start span addnamedef-$personcount.$pid.$count
                // NOTE: Close span addnamedef-$personcount.$pid.$count
                //				   if (hasRTLText($addname) && $style=="1") print "<span id=\"addnamedef-$boxID\" class=\"name2\"> ";
                //				   else
                print "<span id=\"addnamedef-{$boxID}\" class=\"name{$style}\"> ";
                print PrintReady($addname) . "</span><br />";
            }
            print "</a>";
        } else {
            if (empty($SEARCH_SPIDER)) {
                $user = getUser($CONTACT_EMAIL);
                print "<a href=\"javascript:;\" onclick=\"if (confirm('" . preg_replace("'<br />'", " ", $pgv_lang["privacy_error"]) . "\\n\\n" . str_replace("#user[fullname]#", $user["firstname"] . " " . $user["lastname"], $pgv_lang["clicking_ok"]) . "')) ";
                if ($CONTACT_METHOD != "none") {
                    if ($CONTACT_METHOD == "mailto") {
                        print "window.location = 'mailto:" . $user["email"] . "'; ";
                    } else {
                        print "message('{$CONTACT_EMAIL}', '{$CONTACT_METHOD}'); ";
                    }
                }
                // NOTE: Start span namedef-$pid.$personcount.$count
                // NOTE: Close span namedef-$pid.$personcount.$count
                print "return false;\">";
            }
            print "<span id=\"namedef-{$boxID}\" class=\"name{$style}\">" . $pgv_lang["private"] . "</span>";
            if (empty($SEARCH_SPIDER)) {
                print "</a>\n";
            }
        }
        if ($show_full && empty($SEARCH_SPIDER)) {
            // NOTE: Start span fontdef-$pid.$personcount.$count
            // NOTE: Close span fontdef-$pid.$personcount.$count
            print "<br /><span id=\"fontdef-{$boxID}\" class=\"details{$style}\">";
            print $pgv_lang["private"];
            print "</span>";
        }
        // NOTE: Close div out-$pid.$personcount.$count
        print "\n\t\t\t</td></tr></table></div>";
        return;
    }
    if ($TEXT_DIRECTION == "ltr") {
        $title = $pgv_lang["indi_info"] . ": " . $pid;
    } else {
        $title = $pid . " :" . $pgv_lang["indi_info"];
    }
    print "<a href=\"individual.php?pid={$pid}&amp;ged={$GEDCOM}\" title=\"{$title}\" onmouseover=\"change_class('namedef-{$boxID}','name" . $style . "Hover'); return false;\" onmouseout=\"change_class('namedef-{$boxID}','name{$style}'); return false;\"";
    if (!$show_full) {
        //not needed or wanted for mouseover //if ($ZOOM_BOXES=="mouseover") print " onmouseover=\"event.cancelBubble = true;\"";
        if ($ZOOM_BOXES == "mousedown") {
            print "onmousedown=\"event.cancelBubble = true;\"";
        }
        if ($ZOOM_BOXES == "click") {
            print "onclick=\"event.cancelBubble = true;\"";
        }
    }
    // NOTE: Start span namedef-$pid.$personcount.$count
    print "><span id=\"namedef-{$boxID}\" class=\"name{$style}";
    // add optional CSS style for each fact
    $cssfacts = array("BIRT", "CHR", "DEAT", "BURI", "CREM", "ADOP", "BAPM", "BARM", "BASM", "BLES", "CHRA", "CONF", "FCOM", "ORDN", "NATU", "EMIG", "IMMI", "CENS", "PROB", "WILL", "GRAD", "RETI", "CAST", "DSCR", "EDUC", "IDNO", "NATI", "NCHI", "NMR", "OCCU", "PROP", "RELI", "RESI", "SSN", "TITL", "BAPL", "CONL", "ENDL", "SLGC", "_MILI");
    foreach ($cssfacts as $indexval => $fact) {
        $ct = preg_match_all("/1 {$fact}/", $indirec, $nmatch, PREG_SET_ORDER);
        if ($ct > 0) {
            print " {$fact}";
        }
    }
    print "\">";
    print PrintReady($name);
    // NOTE: Close span namedef-$pid.$personcount.$count
    print "</span>";
    print "<span class=\"name{$style}\">";
    // NOTE: IMG ID
    print "<img id=\"box-{$boxID}-sex\" src=\"{$PGV_IMAGE_DIR}/";
    if ($isF == "") {
        print $PGV_IMAGES["sex"]["small"] . "\" title=\"" . $pgv_lang["male"] . "\" alt=\"" . $pgv_lang["male"];
    } else {
        if ($isF == "F") {
            print $PGV_IMAGES["sexf"]["small"] . "\" title=\"" . $pgv_lang["female"] . "\" alt=\"" . $pgv_lang["female"];
        } else {
            print $PGV_IMAGES["sexn"]["small"] . "\" title=\"" . $pgv_lang["unknown"] . "\" alt=\"" . $pgv_lang["unknown"];
        }
    }
    print "\" class=\"sex_image\" />";
    print "</span>\r\n";
    if ($SHOW_ID_NUMBERS) {
        if ($TEXT_DIRECTION == "ltr") {
            print "<span class=\"details{$style}\">&lrm;({$pid})&lrm; </span>";
        } else {
            print "<span class=\"details{$style}\">&rlm;({$pid})&rlm; </span>";
        }
    }
    if ($SHOW_LDS_AT_GLANCE) {
        print "<span class=\"details{$style}\">" . get_lds_glance($indirec) . "</span>";
    }
    if (strlen($addname) > 0) {
        print "<br />";
        //		   if (hasRTLText($addname) && $style=="1")
        //				print "<span id=\"addnamedef-$pid.$count\" class=\"name2\"> ";
        //		   else
        print "<span id=\"addnamedef-{$pid}.{$count}\" class=\"name{$style}\"> ";
        print PrintReady($addname) . "</span><br />";
    }
    print "</a>";
    if (empty($SEARCH_SPIDER)) {
        // NOTE: Start div inout-$pid.$personcount.$count
        //if (!$show_full) print "\n<div id=\"inout-$boxID\" style=\"display: none;\">\n";
        // NOTE: Start div fontdev-$pid.$personcount.$count
        print "<div id=\"fontdef-{$boxID}\" class=\"details{$style}\">";
        // NOTE: Start div inout2-$pid.$personcount.$count
        //	 if ($show_full) print "\n<div id=\"inout2-$boxID\" style=\"display: block;\">\n";
        if ($show_full) {
            print "\n<div id=\"inout2-{$boxID}\" ";
            print " style=\"display: block;\">\n";
            $birttag = "BIRT";
            $bpos1 = strpos($indirec, "1 BIRT");
            if ($bpos1) {
                if (showFact($birttag, $pid)) {
                    print_simple_fact($indirec, $birttag, $pid);
                }
            } else {
                $bpos1 = strpos($indirec, "1 CHR");
                if ($bpos1) {
                    $birttag = "CHR";
                    if (showFact($birttag, $pid)) {
                        print_simple_fact($indirec, $birttag, $pid);
                    }
                } else {
                    $bpos1 = strpos($indirec, "1 BAPM");
                    if ($bpos1) {
                        $birttag = "BAPM";
                        if (showFact($birttag, $pid)) {
                            print_simple_fact($indirec, $birttag, $pid);
                        }
                    }
                }
            }
            //-- section to display optional tags in the boxes
            if (!empty($CHART_BOX_TAGS)) {
                $opt_tags = preg_split("/[, ]+/", $CHART_BOX_TAGS);
                foreach ($opt_tags as $indexval => $tag) {
                    if (!empty($tag) && $tag != "BURI" && $tag != "CREM") {
                        if (showFact($tag, $pid)) {
                            print_simple_fact($indirec, $tag, $pid);
                        }
                    }
                }
            }
            $bpos1 = strpos($indirec, "1 DEAT");
            if ($bpos1) {
                if (showFact("DEAT", $pid)) {
                    print_simple_fact($indirec, "DEAT", $pid);
                }
            }
            foreach (array("BURI", "CREM") as $indexval => $tag) {
                if (strpos($CHART_BOX_TAGS, $tag) !== false && showFact($tag, $pid)) {
                    print_simple_fact($indirec, $tag, $pid);
                }
            }
            print "</div>\n";
        }
        // NOTE: Close div inout2-$pid.$personcount.$count
        //if ($show_full) print "</div>\n";
        print "</div>\n";
    }
    // SEARCH_SPIDER
    //	 -- find all level 1 sub records
    //	  $skipfacts = array("SEX","FAMS","FAMC","NAME","TITL","NOTE","SOUR","SSN","OBJE","HUSB","WIFE","CHIL","ALIA","ADDR","PHON","SUBM","_EMAIL","CHAN","URL","EMAIL","WWW","RESI","_UID","_TODO");
    //	  $subfacts = get_all_subrecords($indirec, implode(",", $skipfacts));
    //	   NOTE: Open div inout-$pid.$personcount.$count
    //   --All code to load information has been moved to expand_view.php
    if (empty($SEARCH_SPIDER)) {
        print "\n<div id=\"inout-{$boxID}\" style=\"display: none;\">\n";
        print "<div id=\"LOADING-inout-{$boxID}\">";
        print $pgv_lang['loading'];
        print "</div></div>";
    }
    // SEARCH_SPIDER
    // NOTE: Close div out-rand()
    print "\n\t\t\t</td></tr></table></div>";
}
示例#6
0
 /**
  * initialize the controller
  */
 function init()
 {
     global $pgv_lang, $CONTACT_EMAIL, $GEDCOM, $pgv_changes;
     $this->nid = safe_GET_xref('nid');
     $noterec = find_other_record($this->nid);
     if (isset($pgv_changes[$this->nid . "_" . $GEDCOM])) {
         $noterec = "0 @" . $this->nid . "@ NOTE\n";
     } else {
         if (!$noterec) {
             return false;
         }
     }
     $this->note = new Note($noterec);
     $this->note->ged_id = PGV_GED_ID;
     // This record is from a file
     if (!$this->note->canDisplayDetails()) {
         print_header($pgv_lang["private"] . " " . $pgv_lang["shared_note_info"]);
         print_privacy_error($CONTACT_EMAIL);
         print_footer();
         exit;
     }
     $this->uname = PGV_USER_NAME;
     //-- perform the desired action
     switch ($this->action) {
         case "addfav":
             $this->addFavorite();
             break;
         case "accept":
             $this->acceptChanges();
             break;
         case "undo":
             $this->note->undoChange();
             break;
     }
     //-- check for the user
     //-- if the user can edit and there are changes then get the new changes
     if ($this->show_changes && PGV_USER_CAN_EDIT && isset($pgv_changes[$this->nid . "_" . $GEDCOM])) {
         $newrec = find_updated_record($this->nid);
         $this->diffnote = new Note($newrec);
         $this->diffnote->setChanged(true);
         $noterec = $newrec;
     }
     if ($this->note->canDisplayDetails()) {
         $this->canedit = PGV_USER_CAN_EDIT;
     }
     if ($this->show_changes && $this->canedit) {
         $this->note->diffMerge($this->diffnote);
     }
 }
示例#7
0
    /**
     * print parents informations
     * @param Family family
     * @param Array people
     * @param String family type
     * @return html table rows
     */
    function printParentsRows(&$family, &$people, $type)
    {
        global $personcount, $pgv_changes, $pgv_lang, $factarray;
        global $PGV_IMAGE_DIR, $PGV_IMAGES;
        global $lang_short_cut, $LANGUAGE;
        $elderdate = "";
        //-- new father/husband
        $styleadd = "";
        if (isset($people["newhusb"])) {
            $styleadd = "red";
            ?>
			<tr>
				<td class="facts_labelblue"><?php 
            print $people["newhusb"]->getLabel();
            ?>
</td>
				<td class="<?php 
            print $this->getPersonStyle($people["newhusb"]);
            ?>
">
					<?php 
            print_pedigree_person($people["newhusb"]->getXref(), 2, !$this->isPrintPreview(), 0, $personcount++);
            ?>
				</td>
			</tr>
			<?php 
            $elderdate = $people["newhusb"]->getBirthDate();
        }
        //-- father/husband
        if (isset($people["husb"])) {
            ?>
			<tr>
				<td class="facts_label<?php 
            print $styleadd;
            ?>
"><?php 
            print $people["husb"]->getLabel();
            ?>
</td>
				<td class="<?php 
            print $this->getPersonStyle($people["husb"]);
            ?>
">
					<?php 
            print_pedigree_person($people["husb"]->getXref(), 2, !$this->isPrintPreview(), 0, $personcount++);
            ?>
				</td>
			</tr>
			<?php 
            $elderdate = $people["husb"]->getBirthDate();
        }
        //-- missing father
        if ($type == "parents" && !isset($people["husb"]) && !isset($people["newhusb"])) {
            if (!$this->isPrintPreview() && PGV_USER_CAN_EDIT && $this->indi->canDisplayDetails()) {
                ?>
				<tr>
					<td class="facts_label"><?php 
                print $pgv_lang["add_father"];
                ?>
</td>
					<td class="facts_value"><?php 
                print_help_link("edit_add_parent_help", "qm");
                ?>
 <a href="javascript <?php 
                print $pgv_lang["add_father"];
                ?>
" onclick="return addnewparentfamily('<?php 
                print $this->pid;
                ?>
', 'HUSB', '<?php 
                print $family->getXref();
                ?>
');"><?php 
                print $pgv_lang["add_father"];
                ?>
</a></td>
				</tr>
				<?php 
            }
        }
        //-- missing husband
        if ($type == "spouse" && $this->indi->equals($people["wife"]) && !isset($people["husb"]) && !isset($people["newhusb"])) {
            if (!$this->isPrintPreview() && PGV_USER_CAN_EDIT && $this->indi->canDisplayDetails()) {
                ?>
				<tr>
					<td class="facts_label"><?php 
                print $pgv_lang["add_husb"];
                ?>
</td>
					<td class="facts_value"><a href="javascript:;" onclick="return addnewspouse('<?php 
                print $family->getXref();
                ?>
', 'HUSB');"><?php 
                print $pgv_lang["add_husb_to_family"];
                ?>
</a></td>
				</tr>
				<?php 
            }
        }
        //-- new mother/wife
        $styleadd = "";
        if (isset($people["newwife"])) {
            $styleadd = "red";
            ?>
			<tr>
				<td class="facts_labelblue"><?php 
            print $people["newwife"]->getLabel($elderdate);
            ?>
</td>
				<td class="<?php 
            print $this->getPersonStyle($people["newwife"]);
            ?>
">
					<?php 
            print_pedigree_person($people["newwife"]->getXref(), 2, !$this->isPrintPreview(), 0, $personcount++);
            ?>
				</td>
			</tr>
			<?php 
        }
        //-- mother/wife
        if (isset($people["wife"])) {
            ?>
			<tr>
				<td class="facts_label<?php 
            print $styleadd;
            ?>
"><?php 
            print $people["wife"]->getLabel($elderdate);
            ?>
</td>
				<td class="<?php 
            print $this->getPersonStyle($people["wife"]);
            ?>
">
					<?php 
            print_pedigree_person($people["wife"]->getXref(), 2, !$this->isPrintPreview(), 0, $personcount++);
            ?>
				</td>
			</tr>
			<?php 
        }
        //-- missing mother
        if ($type == "parents" && !isset($people["wife"]) && !isset($people["newwife"])) {
            if (!$this->isPrintPreview() && PGV_USER_CAN_EDIT && $this->indi->canDisplayDetails()) {
                ?>
				<tr>
					<td class="facts_label"><?php 
                print $pgv_lang["add_mother"];
                ?>
</td>
					<td class="facts_value"><?php 
                print_help_link("edit_add_parent_help", "qm");
                ?>
 <a href="javascript:;" onclick="return addnewparentfamily('<?php 
                print $this->pid;
                ?>
', 'WIFE', '<?php 
                print $family->getXref();
                ?>
');"><?php 
                print $pgv_lang["add_mother"];
                ?>
</a></td>
				</tr>
				<?php 
            }
        }
        //-- missing wife
        if ($type == "spouse" && $this->indi->equals($people["husb"]) && !isset($people["wife"]) && !isset($people["newwife"])) {
            if (!$this->isPrintPreview() && PGV_USER_CAN_EDIT && $this->indi->canDisplayDetails()) {
                ?>
				<tr>
					<td class="facts_label"><?php 
                print $pgv_lang["add_wife"];
                ?>
</td>
					<td class="facts_value"><a href="javascript:;" onclick="return addnewspouse('<?php 
                print $family->getXref();
                ?>
', 'WIFE');"><?php 
                print $pgv_lang["add_wife_to_family"];
                ?>
</a></td>
				</tr>
				<?php 
            }
        }
        //-- marriage row
        if ($family->getMarriageRecord() != "" || PGV_USER_CAN_EDIT) {
            $styleadd = "";
            $date = $family->getMarriageDate();
            $place = $family->getMarriagePlace();
            $famid = $family->getXref();
            if (!$date && $this->show_changes && isset($pgv_changes[$famid . "_" . $GEDCOM])) {
                $famrec = find_updated_record($famid);
                $marrrec = get_sub_record(1, "1 MARR", $famrec);
                if ($marrrec != $family->getMarriageRecord()) {
                    $date = new GedcomDate(get_gedcom_value("MARR:DATE", 1, $marrrec, '', false));
                    $place = get_gedcom_value("MARR:PLAC", 1, $marrrec, '', false);
                    $styleadd = "blue";
                }
            }
            ?>
			<tr>
				<td class="facts_label"><br />
				</td>
				<td class="facts_value<?php 
            print $styleadd;
            ?>
">
					<?php 
            //echo "<span class=\"details_label\">".$factarray["NCHI"].": </span>".$family->getNumberOfChildren()."<br />";
            ?>
					<?php 
            if ($date && $date->isOK() || $place) {
                $marr_type = "MARR_" . strtoupper($family->getMarriageType());
                if (isset($factarray[$marr_type])) {
                    echo "<span class=\"details_label\">" . $factarray[$marr_type] . ": </span>";
                } else {
                    echo "<span class=\"details_label\">" . $factarray["MARR"] . ": </span>" . $family->getMarriageType();
                }
                if ($date) {
                    echo $date->Display(false);
                    if (!empty($place)) {
                        echo ' -- ';
                    }
                }
                if (!empty($place)) {
                    echo $place;
                }
            } else {
                if (get_sub_record(1, "1 _NMR", find_family_record($famid))) {
                    // Allow special processing for different languages
                    $func = "fact_NMR_localisation_{$lang_short_cut[$LANGUAGE]}";
                    if (function_exists($func)) {
                        // Localise the _NMR facts
                        $func("_NMR", $famid);
                    }
                    echo $factarray["_NMR"];
                } else {
                    if (get_sub_record(1, "1 _NMAR", find_family_record($famid))) {
                        // Allow special processing for different languages
                        $func = "fact_NMR_localisation_{$lang_short_cut[$LANGUAGE]}";
                        if (function_exists($func)) {
                            // Localise the _NMR facts
                            $func("_NMAR", $famid);
                        }
                        echo $factarray["_NMAR"];
                    } else {
                        if ($family->getMarriageRecord() == "" && PGV_USER_CAN_EDIT) {
                            print "<a href=\"#\" onclick=\"return add_new_record('" . $famid . "', 'MARR');\">" . $pgv_lang['add_marriage'] . "</a>";
                        } else {
                            $factdetail = explode(' ', trim($family->getMarriageRecord()));
                            if ($family->getMarriageType()) {
                                $marr_type = "MARR_" . strtoupper($family->getMarriageType());
                            } else {
                                $marr_type = "MARR";
                            }
                            if (isset($factarray[$marr_type])) {
                                if (isset($factdetail)) {
                                    if (count($factdetail) == 3) {
                                        if (strtoupper($factdetail[2]) == "Y") {
                                            echo "<span class=\"details_label\">" . $factarray[$marr_type] . ": </span>" . $pgv_lang["yes"];
                                        } else {
                                            if (strtoupper($factdetail[2]) == "N") {
                                                echo "<span class=\"details_label\">" . $factarray[$marr_type] . ": </span>" . $pgv_lang["no"];
                                            }
                                        }
                                    }
                                }
                            } else {
                                echo "<span class=\"details_label\">" . $factarray["MARR"] . ": </span>" . $family->getMarriageType();
                            }
                        }
                    }
                }
            }
            ?>
				</td>
			</tr>
			<?php 
        }
    }
示例#8
0
         if (!displayDetailsById($xref1)) {
             //-- do not have full access to this record, so privatize it
             $gedrec = privatize_gedcom($gedrec);
         }
         addDebugLog($action . " xref={$xref} SUCCESS\n" . trim($gedrec));
         print "SUCCESS\n" . trim($gedrec);
     } else {
         addDebugLog($action . " ERROR 3: No gedcom id specified.  Please specify a xref.");
         print "ERROR 3: No gedcom id specified.  Please specify a xref.\n";
     }
     exit;
 case 'getprev':
     $xref = safe_REQUEST($_REQUEST, 'xref', PGV_REGEX_XREF);
     if ($xref) {
         $xref1 = get_prev_xref($xref, $GED_ID);
         $gedrec = find_updated_record($xref1, $GED_ID);
         if (!$gedrec) {
             $gedrec = find_gedcom_record($xref1, $GED_ID);
         }
         if (!displayDetailsById($xref1)) {
             //-- do not have full access to this record, so privatize it
             $gedrec = privatize_gedcom($gedrec);
         }
         addDebugLog($action . " xref={$xref} SUCCESS\n" . trim($gedrec));
         print "SUCCESS\n" . trim($gedrec);
     } else {
         addDebugLog($action . " ERROR 3: No gedcom id specified.  Please specify a xref.");
         print "ERROR 3: No gedcom id specified.  Please specify a xref.\n";
     }
     exit;
 case 'search':
示例#9
0
 function addLink()
 {
     global $pgv_lang, $GEDCOM;
     switch ($this->form_location) {
         case 'remote':
             $serverID = $this->addRemoteServer($this->form_txtTitle, $this->form_txtURL, $this->form_txtGID, $this->form_txtUsername, $this->form_txtPassword);
             break;
         case 'local':
             $serverID = $this->addLocalServer($this->form_txtCB_Title, $this->form_txtCB_GID);
             break;
         case 'existing':
             $serverID = $this->form_cbExistingServers;
             break;
         case "FamilySearch":
             //TODO: Make sure that it is merging correctly
             $serverID = $this->addFamilySearchServer($this->form_txtFS_URL, $this->form_txtFS_URL, $this->form_txtFS_GID, $this->form_txtFS_Username, $this->form_txtFS_Password);
             break;
     }
     $link_pid = $this->form_txtPID;
     $relation_type = $this->form_cbRelationship;
     if ($serverID && $link_pid) {
         if (isset($pgv_changes[$this->pid . "_" . $GEDCOM])) {
             $indirec = find_updated_record($this->pid);
         } else {
             $indirec = find_person_record($this->pid);
         }
         switch ($relation_type) {
             case "father":
                 $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
                 $stub_id = append_gedrec($indistub, false);
                 $indistub = find_updated_record($stub_id);
                 $gedcom_fam = "0 @new@ FAM\n1 HUSB @{$stub_id}@\n1 CHIL @{$this->pid}@";
                 $fam_id = append_gedrec($gedcom_fam);
                 $indirec .= "\n1 FAMC @{$fam_id}@";
                 replace_gedrec($this->pid, $indirec);
                 $serviceClient = ServiceClient::getInstance($serverID);
                 $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
                 $indistub .= "\n1 FAMS @{$fam_id}@";
                 replace_gedrec($stub_id, $indistub, false);
                 break;
             case "mother":
                 $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
                 $stub_id = append_gedrec($indistub, false);
                 $indistub = find_updated_record($stub_id);
                 $gedcom_fam = "0 @new@ FAM\n1 WIFE @{$stub_id}@\n1 CHIL @{$this->pid}@";
                 $fam_id = append_gedrec($gedcom_fam);
                 $indirec .= "\n1 FAMC @{$fam_id}@";
                 replace_gedrec($this->pid, $indirec);
                 $serviceClient = ServiceClient::getInstance($serverID);
                 $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
                 $indistub .= "\n1 FAMS @" . $fam_id . "@";
                 replace_gedrec($stub_id, $indistub, false);
                 break;
             case "husband":
                 $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
                 $stub_id = append_gedrec($indistub, false);
                 $indistub = find_updated_record($stub_id);
                 $gedcom_fam = "0 @new@ FAM\n1 MARR Y\n1 WIFE @{$this->pid}@\n1 HUSB @{$stub_id}@\n";
                 $fam_id = append_gedrec($gedcom_fam);
                 $indirec .= "\n1 FAMS @{$fam_id}@";
                 replace_gedrec($this->pid, $indirec);
                 $serviceClient = ServiceClient::getInstance($serverID);
                 $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
                 $indistub .= "\n1 FAMS @{$fam_id}@";
                 replace_gedrec($stub_id, $indistub, false);
                 break;
             case "wife":
                 $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
                 $stub_id = append_gedrec($indistub, false);
                 $indistub = find_updated_record($stub_id);
                 $gedcom_fam = "0 @new@ FAM\n1 MARR Y\n1 WIFE @{$stub_id}@\n1 HUSB @{$this->pid}@";
                 $fam_id = append_gedrec($gedcom_fam);
                 $indirec .= "\n1 FAMS @{$fam_id}@";
                 replace_gedrec($this->pid, $indirec);
                 $serviceClient = ServiceClient::getInstance($serverID);
                 $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
                 $indistub .= "\n1 FAMS @{$fam_id}@\n";
                 replace_gedrec($stub_id, $indistub, false);
                 break;
             case "son":
             case "daughter":
                 $indistub = "0 @new@ INDI\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}\n1 RFN {$serverID}:{$link_pid}";
                 $stub_id = append_gedrec($indistub, false);
                 $indistub = find_updated_record($stub_id);
                 if (get_gedcom_value('SEX', 1, $indirec, '', false) == 'F') {
                     $gedcom_fam = "0 @new@ FAM\n1 WIFE @{$this->pid}@\n1 CHIL @{$stub_id}@";
                 } else {
                     $gedcom_fam = "0 @new@ FAM\n1 HUSB @{$this->pid}@\n1 CHIL @{$stub_id}@";
                 }
                 $fam_id = append_gedrec($gedcom_fam);
                 $indirec .= "\n1 FAMS @{$fam_id}@";
                 replace_gedrec($this->pid, $indirec);
                 $serviceClient = ServiceClient::getInstance($serverID);
                 $indistub = $serviceClient->mergeGedcomRecord($link_pid, $indistub, true, true);
                 $indistub .= "\n1 FAMC @" . $fam_id . "@";
                 replace_gedrec($stub_id, $indistub, false);
                 break;
             case 'current_person':
                 $indirec .= "\n1 RFN {$serverID}:{$link_pid}\n1 SOUR @{$serverID}@\n2 PAGE {$link_pid}";
                 $serviceClient = ServiceClient::getInstance($serverID);
                 if (!is_null($serviceClient)) {
                     //-- get rid of change date
                     $pos1 = strpos($indirec, "\n1 CHAN");
                     if ($pos1 !== false) {
                         $pos2 = strpos($indirec, "\n1", $pos1 + 5);
                         $indirec = substr($indirec, 0, $pos1) . substr($indirec, $pos2);
                     }
                     $indirec = $serviceClient->mergeGedcomRecord($link_pid, $indirec, true, true);
                 } else {
                     echo 'Unable to find server';
                 }
                 break;
         }
         echo '<b>', $pgv_lang['link_success'], '</b>';
         return true;
     }
     return false;
 }
示例#10
0
 /**
  *  Preforms a search and replace
  */
 function SearchAndReplace()
 {
     global $GEDCOM, $pgv_changes, $manual_save, $STANDARD_NAME_FACTS, $ADVANCED_NAME_FACTS;
     $this->sgeds = array($GEDCOM);
     $this->srindi = "yes";
     $this->srfams = "yes";
     $this->srsour = "yes";
     $this->srnote = "yes";
     $oldquery = $this->query;
     $this->GeneralSearch();
     //-- don't try to make any changes if nothing was found
     if (!$this->myindilist && !$this->myfamlist && !$this->mysourcelist && !$this->mynotelist) {
         return;
     }
     AddToLog("Search And Replace old:" . $oldquery . " new:" . $this->replace);
     $manual_save = true;
     // Include edit functions.
     include_once "includes/functions/functions_edit.php";
     // These contain the search query and the replace string
     // $this->replace;
     // $this->query;
     // These contain the search results
     // We need to iterate through them and do the replaces
     //$this->myindilist;
     $adv_name_tags = preg_split("/[\\s,;: ]+/", $ADVANCED_NAME_FACTS);
     $name_tags = array_unique(array_merge($STANDARD_NAME_FACTS, $adv_name_tags));
     $name_tags[] = "_MARNM";
     foreach ($this->myindilist as $id => $individual) {
         if (isset($pgv_changes[$individual->getXref() . '_' . $GEDCOM])) {
             $indirec = find_updated_record($individual->getXref());
         } else {
             $indirec = $individual->getGedcomRecord();
         }
         $oldRecord = $indirec;
         $newRecord = $indirec;
         if ($this->replaceAll) {
             $newRecord = preg_replace("~" . $oldquery . "~i", $this->replace, $newRecord);
         } else {
             if ($this->replaceNames) {
                 foreach ($name_tags as $f => $tag) {
                     $newRecord = preg_replace("~(\\d) " . $tag . " (.*)" . $oldquery . "(.*)~i", "\$1 " . $tag . " \$2" . $this->replace . "\$3", $newRecord);
                 }
             }
             if ($this->replacePlaces) {
                 if ($this->replacePlacesWord) {
                     $newRecord = preg_replace("~(\\d) PLAC (.*)([,\\W\\s])" . $oldquery . "([,\\W\\s])~i", "\$1 PLAC \$2\$3" . $this->replace . "\$4", $newRecord);
                 } else {
                     $newRecord = preg_replace("~(\\d) PLAC (.*)" . $oldquery . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $newRecord);
                 }
             }
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($newRecord != $oldRecord) {
             replace_gedrec($individual->getXref(), $newRecord);
         } else {
             unset($this->myindilist[$id]);
         }
     }
     foreach ($this->myfamlist as $id => $family) {
         if (isset($pgv_changes[$family->getXref() . '_' . $GEDCOM])) {
             $indirec = find_updated_record($family->getXref());
         } else {
             $indirec = $family->getGedcomRecord();
         }
         $oldRecord = $indirec;
         $newRecord = $indirec;
         if ($this->replaceAll) {
             $newRecord = preg_replace("~" . $oldquery . "~i", $this->replace, $newRecord);
         } else {
             if ($this->replacePlaces) {
                 if ($this->replacePlacesWord) {
                     $newRecord = preg_replace("~(\\d) PLAC (.*)([,\\W\\s])" . $oldquery . "([,\\W\\s])~i", "\$1 PLAC \$2\$3" . $this->replace . "\$4", $newRecord);
                 } else {
                     $newRecord = preg_replace("~(\\d) PLAC (.*)" . $oldquery . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $newRecord);
                 }
             }
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($newRecord != $oldRecord) {
             replace_gedrec($family->getXref(), $newRecord);
         } else {
             unset($this->myfamlist[$id]);
         }
     }
     foreach ($this->mysourcelist as $id => $source) {
         if (isset($pgv_changes[$source->getXref() . '_' . $GEDCOM])) {
             $indirec = find_updated_record($source->getXref());
         } else {
             $indirec = $source->getGedcomRecord();
         }
         $oldRecord = $indirec;
         $newRecord = $indirec;
         if ($this->replaceAll) {
             $newRecord = preg_replace("~" . $oldquery . "~i", $this->replace, $newRecord);
         } else {
             if ($this->replaceNames) {
                 $newRecord = preg_replace("~(\\d) TITL (.*)" . $oldquery . "(.*)~i", "\$1 TITL \$2" . $this->replace . "\$3", $newRecord);
                 $newRecord = preg_replace("~(\\d) ABBR (.*)" . $oldquery . "(.*)~i", "\$1 ABBR \$2" . $this->replace . "\$3", $newRecord);
             }
             if ($this->replacePlaces) {
                 if ($this->replacePlacesWord) {
                     $newRecord = preg_replace("~(\\d) PLAC (.*)([,\\W\\s])" . $oldquery . "([,\\W\\s])~i", "\$1 PLAC \$2\$3" . $this->replace . "\$4", $newRecord);
                 } else {
                     $newRecord = preg_replace("~(\\d) PLAC (.*)" . $oldquery . "(.*)~i", "\$1 PLAC \$2" . $this->replace . "\$3", $newRecord);
                 }
             }
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($newRecord != $oldRecord) {
             replace_gedrec($source->getXref(), $newRecord);
         } else {
             unset($this->mysourcelist[$id]);
         }
     }
     foreach ($this->mynotelist as $id => $note) {
         if (isset($pgv_changes[$note->getXref() . '_' . $GEDCOM])) {
             $indirec = find_updated_record($note->getXref());
         } else {
             $indirec = $note->getGedcomRecord();
         }
         $oldRecord = $indirec;
         $newRecord = $indirec;
         if ($this->replaceAll) {
             $newRecord = preg_replace("~" . $oldquery . "~i", $this->replace, $newRecord);
         }
         //-- if the record changed replace the record otherwise remove it from the search results
         if ($newRecord != $oldRecord) {
             replace_gedrec($note->getXref(), $newRecord);
         } else {
             unset($this->mynotelist[$id]);
         }
     }
     write_changes();
 }
示例#11
0
        echo $i;
        ?>
" style="display: none;">
<table class="<?php 
        echo $TEXT_DIRECTION;
        ?>
 width80">
<?php 
        $famreqdfacts = preg_split("/[,; ]/", $QUICK_REQUIRED_FAMFACTS);
        $parents = find_parents($cfams[$j - 1]);
        $famid = $cfams[$j - 1];
        $family = Family::getInstance($famid);
        if (!isset($pgv_changes[$famid . "_" . $GEDCOM])) {
            $famrec = find_family_record($famid);
        } else {
            $famrec = find_updated_record($famid);
        }
        if ($family) {
            $subrecords = $family->getFacts(array("HUSB", "WIFE", "CHIL"));
        } else {
            $subrecords = array();
        }
        $famfacts = array();
        foreach ($subrecords as $ind => $eventObj) {
            $fact = $eventObj->getTag();
            $event = $eventObj->getDetail();
            if ($fact == "EVEN" || $fact == "FACT") {
                $fact = $eventObj->getValue("TYPE");
            }
            if (in_array($fact, $famaddfacts)) {
                $newreqd = array();
 /**
  * get a singleton instance of this client
  * @return ServiceClient
  */
 static function &getInstance($id)
 {
     global $PGV_SERVERS, $SERVER_URL, $GEDCOM;
     if (isset($PGV_SERVERS[$id])) {
         return $PGV_SERVERS[$id];
     }
     $gedrec = find_gedcom_record($id);
     if (empty($gedrec)) {
         $gedrec = find_updated_record($id);
     }
     if (!empty($gedrec)) {
         $url = get_gedcom_value("URL", 1, $gedrec);
         $gedfile = get_gedcom_value("_DBID", 1, $gedrec);
         if (empty($url) && empty($gedfile)) {
             return null;
         }
         if (!empty($url) && strtolower($url) != strtolower($SERVER_URL)) {
             $server = new ServiceClient($gedrec);
         } else {
             include_once 'includes/classes/class_localclient.php';
             $server = new LocalClient($gedrec);
         }
         $PGV_SERVERS[$id] = $server;
         return $server;
     }
     return null;
 }
示例#13
0
         }
     }
 }
 if ($finalResult) {
     $_SESSION["upload_folder"] = $folder;
     // store standard media folder in session
     // Insert the 1 FILE xxx record into the arrays used by function handle_updates()
     $glevels = array_merge(array("1"), $glevels);
     $tag = array_merge(array("FILE"), $tag);
     $islink = array_merge(array(0), $islink);
     $text = array_merge(array($folder . $filename), $text);
     if (!empty($pid)) {
         if (!isset($pgv_changes[$pid . "_" . PGV_GEDCOM])) {
             $gedrec = find_gedcom_record($pid, PGV_GED_ID);
         } else {
             $gedrec = find_updated_record($pid, PGV_GED_ID);
         }
     }
     $newrec = "0 @{$pid}@ OBJE\n";
     $newrec = handle_updates($newrec);
     if (!$update_CHAN) {
         $newrec .= get_sub_record(1, "1 CHAN", $gedrec);
     }
     //print("[".$newrec."]");
     //-- look for the old record media in the file
     //-- if the old media record does not exist that means it was
     //-- generated at import and we need to append it
     if (replace_gedrec($pid, $newrec, $update_CHAN)) {
         AddToChangeLog("Media ID " . $pid . " successfully updated.");
     }
     if ($pid && $linktoid != "") {
示例#14
0
 if (!in_array($child->getXref(), $newchildren)) {
     //-- remove the CHIL link from the family record
     $pos1 = strpos($gedrec, "1 CHIL @" . $child->getXref() . "@");
     if ($pos1 !== false) {
         $pos2 = strpos($gedrec, "\n1", $pos1 + 5);
         if ($pos2 === false) {
             $pos2 = strlen($gedrec);
         } else {
             $pos2++;
         }
         $gedrec = substr($gedrec, 0, $pos1) . substr($gedrec, $pos2);
         $updated = true;
     }
     //-- remove the FAMC link from the child record
     if (isset($pgv_changes[$child->getXref() . "_" . PGV_GEDCOM])) {
         $indirec = find_updated_record($child->getXref(), PGV_GED_ID);
     } else {
         $indirec = find_person_record($child->getXref(), PGV_GED_ID);
     }
     $pos1 = strpos($indirec, "1 FAMC @{$famid}@");
     if ($pos1 !== false) {
         $pos2 = strpos($indirec, "\n1", $pos1 + 5);
         if ($pos2 === false) {
             $pos2 = strlen($indirec);
         } else {
             $pos2++;
         }
         $indirec = substr($indirec, 0, $pos1) . substr($indirec, $pos2);
         replace_gedrec($child->getXref(), $indirec, $update_CHAN);
     }
 }
示例#15
0
/**
 * print the children table for a family
 *
 * @param string $famid family gedcom ID
 * @param string $childid optional child ID
 * @param int $sosa optional child sosa number
 * @param string $label optional indi label (descendancy booklet)
 */
function print_family_children($famid, $childid = "", $sosa = 0, $label = "", $personcount = "1")
{
    global $pgv_lang, $factarray, $pbwidth, $pbheight, $view, $show_famlink, $show_cousins;
    global $PGV_IMAGE_DIR, $PGV_IMAGES, $show_changes, $pgv_changes, $GEDCOM, $SHOW_ID_NUMBERS, $TEXT_DIRECTION;
    $family = Family::getInstance($famid);
    $children = $family->getChildrenIds();
    print "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\"><tr>";
    if ($sosa > 0) {
        print "<td></td>";
    }
    print "<td><span class=\"subheaders\">" . $pgv_lang["children"] . "</span></td>";
    if ($sosa > 0) {
        print "<td></td><td></td>";
    }
    print "</tr>\n";
    $newchildren = array();
    $oldchildren = array();
    if (PGV_USER_CAN_EDIT) {
        if (isset($_REQUEST['show_changes']) && $_REQUEST['show_changes'] == 'yes' && isset($pgv_changes[$famid . "_" . $GEDCOM])) {
            $newrec = find_updated_record($famid);
            $ct = preg_match_all("/1 CHIL @(.*)@/", $newrec, $match, PREG_SET_ORDER);
            if ($ct > 0) {
                $oldchil = array();
                for ($i = 0; $i < $ct; $i++) {
                    if (!in_array($match[$i][1], $children)) {
                        $newchildren[] = $match[$i][1];
                    } else {
                        $oldchil[] = $match[$i][1];
                    }
                }
                foreach ($children as $indexval => $chil) {
                    if (!in_array($chil, $oldchil)) {
                        $oldchildren[] = $chil;
                    }
                }
                //-- if there are no old or new children then the children were reordered
                if (count($newchildren) == 0 && count($oldchildren) == 0) {
                    $children = array();
                    for ($i = 0; $i < $ct; $i++) {
                        $children[] = $match[$i][1];
                    }
                }
            }
        }
    }
    $nchi = 1;
    if (count($children) > 0 || count($newchildren) > 0 || count($oldchildren) > 0) {
        foreach ($children as $indexval => $chil) {
            if (!in_array($chil, $oldchildren)) {
                print "<tr>\n";
                if ($sosa != 0) {
                    if ($chil == $childid) {
                        print_sosa_number($sosa, $childid);
                    } else {
                        if (empty($label)) {
                            print_sosa_number("");
                        } else {
                            print_sosa_number($label . $nchi++ . ".");
                        }
                    }
                }
                print "<td valign=\"middle\" >";
                print_pedigree_person($chil, 1, $show_famlink, 8, $personcount);
                $personcount++;
                print "</td>";
                if ($sosa != 0) {
                    // loop for all families where current child is a spouse
                    $famids = find_sfamily_ids($chil);
                    $maxfam = count($famids) - 1;
                    for ($f = 0; $f <= $maxfam; $f++) {
                        $famid = $famids[$f];
                        if (!$famid) {
                            continue;
                        }
                        $parents = find_parents($famid);
                        if (!$parents) {
                            continue;
                        }
                        if ($parents["HUSB"] == $chil) {
                            $spouse = $parents["WIFE"];
                        } else {
                            $spouse = $parents["HUSB"];
                        }
                        // multiple marriages
                        if ($f > 0) {
                            print "</tr>\n<tr><td>&nbsp;</td>";
                            print "<td valign=\"top\"";
                            if ($TEXT_DIRECTION == "rtl") {
                                print " align=\"left\">";
                            } else {
                                print " align=\"right\">";
                            }
                            //if ($f==$maxfam) print "<img height=\"50%\"";
                            //else print "<img height=\"100%\"";
                            if ($f == $maxfam) {
                                print "<img height=\"" . ($pbheight / 2 - 3) . "px\"";
                            } else {
                                print "<img height=\"" . $pbheight . "px\"";
                            }
                            print " width=\"3\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["vline"]["other"] . "\" alt=\"\" />";
                            print "</td>";
                        }
                        print "<td class=\"details1\" valign=\"middle\" align=\"center\">";
                        $divrec = "";
                        if (showFact("MARR", $famid)) {
                            // marriage date
                            $famrec = find_family_record($famid);
                            $ct = preg_match("/2 DATE.*(\\d\\d\\d\\d)/", get_sub_record(1, "1 MARR", $famrec), $match);
                            if ($ct > 0) {
                                print "<span class=\"date\">" . trim($match[1]) . "</span>";
                            }
                            // divorce date
                            $divrec = get_sub_record(1, "1 DIV", $famrec);
                            $ct = preg_match("/2 DATE.*(\\d\\d\\d\\d)/", $divrec, $match);
                            if ($ct > 0) {
                                print "-<span class=\"date\">" . trim($match[1]) . "</span>";
                            }
                        }
                        print "<br /><img width=\"100%\" height=\"3\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" alt=\"\" />";
                        // family link
                        if ($famid) {
                            print "<br />";
                            print "<a class=\"details1\" href=\"family.php?famid={$famid}\">";
                            if ($SHOW_ID_NUMBERS) {
                                print getLRM() . "&nbsp;({$famid})&nbsp;" . getLRM();
                            }
                            print "</a>";
                        }
                        print "</td>\n";
                        // spouse information
                        print "<td style=\"vertical-align: center;";
                        if (!empty($divrec) and $view != "preview") {
                            print " filter:alpha(opacity=40);-moz-opacity:0.4\">";
                        } else {
                            print "\">";
                        }
                        print_pedigree_person($spouse, 1, $show_famlink, 9, $personcount);
                        $personcount++;
                        print "</td>\n";
                        // cousins
                        if ($show_cousins) {
                            print_cousins($famid, $personcount);
                            $personcount++;
                        }
                    }
                }
                print "</tr>\n";
            }
        }
        foreach ($newchildren as $indexval => $chil) {
            print "<tr >";
            print "<td valign=\"top\" class=\"facts_valueblue\" style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\">\n";
            print_pedigree_person($chil, 1, $show_famlink, 0, $personcount);
            $personcount++;
            print "</td></tr>\n";
        }
        foreach ($oldchildren as $indexval => $chil) {
            print "<tr >";
            print "<td valign=\"top\" class=\"facts_valuered\" style=\"width: " . $pbwidth . "px; height: " . $pbheight . "px;\">\n";
            print_pedigree_person($chil, 1, $show_famlink, 0, $personcount);
            $personcount++;
            print "</td></tr>\n";
        }
        // message 'no children' except for sosa
    } else {
        if ($sosa < 1) {
            print "<tr><td></td><td valign=\"top\" >";
            $nchi = "";
            if (isset($pgv_changes[$famid . "_" . $GEDCOM])) {
                $famrec = find_updated_record($famid);
            } else {
                $famrec = find_family_record($famid);
            }
            $ct = preg_match("/1 NCHI (\\w+)/", $famrec, $match);
            if ($ct > 0) {
                $nchi = $match[1];
            } else {
                $famrec = find_family_record($famid);
                $ct = preg_match("/1 NCHI (\\w+)/", $famrec, $match);
                if ($ct > 0) {
                    $nchi = $match[1];
                }
            }
            if ($nchi == "0") {
                print "<img src=\"images/small/childless.gif\" alt=\"" . $pgv_lang["childless_family"] . "\" title=\"" . $pgv_lang["childless_family"] . "\" /> " . $pgv_lang["childless_family"];
            } else {
                print $pgv_lang["no_children"];
            }
            print "</td></tr>";
        } else {
            print "<tr>\n";
            print_sosa_number($sosa, $childid);
            print "<td valign=\"top\">";
            print_pedigree_person($childid, 1, $show_famlink, 0, $personcount);
            $personcount++;
            print "</td></tr>\n";
        }
    }
    print "</table><br />";
    if ($view != "preview" && $sosa == 0 && PGV_USER_CAN_EDIT) {
        print_help_link("add_child_help", "qm", "add_child_to_family");
        print "<a href=\"javascript:;\" onclick=\"return addnewchild('{$famid}','');\">" . $pgv_lang["add_child_to_family"] . "</a>";
        print "<span style='white-space:nowrap;'>";
        print " <a href=\"javascript:;\" onclick=\"return addnewchild('{$famid}','M');\">[" . Person::sexImage('M', 'small', $pgv_lang['son']) . "]</a>";
        print " <a href=\"javascript:;\" onclick=\"return addnewchild('{$famid}','F');\">[" . Person::sexImage('F', 'small', $pgv_lang['daughter']) . "]</a>";
        print "</span>";
    }
}
示例#16
0
 /**
  * return a list of facts
  * @return array
  */
 function getFacts($includeFileName = true)
 {
     global $pgv_changes, $GEDCOM, $pgv_lang;
     $ignore = array("TITL", "FILE");
     if ($this->show_changes) {
         $ignore = array();
     } else {
         if (PGV_USER_GEDCOM_ADMIN) {
             $ignore = array("TITL");
         }
     }
     $facts = $this->mediaobject->getFacts($ignore);
     sort_facts($facts);
     //		if ($includeFileName) $facts[] = new Event("1 FILE ".$this->mediaobject->getFilename());
     $mediaType = $this->mediaobject->getMediatype();
     if (isset($pgv_lang["TYPE__" . $mediaType])) {
         $facts[] = new Event("1 TYPE " . $pgv_lang["TYPE__" . $mediaType]);
     } else {
         $facts[] = new Event("1 TYPE " . $pgv_lang["TYPE__other"]);
     }
     if (isset($pgv_changes[$this->pid . "_" . $GEDCOM]) && $this->show_changes) {
         $newrec = find_updated_record($this->pid);
         $newmedia = new Media($newrec);
         $newfacts = $newmedia->getFacts($ignore);
         if ($includeFileName) {
             $newfacts[] = new Event("1 TYPE " . $pgv_lang["TYPE__" . $mediaType]);
         }
         $newfacts[] = new Event("1 FORM " . $newmedia->getFiletype());
         $mediaType = $newmedia->getMediatype();
         if (isset($pgv_lang["TYPE__" . $mediaType])) {
             $newfacts[] = new Event("1 TYPE " . $mediaType);
         } else {
             $newfacts[] = new Event("1 TYPE " . $pgv_lang["TYPE__other"]);
         }
         //-- loop through new facts and add them to the list if they are any changes
         //-- compare new and old facts of the Personal Fact and Details tab 1
         for ($i = 0; $i < count($facts); $i++) {
             $found = false;
             foreach ($newfacts as $indexval => $newfact) {
                 if (trim($newfact->gedcomRecord) == trim($facts[$i]->gedcomRecord)) {
                     $found = true;
                     break;
                 }
             }
             if (!$found) {
                 $facts[$i]->gedcomRecord .= "\nPGV_OLD\n";
             }
         }
         foreach ($newfacts as $indexval => $newfact) {
             $found = false;
             foreach ($facts as $indexval => $fact) {
                 if (trim($fact->gedcomRecord) == trim($newfact->gedcomRecord)) {
                     $found = true;
                     break;
                 }
             }
             if (!$found) {
                 $newfact->gedcomRecord .= "\nPGV_NEW\n";
                 $facts[] = $newfact;
             }
         }
     }
     if ($this->mediaobject->fileExists()) {
         // get height and width of image, when available
         if ($this->mediaobject->getWidth()) {
             $facts[] = new Event("1 EVEN " . '<span dir="ltr">' . $this->mediaobject->getWidth() . " x " . $this->mediaobject->getHeight() . '</span>' . "\n2 TYPE image_size");
         }
         //Prints the file size
         //Rounds the size of the image to 2 decimal places
         $facts[] = new Event("1 EVEN " . '<span dir="ltr">' . round($this->mediaobject->getFilesizeraw() / 1024, 2) . " kb" . '</span>' . "\n2 TYPE file_size");
     }
     sort_facts($facts);
     return $facts;
 }
示例#17
0
/**
 * get the next available xref
 * calculates the next available XREF id for the given type of record
 * @param string $type	the type of record, defaults to 'INDI'
 * @return string
 */
function get_new_xref($type = 'INDI', $use_cache = false)
{
    global $fcontents, $SOURCE_ID_PREFIX, $REPO_ID_PREFIX, $pgv_changes, $GEDCOM, $TBLPREFIX, $GEDCOMS;
    global $MEDIA_ID_PREFIX, $FAM_ID_PREFIX, $GEDCOM_ID_PREFIX, $FILE, $MAX_IDS;
    global $gBitDb;
    //-- during online updates $FILE comes through as an array for some odd reason
    if (!empty($FILE) && !is_array($FILE)) {
        $gedid = $GEDCOMS[$FILE]["id"];
    } else {
        $gedid = $GEDCOMS[$GEDCOM]["id"];
    }
    $num = null;
    //-- check if an id is stored in MAX_IDS used mainly during the import
    //-- the number stored in the max_id is the next number to use... no need to increment it
    if ($use_cache && !empty($MAX_IDS) && isset($MAX_IDS[$type])) {
        $num = 1;
        $num = $MAX_IDS[$type];
        $MAX_IDS[$type] = $num + 1;
    } else {
        //-- check for the id in the nextid table
        $num = $gBitDb->getOne("SELECT ni_id FROM {$TBLPREFIX}nextid WHERE ni_type=? AND ni_gedfile=?", array($type, $gedid));
        //-- the id was not found in the table so try and find it in the file
        if (is_null($num) && !empty($fcontents)) {
            $ct = preg_match_all("/0 @(.*)@ {$type}/", $fcontents, $match, PREG_SET_ORDER);
            $num = 0;
            for ($i = 0; $i < $ct; $i++) {
                $ckey = $match[$i][1];
                $bt = preg_match("/(\\d+)/", $ckey, $bmatch);
                if ($bt > 0) {
                    $bnum = trim($bmatch[1]);
                    if ($num < $bnum) {
                        $num = $bnum;
                    }
                }
            }
            $num++;
        }
        //-- type wasn't found in database or in file so make a new one
        if (is_null($num)) {
            $num = 1;
            $gBitDb->query("INSERT INTO {$TBLPREFIX}nextid VALUES(?, ?, ?)", array($num + 1, $type, $gedid));
        }
    }
    switch ($type) {
        case "INDI":
            $prefix = $GEDCOM_ID_PREFIX;
            break;
        case "FAM":
            $prefix = $FAM_ID_PREFIX;
            break;
        case "OBJE":
            $prefix = $MEDIA_ID_PREFIX;
            break;
        case "SOUR":
            $prefix = $SOURCE_ID_PREFIX;
            break;
        case "REPO":
            $prefix = $REPO_ID_PREFIX;
            break;
        default:
            $prefix = $type[0];
            break;
    }
    //-- make sure this number has not already been used
    if ($num >= 2147483647 || $num <= 0) {
        // Popular databases are only 32 bits (signed)
        $num = 1;
    }
    while (find_gedcom_record($prefix . $num) || find_updated_record($prefix . $num)) {
        ++$num;
        if ($num >= 2147483647 || $num <= 0) {
            // Popular databases are only 32 bits (signed)
            $num = 1;
        }
    }
    //-- the key is the prefix and the number
    $key = $prefix . $num;
    //-- during the import we won't update the database at this time so return now
    if ($use_cache && isset($MAX_IDS[$type])) {
        return $key;
    }
    //-- update the next id number in the DB table
    $gBitDb->query("UPDATE {$TBLPREFIX}nextid SET ni_id=? WHERE ni_type=? AND ni_gedfile=?", array($num + 1, $type, $gedid));
    return $key;
}
示例#18
0
     echo "</table>\n";
     echo "<input type=\"submit\" value=\"", $pgv_lang["merge_records"], "\">\n";
     echo "</form>\n";
 } elseif ($action == "merge") {
     $manual_save = true;
     echo "<h2>", $pgv_lang["merge_step3"], "</h2>\n";
     if ($GEDCOM == $ged2) {
         $success = delete_gedrec($gid2);
         if ($success) {
             echo "<br />", $pgv_lang["gedrec_deleted"], "<br />\n";
         }
         //-- replace all the records that linked to gid2
         $ids = fetch_all_links($gid2, PGV_GED_ID);
         foreach ($ids as $id) {
             if (isset($pgv_changes[$id . "_" . PGV_GEDCOM])) {
                 $record = find_updated_record($id, PGV_GED_ID);
             } else {
                 $record = fetch_gedcom_record($id, PGV_GED_ID);
                 $record = $record['gedrec'];
                 echo $pgv_lang["updating_linked"], " {$id}<br />\n";
                 $newrec = str_replace("@{$gid2}@", "@{$gid1}@", $record);
                 $newrec = preg_replace('/(\\n1.*@.+@.*(?:(?:\\n[2-9].*)*))((?:\\n1.*(?:\\n[2-9].*)*)*\\1)/', '$2', $newrec);
                 replace_gedrec($id, $newrec);
             }
         }
         // Merge hit counters
         $hits = PGV_DB::prepare("SELECT page_name, SUM(page_count)" . " FROM {$TBLPREFIX}hit_counter" . " WHERE gedcom_id=? AND page_parameter IN (?, ?)" . " GROUP BY page_name")->execute(array(PGV_GED_ID, $gid1, $gid2))->fetchAssoc();
         foreach ($hits as $page_name => $page_count) {
             PGV_DB::prepare("UPDATE {$TBLPREFIX}hit_counter SET page_count=?" . " WHERE gedcom_id=? AND page_name=? AND page_parameter=?")->execute(array($page_count, PGV_GED_ID, $page_name, $gid1));
         }
         PGV_DB::prepare("DELETE FROM {$TBLPREFIX}hit_counter" . " WHERE gedcom_id=? AND page_parameter=?")->execute(array(PGV_GED_ID, $gid2));
示例#19
0
/**
* Delete a person and update all records that link to that person
* @param string $pid the id of the person to delete
* @param string $gedrec the gedcom record of the person to delete
* @return boolean true or false based on the successful completion of the deletion
*/
function delete_family($pid, $gedrec = '')
{
    // NOTE: $pgv_changes isn't a global.  Making it global appears to cause problems.
    global $GEDCOM, $pgv_lang;
    if (empty($gedrec)) {
        $gedrec = find_family_record($pid);
    }
    if (!empty($gedrec)) {
        $success = true;
        $ct = preg_match_all("/1 (\\w+) @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
        for ($i = 0; $i < $ct; $i++) {
            $type = $match[$i][1];
            $id = $match[$i][2];
            if (PGV_DEBUG) {
                echo $type . " " . $id . " ";
            }
            if (!isset($pgv_changes[$id . "_" . $GEDCOM])) {
                $indirec = find_gedcom_record($id);
            } else {
                $indirec = find_updated_record($id);
            }
            if (!empty($indirec)) {
                $lines = explode("\n", $indirec);
                $newindirec = "";
                $lastlevel = -1;
                foreach ($lines as $indexval => $line) {
                    $lct = preg_match("/^(\\d+)/", $line, $levelmatch);
                    if ($lct > 0) {
                        $level = $levelmatch[1];
                    } else {
                        $level = 1;
                    }
                    //-- make sure we don't add any sublevel records
                    if ($level <= $lastlevel) {
                        $lastlevel = -1;
                    }
                    if (preg_match("/@{$pid}@/", $line) == 0 && $lastlevel == -1) {
                        $newindirec .= $line . "\n";
                    } else {
                        $lastlevel = $level;
                    }
                }
                $success = $success && replace_gedrec($id, $newindirec);
            }
        }
        if ($success) {
            $success = $success && delete_gedrec($pid);
        }
        return $success;
    }
    return false;
}
示例#20
0
     print "<input type=\"submit\" value=\"" . $pgv_lang["merge_records"] . "\">\n";
     print "</form>\n";
 } else {
     if ($action == "merge") {
         $manual_save = true;
         print "<h2>" . $pgv_lang["merge_step3"] . "</h2>\n";
         if ($GEDCOM == $ged2) {
             $success = delete_gedrec($gid2);
             if ($success) {
                 print "<br />" . $pgv_lang["gedrec_deleted"] . "<br />\n";
             }
             //-- replace all the records that linked to gid2
             $ids = fetch_all_links($gid2, PGV_GED_ID);
             foreach ($ids as $id) {
                 if (isset($pgv_changes[$id . "_" . $GEDCOM])) {
                     $record = find_updated_record($id);
                 } else {
                     $record = fetch_gedcom_record($id, PGV_GED_ID);
                     $record = $record['gedrec'];
                     echo $pgv_lang["updating_linked"] . " {$id}<br />\n";
                     $newrec = str_replace("@{$gid2}@", "@{$gid1}@", $record);
                     replace_gedrec($id, $newrec);
                 }
             }
         }
         $newgedrec = "0 @{$gid1}@ {$type1}\n";
         for ($i = 0; $i < count($facts1) || $i < count($facts2); $i++) {
             if (isset($facts1[$i])) {
                 if (in_array($i, $keep1)) {
                     $newgedrec .= $facts1[$i]["subrec"] . "\n";
                     print $pgv_lang["adding"] . " " . $facts1[$i]["fact"] . " " . $pgv_lang["from"] . " {$gid1}<br />\n";
示例#21
0
         if (!displayDetailsById($xref1)) {
             //-- do not have full access to this record, so privatize it
             $gedrec = privatize_gedcom($gedrec);
         }
         addDebugLog($action . " xref={$xref} SUCCESS\n" . trim($gedrec));
         print "SUCCESS\n" . trim($gedrec);
     } else {
         addDebugLog($action . " ERROR 3: No gedcom id specified.  Please specify a xref.");
         print "ERROR 3: No gedcom id specified.  Please specify a xref.\n";
     }
     exit;
 case 'getprev':
     $xref = safe_REQUEST($_REQUEST, 'xref', PGV_REGEX_XREF);
     if ($xref) {
         $xref1 = get_prev_xref($xref, $GED_ID);
         $gedrec = find_updated_record($xref1);
         if (!$gedrec) {
             $gedrec = find_gedcom_record($xref1);
         }
         if (!displayDetailsById($xref1)) {
             //-- do not have full access to this record, so privatize it
             $gedrec = privatize_gedcom($gedrec);
         }
         addDebugLog($action . " xref={$xref} SUCCESS\n" . trim($gedrec));
         print "SUCCESS\n" . trim($gedrec);
     } else {
         addDebugLog($action . " ERROR 3: No gedcom id specified.  Please specify a xref.");
         print "ERROR 3: No gedcom id specified.  Please specify a xref.\n";
     }
     exit;
 case 'search':
示例#22
0
 /**
  * get updated Family
  * If there is an updated family record in the gedcom file
  * return a new family object for it
  */
 function &getUpdatedFamily()
 {
     global $GEDCOM, $pgv_changes;
     if ($this->getChanged()) {
         return $this;
     }
     if (PGV_USER_CAN_EDIT && $this->canDisplayDetails()) {
         if (isset($pgv_changes[$this->xref . "_" . $GEDCOM])) {
             $newrec = find_updated_record($this->xref);
             if (!empty($newrec)) {
                 $newfamily = new Family($newrec);
                 $newfamily->setChanged(true);
                 return $newfamily;
             }
         }
     }
     return null;
 }
示例#23
0
/**
 * 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 />&nbsp;&nbsp;<a href="', $person->getLinkUrl(), '" class="name1">&lt; ', $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 />&nbsp;&nbsp;<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&amp;image_name={$image_name}&amp;height={$fanh}&amp;width={$fanw}\" width=\"{$fanw}\" height=\"{$fanh}\" border=\"0\" alt=\"{$image_title}\" title=\"{$image_title}\" usemap=\"#fanmap\" />";
    echo "</p>";
    ImageDestroy($image);
}
示例#24
0
        echo $i;
        ?>
" style="display: none;">
<table class="<?php 
        echo $TEXT_DIRECTION;
        ?>
 width80">
<?php 
        $famreqdfacts = preg_split("/[,; ]/", $QUICK_REQUIRED_FAMFACTS);
        $parents = find_parents($cfams[$j - 1]);
        $famid = $cfams[$j - 1];
        $family = Family::getInstance($famid);
        if (!isset($pgv_changes[$famid . "_" . PGV_GEDCOM])) {
            $famrec = find_family_record($famid, PGV_GED_ID);
        } else {
            $famrec = find_updated_record($famid, PGV_GED_ID);
        }
        if ($family) {
            $subrecords = $family->getFacts(array("HUSB", "WIFE", "CHIL"));
        } else {
            $subrecords = array();
        }
        $famfacts = array();
        foreach ($subrecords as $ind => $eventObj) {
            $fact = $eventObj->getTag();
            $event = $eventObj->getDetail();
            if ($fact == "EVEN" || $fact == "FACT") {
                $fact = $eventObj->getValue("TYPE");
            }
            if (in_array($fact, $famaddfacts)) {
                $newreqd = array();
示例#25
0
         }
     }
 }
 if ($finalResult) {
     $_SESSION["upload_folder"] = $folder;
     // store standard media folder in session
     // Insert the 1 FILE xxx record into the arrays used by function handle_updates()
     $glevels = array_merge(array("1"), $glevels);
     $tag = array_merge(array("FILE"), $tag);
     $islink = array_merge(array(0), $islink);
     $text = array_merge(array($folder . $filename), $text);
     if (!empty($pid)) {
         if (!isset($pgv_changes[$pid . "_" . $GEDCOM])) {
             $gedrec = find_gedcom_record($pid);
         } else {
             $gedrec = find_updated_record($pid);
         }
     }
     $newrec = "0 @{$pid}@ OBJE\n";
     $newrec = handle_updates($newrec);
     if (!$update_CHAN) {
         $newrec .= get_sub_record(1, "1 CHAN", $gedrec);
     }
     //print("[".$newrec."]");
     //-- look for the old record media in the file
     //-- if the old media record does not exist that means it was
     //-- generated at import and we need to append it
     if (replace_gedrec($pid, $newrec, $update_CHAN)) {
         AddToChangeLog("Media ID " . $pid . " successfully updated.");
     }
     if ($pid && $linktoid != "") {
示例#26
0
 static function &getInstance($data, $simple = true)
 {
     global $gedcom_record_cache, $GEDCOM, $pgv_changes;
     if (is_array($data)) {
         $ged_id = $data['ged_id'];
         $pid = $data['xref'];
     } else {
         $ged_id = get_id_from_gedcom($GEDCOM);
         $pid = $data;
     }
     // Check the cache first
     if (isset($gedcom_record_cache[$pid][$ged_id])) {
         return $gedcom_record_cache[$pid][$ged_id];
     }
     // Look for the record in the database
     if (!is_array($data)) {
         $data = fetch_gedcom_record($pid, $ged_id);
         // If we didn't find the record in the database, it may be remote
         if (!$data && strpos($pid, ':')) {
             list($servid, $remoteid) = explode(':', $pid);
             $service = ServiceClient::getInstance($servid);
             if ($service) {
                 // TYPE will be replaced with the type from the remote record
                 $data = $service->mergeGedcomRecord($remoteid, "0 @{$pid}@ TYPE\n1 RFN {$pid}", false);
             }
         }
         // If we didn't find the record in the database, it may be new/pending
         if (!$data && PGV_USER_CAN_EDIT && isset($pgv_changes[$pid . '_' . $GEDCOM])) {
             $data = find_updated_record($pid);
             $fromfile = true;
         }
         // If we still didn't find it, it doesn't exist
         if (!$data) {
             return null;
         }
     }
     // Create the object
     if (is_array($data)) {
         $type = $data['type'];
     } elseif (preg_match('/^0 @' . PGV_REGEX_XREF . '@ (' . PGV_REGEX_TAG . ')/', $data, $match)) {
         $type = $match[1];
     } else {
         $type = '';
     }
     switch ($type) {
         case 'INDI':
             $object = new Person($data, $simple);
             break;
         case 'FAM':
             $object = new Family($data, $simple);
             break;
         case 'SOUR':
             $object = new Source($data, $simple);
             break;
             //BH ==================
         //BH ==================
         case 'NOTE':
             $object = new Note($data, $simple);
             break;
         case 'REPO':
             $object = new Repository($data, $simple);
             break;
         case 'OBJE':
             $object = new Media($data, $simple);
             break;
         default:
             $object = new GedcomRecord($data, $simple);
             break;
     }
     // This is an object from the database, but we created it from raw gedcom
     // rather than a database row.  Set the gedcom to indicate that it is not
     // a dynamically created record.
     $object->ged_id = $ged_id;
     if (!empty($fromfile)) {
         $object->setChanged(true);
     }
     // Store it in the cache
     $gedcom_record_cache[$object->xref][$object->ged_id] =& $object;
     //-- also store it using its reference id (sid:pid and local gedcom for remote links)
     $gedcom_record_cache[$pid][$ged_id] =& $object;
     return $object;
 }