Esempio n. 1
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>";
}
Esempio n. 2
0
/**
* @todo add info
* @param array $attrs an array of key value pairs for the attributes
*/
function PGVRHighlightedImageSHandler($attrs)
{
    global $gedrec, $pgvreport, $PGVReportRoot;
    $id = "";
    $gmatch = array();
    $gt = preg_match("/0 @(.+)@/", $gedrec, $gmatch);
    if ($gt > 0) {
        $id = $gmatch[1];
    }
    // mixed Position the top corner of this box on the page. the default is the current position
    $top = '.';
    if (isset($attrs['top'])) {
        if ($attrs['top'] === '0') {
            $top = 0;
        } else {
            if ($attrs['top'] === '.') {
                $top = '.';
            } else {
                if (!empty($attrs['top'])) {
                    $top = (int) $attrs['top'];
                }
            }
        }
    }
    // mixed Position the left corner of this box on the page. the default is the current position
    $left = '.';
    if (isset($attrs['left'])) {
        if ($attrs['left'] === '0') {
            $left = 0;
        } else {
            if ($attrs['left'] === '.') {
                $left = '.';
            } else {
                if (!empty($attrs['left'])) {
                    $left = (int) $attrs['left'];
                }
            }
        }
    }
    // string Align the image in left, center, right
    $align = '';
    if (!empty($attrs["align"])) {
        $align = $attrs["align"];
    }
    // string Next Line should be T:next to the image, N:next line
    $ln = '';
    if (!empty($attrs["ln"])) {
        $ln = $attrs["ln"];
    }
    $width = 0;
    $height = 0;
    if (!empty($attrs["width"])) {
        $width = (int) $attrs["width"];
    }
    if (!empty($attrs["height"])) {
        $height = (int) $attrs["height"];
    }
    if (showFact("OBJE", $id)) {
        $media = find_highlighted_object($id, $gedrec);
        if (!empty($media["file"])) {
            if (preg_match("/(jpg)|(jpeg)|(png)\$/i", $media["file"]) > 0) {
                if (file_exists($media["file"])) {
                    $size = findImageSize($media["file"]);
                    if ($width > 0 && $height == 0) {
                        $perc = $width / $size[0];
                        $height = round($size[1] * $perc);
                    } else {
                        if ($height > 0 && $width == 0) {
                            $perc = $height / $size[1];
                            $width = round($size[0] * $perc);
                        } else {
                            $width = $size[0];
                            $height = $size[1];
                        }
                    }
                    $image = $PGVReportRoot->createImage($media["file"], $left, $top, $width, $height, $align, $ln);
                    $pgvreport->addElement($image);
                }
            }
        }
    }
}
Esempio n. 3
0
function print_td_person($n)
{
    global $treeid, $PGV_IMAGE_DIR, $PGV_IMAGES, $pgv_lang;
    global $TEXT_DIRECTION, $MULTI_MEDIA, $SHOW_HIGHLIGHT_IMAGES, $USE_SILHOUETTE, $PGV_IMAGES;
    global $showids, $showthumbs;
    $text = "";
    $pid = $treeid[$n];
    if ($TEXT_DIRECTION == "ltr") {
        $title = $pgv_lang["indi_info"] . ": " . $pid;
    } else {
        $title = $pid . " :" . $pgv_lang["indi_info"];
    }
    if ($pid) {
        $indi = Person::getInstance($pid);
        $name = $indi->getFullName();
        $addname = $indi->getAddName();
        if ($showthumbs && $MULTI_MEDIA && $SHOW_HIGHLIGHT_IMAGES) {
            if (showFact("OBJE", $pid)) {
                $object = find_highlighted_object($pid, PGV_GED_ID, $indi->gedrec);
                if (!empty($object)) {
                    $whichFile = thumb_or_main($object);
                    // Do we send the main image or a thumbnail?
                    $size = findImageSize($whichFile);
                    $class = "pedigree_image_portrait";
                    if ($size[0] > $size[1]) {
                        $class = "pedigree_image_landscape";
                    }
                    if ($TEXT_DIRECTION == "rtl") {
                        $class .= "_rtl";
                    }
                    // NOTE: IMG ID
                    $imgsize = findImageSize($object["file"]);
                    $imgwidth = $imgsize[0] + 50;
                    $imgheight = $imgsize[1] + 150;
                    if (PGV_USE_LIGHTBOX) {
                        $text .= "<a href=\"" . $object["file"] . "\" rel=\"clearbox[general]\" rev=\"" . $object['mid'] . "::" . PGV_GEDCOM . "::" . PrintReady(htmlspecialchars($name, ENT_QUOTES, 'UTF-8')) . "\">" . "\n";
                    } else {
                        $text .= "<a href=\"javascript:;\" onclick=\"return openImage('" . rawurlencode($object["file"]) . "',{$imgwidth}, {$imgheight});\">";
                    }
                    $birth_date = $indi->getBirthDate();
                    $death_date = $indi->getDeathDate();
                    $text .= "<img id=\"box-{$pid}\" src=\"" . $whichFile . "\"vspace=\"0\" hspace=\"0\" class=\"{$class}\" alt =\"\" title=\"" . PrintReady(htmlspecialchars(strip_tags($name), ENT_QUOTES, 'UTF-8')) . " - " . strip_tags(html_entity_decode($birth_date->Display(false) . " - " . $death_date->Display(false), ENT_QUOTES, 'UTF-8')) . "\"";
                    if ($imgsize) {
                        $text .= " /></a>\n";
                    } else {
                        $text .= " />\n";
                    }
                } else {
                    if ($USE_SILHOUETTE && isset($PGV_IMAGES["default_image_U"]["other"])) {
                        $class = "pedigree_image_portrait";
                        if ($TEXT_DIRECTION == "rtl") {
                            $class .= "_rtl";
                        }
                        $sex = $indi->getSex();
                        $text = "<img src=\"";
                        if ($sex == 'F') {
                            $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_F"]["other"];
                        } else {
                            if ($sex == 'M') {
                                $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_M"]["other"];
                            } else {
                                $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_U"]["other"];
                            }
                        }
                        $text .= "\" class=\"" . $class . "\" border=\"none\" alt=\"\" />";
                    }
                }
            } else {
                if ($USE_SILHOUETTE && isset($PGV_IMAGES["default_image_U"]["other"])) {
                    $class = "pedigree_image_portrait";
                    if ($TEXT_DIRECTION == "rtl") {
                        $class .= "_rtl";
                    }
                    $sex = $indi->getSex();
                    $text = "<img src=\"";
                    if ($sex == 'F') {
                        $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_F"]["other"];
                    } else {
                        if ($sex == 'M') {
                            $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_M"]["other"];
                        } else {
                            $text .= $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["default_image_U"]["other"];
                        }
                    }
                    $text .= "\" class=\"" . $class . "\" border=\"none\" alt=\"\" />";
                }
            }
        }
        $text .= "<a class=\"name1\" href=\"individual.php?pid={$pid}\" title=\"{$title}\"> ";
        $text .= PrintReady(htmlspecialchars(strip_tags($name), ENT_QUOTES, 'UTF-8'));
        if ($addname) {
            $text .= "<br />" . PrintReady($addname);
        }
        $text .= "</a>";
        if ($showids) {
            $text .= " <span class='details1' ";
            if ($TEXT_DIRECTION == "ltr") {
                $text .= "dir=\"ltr\">";
            } else {
                $text .= "dir=\"rtl\">";
            }
            $text .= "(" . $pid . ")</span>";
        }
        $text .= "<br />";
        if ($indi->canDisplayDetails()) {
            $text .= "<span class='details1'>";
            $text .= $indi->getBirthYear() . '-' . $indi->getDeathYear();
            $age = GedcomDate::GetAgeYears($indi->getBirthDate(), $indi->getDeathDate());
            if ($age) {
                $text .= " <span class=\"age\">" . PrintReady("({$age})") . "</span>";
            }
            $text .= "</span>";
        }
    }
    //Removed by BH causing problems with nicknames not printing
    //$text = unhtmlentities($text);
    // -- empty box
    if (empty($text)) {
        $text = "&nbsp;<br />&nbsp;<br />";
    }
    // -- box color
    $isF = "";
    if ($n == 1) {
        if ($indi->getSex() == 'F') {
            $isF = "F";
        }
    } elseif ($n % 2) {
        $isF = "F";
    }
    // -- box size
    if ($n == 1) {
        echo "<td";
    } else {
        echo "<td width='15%'";
    }
    // -- print box content
    echo " class=\"person_box", $isF, "\" style=\"text-align:center; vertical-align:top;\" >";
    echo $text;
    echo "</td>";
}
Esempio n. 4
0
 /**
  * get highlighted media
  * @return array
  */
 function findHighlightedMedia()
 {
     if (is_null($this->highlightedimage)) {
         $this->highlightedimage = find_highlighted_object($this->xref, $this->gedrec);
     }
     return $this->highlightedimage;
 }