Пример #1
0
/**
 * print a simple form of the fact
 *
 * function to print the details of a fact in a simple format
 * @param string $indirec the gedcom record to get the fact from
 * @param string $fact the fact to print
 * @param string $pid the id of the individual to print, required to check privacy
 */
function print_simple_fact($indirec, $fact, $pid)
{
    global $pgv_lang, $SHOW_PEDIGREE_PLACES, $factarray, $ABBREVIATE_CHART_LABELS;
    $emptyfacts = array("BIRT", "CHR", "DEAT", "BURI", "CREM", "ADOP", "BAPM", "BARM", "BASM", "BLES", "CHRA", "CONF", "FCOM", "ORDN", "NATU", "EMIG", "IMMI", "CENS", "PROB", "WILL", "GRAD", "RETI", "BAPL", "CONL", "ENDL", "SLGC", "EVEN", "MARR", "SLGS", "MARL", "ANUL", "CENS", "DIV", "DIVF", "ENGA", "MARB", "MARC", "MARS", "OBJE", "CHAN", "_SEPR", "RESI", "DATA", "MAP");
    $factrec = get_sub_record(1, "1 {$fact}", $indirec);
    if (empty($factrec) || FactViewRestricted($pid, $factrec)) {
        return;
    }
    $label = "";
    if (isset($pgv_lang[$fact])) {
        $label = $pgv_lang[$fact];
    } else {
        if (isset($factarray[$fact])) {
            $label = $factarray[$fact];
        }
    }
    if ($ABBREVIATE_CHART_LABELS) {
        $label = get_first_letter($label);
    }
    // RFE [ 1229233 ] "DEAT" vs "DEAT Y"
    // The check $factrec != "1 DEAT" will not show any records that only have 1 DEAT in them
    if (trim($factrec) != "1 DEAT") {
        print "<span class=\"details_label\">" . $label . "</span> ";
    }
    if (showFactDetails($fact, $pid)) {
        if (!in_array($fact, $emptyfacts)) {
            $ct = preg_match("/1 {$fact}(.*)/", $factrec, $match);
            if ($ct > 0) {
                print PrintReady(trim($match[1]));
            }
        }
        // 1 DEAT Y with no DATE => print YES
        // 1 DEAT N is not allowed
        // It is not proper GEDCOM form to use a N(o) value with an event tag to infer that it did not happen.
        /*-- handled by print_fact_date()
        		 * if (get_sub_record(2, "2 DATE", $factrec)=="") {
        			if (strtoupper(trim(substr($factrec,6,2)))=="Y") print $pgv_lang["yes"];
        		}*/
        print_fact_date($factrec, false, false, $fact, $pid, $indirec);
        print_fact_place($factrec);
    }
    print "<br />\n";
}
Пример #2
0
 function getLabel($abbreviate = false)
 {
     global $factarray, $factAbbrev;
     if (is_null($this->label)) {
         if (array_key_exists($this->tag, $factarray)) {
             $this->label = $factarray[$this->tag];
         } else {
             $this->label = $this->tag;
         }
     }
     // MARR_XXXX
     if ($this->GetType()) {
         $key = $this->tag . "_" . strtoupper($this->type);
         if (array_key_exists($key, $factarray)) {
             $this->label = $factarray[$key];
         }
     }
     if ($abbreviate) {
         if (isset($factAbbrev[$this->tag])) {
             return $factAbbrev[$this->tag];
         } else {
             return get_first_letter($this->label);
         }
     } else {
         return $this->label;
     }
 }
Пример #3
0
/**
 * get gedcom tag value
 *
 * returns the value of a gedcom tag from the given gedcom record
 * @param string $tag	The tag to find, use : to delineate subtags
 * @param int $level	The gedcom line level of the first tag to find, setting level to 0 will cause it to use 1+ the level of the incoming record
 * @param string $gedrec	The gedcom record to get the value from
 * @param int $truncate	Should the value be truncated to a certain number of characters
 * @param boolean $convert	Should data like dates be converted using the configuration settings
 * @return string
 */
function get_gedcom_value($tag, $level, $gedrec, $truncate = '', $convert = true)
{
    global $SHOW_PEDIGREE_PLACES, $pgv_lang;
    if (empty($gedrec)) {
        return "";
    }
    $tags = explode(':', $tag);
    $origlevel = $level;
    if ($level == 0) {
        $level = $gedrec[0] + 1;
    }
    $subrec = $gedrec;
    foreach ($tags as $indexval => $t) {
        $lastsubrec = $subrec;
        $subrec = get_sub_record($level, "{$level} {$t}", $subrec);
        if (empty($subrec) && $origlevel == 0) {
            $level--;
            $subrec = get_sub_record($level, "{$level} {$t}", $lastsubrec);
        }
        if (empty($subrec)) {
            if ($t == "TITL") {
                $subrec = get_sub_record($level, "{$level} ABBR", $lastsubrec);
                if (!empty($subrec)) {
                    $t = "ABBR";
                }
            }
            if (empty($subrec)) {
                if ($level > 0) {
                    $level--;
                }
                $subrec = get_sub_record($level, "@ {$t}", $gedrec);
                if (empty($subrec)) {
                    return;
                }
            }
        }
        $level++;
    }
    $level--;
    $ct = preg_match("/{$level} {$t}(.*)/", $subrec, $match);
    if ($ct == 0) {
        $ct = preg_match("/{$level} @.+@ (.+)/", $subrec, $match);
    }
    if ($ct == 0) {
        $ct = preg_match("/@ {$t} (.+)/", $subrec, $match);
    }
    if ($ct > 0) {
        $value = trim($match[1]);
        $ct = preg_match("/@(.*)@/", $value, $match);
        if ($ct > 0 && $t != "DATE") {
            $oldsub = $subrec;
            switch ($t) {
                case 'HUSB':
                case 'WIFE':
                case 'CHIL':
                    $subrec = find_person_record($match[1]);
                    break;
                case 'FAMC':
                case 'FAMS':
                    $subrec = find_family_record($match[1]);
                    break;
                case 'SOUR':
                    $subrec = find_source_record($match[1]);
                    break;
                case 'REPO':
                    $subrec = find_other_record($match[1]);
                    break;
                default:
                    $subrec = find_gedcom_record($match[1]);
                    break;
            }
            if ($subrec) {
                $value = $match[1];
                $ct = preg_match("/0 @{$match['1']}@ {$t} (.+)/", $subrec, $match);
                if ($ct > 0) {
                    $value = $match[1];
                    $level = 0;
                } else {
                    $subrec = $oldsub;
                }
            } else {
                //-- set the value to the id without the @
                $value = $match[1];
            }
        }
        if ($level != 0 || $t != "NOTE") {
            $value .= get_cont($level + 1, $subrec);
        }
        $value = preg_replace("'\n'", "", $value);
        $value = preg_replace("'<br />'", "\n", $value);
        $value = trim($value);
        //-- if it is a date value then convert the date
        if ($convert && $t == "DATE") {
            $g = new GedcomDate($value);
            $value = $g->Display();
            if (!empty($truncate)) {
                if (UTF8_strlen($value) > $truncate) {
                    $value = preg_replace("/\\(.+\\)/", "", $value);
                    //if (UTF8_strlen($value)>$truncate) {
                    //	$value = preg_replace_callback("/([a-zśź]+)/ui", create_function('$matches', 'return UTF8_substr($matches[1], 0, 3);'), $value);
                    //}
                }
            }
        } else {
            //-- if it is a place value then apply the pedigree place limit
            if ($convert && $t == "PLAC") {
                if ($SHOW_PEDIGREE_PLACES > 0) {
                    $plevels = explode(',', $value);
                    $value = "";
                    for ($plevel = 0; $plevel < $SHOW_PEDIGREE_PLACES; $plevel++) {
                        if (!empty($plevels[$plevel])) {
                            if ($plevel > 0) {
                                $value .= ", ";
                            }
                            $value .= trim($plevels[$plevel]);
                        }
                    }
                }
                if (!empty($truncate)) {
                    if (strlen($value) > $truncate) {
                        $plevels = explode(',', $value);
                        $value = "";
                        for ($plevel = 0; $plevel < count($plevels); $plevel++) {
                            if (!empty($plevels[$plevel])) {
                                if (strlen($plevels[$plevel]) + strlen($value) + 3 < $truncate) {
                                    if ($plevel > 0) {
                                        $value .= ", ";
                                    }
                                    $value .= trim($plevels[$plevel]);
                                } else {
                                    break;
                                }
                            }
                        }
                    }
                }
            } else {
                if ($convert && $t == "SEX") {
                    if ($value == "M") {
                        $value = get_first_letter($pgv_lang["male"]);
                    } elseif ($value == "F") {
                        $value = get_first_letter($pgv_lang["female"]);
                    } else {
                        $value = get_first_letter($pgv_lang["unknown"]);
                    }
                } else {
                    if (!empty($truncate)) {
                        if (strlen($value) > $truncate) {
                            $plevels = explode(' ', $value);
                            $value = "";
                            for ($plevel = 0; $plevel < count($plevels); $plevel++) {
                                if (!empty($plevels[$plevel])) {
                                    if (strlen($plevels[$plevel]) + strlen($value) + 3 < $truncate) {
                                        if ($plevel > 0) {
                                            $value .= " ";
                                        }
                                        $value .= trim($plevels[$plevel]);
                                    } else {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        return $value;
    }
    return "";
}
Пример #4
0
            $my_query->the_post();
            ?>
										<?php 
            $custom_fields = get_post_custom(get_the_ID());
            ?>
										<?php 
            $var++;
            ?>
										<li id="item-<?php 
            echo $var;
            ?>
" class="cat-<?php 
            echo $cat->cat_ID;
            ?>
 letter-<?php 
            echo get_first_letter(get_the_title());
            ?>
">
											<h3><?php 
            the_title();
            ?>
</h3>
											<p><?php 
            echo _e("<!--:it-->Settore<!--:--><!--:es-->Sector<!--:-->");
            ?>
: <?php 
            echo $cat->cat_name;
            ?>
</p>
											<?php 
            the_content();
Пример #5
0
 function fillTL($ar, $int, $top)
 {
     global $maxX, $zindex, $pgv_lang, $factarray, $factAbbrev;
     $zindex = count($ar);
     $rows = array();
     $modFix = 0;
     if ($this->modTest == 1) {
         $modFix = 9 * $this->birthMod;
     }
     //base case
     if (count($ar) == 0) {
         return $top;
     }
     $maxY = $top;
     foreach ($ar as $key => $value) {
         //Creates appropriate color scheme to show relationships
         $this->currentsex = $value->getSex();
         if ($this->currentsex == "M") {
             $this->Mcolorindex++;
             if (!isset($this->malecolorR[$this->Mcolorindex])) {
                 $this->Mcolorindex = 0;
             }
             $this->malecolorR[$this->Mcolorindex];
             $this->Mcolorindex++;
             if (!isset($this->malecolorG[$this->Mcolorindex])) {
                 $this->Mcolorindex = 0;
             }
             $this->malecolorG[$this->Mcolorindex];
             $red = dechex($this->malecolorR[$this->Mcolorindex]);
             $green = dechex($this->malecolorR[$this->Mcolorindex]);
             if (strlen($red) < 2) {
                 $red = "0" . $red;
             }
             if (strlen($green) < 2) {
                 $green = "0" . $green;
             }
             $this->color = "#" . $red . $green . dechex($this->malecolorB);
         } else {
             if ($this->currentsex == "F") {
                 $this->Fcolorindex++;
                 if (!isset($this->femalecolorG[$this->Fcolorindex])) {
                     $this->Fcolorindex = 0;
                 }
                 $this->femalecolorG[$this->Fcolorindex];
                 $this->Fcolorindex++;
                 if (!isset($this->femalecolorB[$this->Fcolorindex])) {
                     $this->Fcolorindex = 0;
                 }
                 $this->femalecolorB[$this->Fcolorindex];
                 $this->color = "#" . dechex($this->femalecolorR) . dechex($this->femalecolorG[$this->Fcolorindex]) . dechex($this->femalecolorB[$this->Fcolorindex]);
             } else {
                 $this->color = $this->colors[$this->colorindex];
             }
         }
         //set start position and size of person-box according to zoomfactor
         /* @var $value Person */
         $bdate = $value->getEstimatedBirthDate();
         $ddate = $value->getEstimatedDeathDate();
         $birthYear = $bdate->gregorianYear();
         $deathYear = $ddate->gregorianYear() ? $ddate->gregorianYear() : date('Y');
         $width = ($deathYear - $birthYear) * $this->zoomfactor;
         $height = 2 * $this->zoomfactor;
         $startPos = ($birthYear - $this->timelineMinYear) * $this->zoomfactor + 14 + $modFix;
         if (stristr($value->getFullName(), "starredname")) {
             $minlength = (UTF8_strlen($value->getFullName()) - 34) * $this->zoomfactor;
         } else {
             $minlength = UTF8_strlen($value->getFullName()) * $this->zoomfactor;
         }
         if ($startPos > 15) {
             $startPos = ($birthYear - $this->timelineMinYear) * $this->zoomfactor + 15 + $modFix;
             $startPos = ($birthYear - $this->timelineMinYear) * $this->zoomfactor + 15;
             $width = ($deathYear - $birthYear) * $this->zoomfactor - 2;
         }
         //set start position to deathyear
         $int = $deathYear;
         //set minimum width for single year lifespans
         if ($width < 10) {
             $width = 10;
             $int = $birthYear + 1;
         }
         $lifespan = "<span dir=\"ltr\">{$birthYear}-</span>";
         $deathReal = $value->getDeathDate()->isOK();
         $birthReal = $value->getBirthDate()->isOK();
         if ($value->isDead() && $deathReal) {
             $lifespan .= "<span dir=\"ltr\">{$deathYear}</span>";
         }
         $lifespannumeral = $deathYear - $birthYear;
         //-- calculate a good Y top value
         $Y = $top;
         $Z = $zindex;
         $ready = false;
         while (!$ready) {
             if (!isset($rows[$Y])) {
                 $ready = true;
                 $rows[$Y]["x1"] = $startPos;
                 $rows[$Y]["x2"] = $startPos + $width;
                 $rows[$Y]["z"] = $zindex;
             } else {
                 if ($rows[$Y]["x1"] > $startPos + $width) {
                     $ready = true;
                     $rows[$Y]["x1"] = $startPos;
                     $Z = $rows[$Y]["z"];
                 } else {
                     if ($rows[$Y]["x2"] < $startPos) {
                         $ready = true;
                         $rows[$Y]["x2"] = $startPos + $width;
                         $Z = $rows[$Y]["z"];
                     } else {
                         //move down 25 pixels
                         if ($this->zoomfactor > 10) {
                             $Y += 25 + $this->zoomfactor;
                         } else {
                             $Y += 25;
                         }
                     }
                 }
             }
         }
         //Need to calculate each event and the spacing between them
         // event1 distance will be event - birthyear   that will be the distance. then each distance will chain off that
         //$event[][]  = {"Cell 1 will hold events"}{"cell2 will hold time between that and the next value"};
         //$value->add_historical_facts();
         $value->add_family_facts(false);
         $unparsedEvents = $value->getIndiFacts();
         sort_facts($unparsedEvents);
         $eventinformation = array();
         $eventspacing = array();
         foreach ($unparsedEvents as $index => $val) {
             $date = $val->getDate();
             if (!empty($date)) {
                 $fact = $val->getTag();
                 $yearsin = $date->date1->y - $birthYear;
                 if ($lifespannumeral == 0) {
                     $lifespannumeral = 1;
                 }
                 $eventwidth = $yearsin / $lifespannumeral * 100;
                 // percent of the lifespan before the event occured used for determining div spacing
                 // figure out some schema
                 $evntwdth = $eventwidth . "%";
                 //-- if the fact is a generic EVENt then get the qualifying TYPE
                 if ($fact == "EVEN") {
                     $fact = $val->getType();
                 }
                 $place = $val->getPlace();
                 $trans = $fact;
                 if (isset($factarray[$fact])) {
                     $trans = $factarray[$fact];
                 } else {
                     if (isset($pgv_lang[$fact])) {
                         $trans = $pgv_lang[$fact];
                     }
                 }
                 if (isset($eventinformation[$evntwdth])) {
                     $eventinformation[$evntwdth] .= "<br />\n" . $trans . "<br />\n" . strip_tags($date->Display(false, '', NULL, false)) . " " . $place;
                 } else {
                     $eventinformation[$evntwdth] = $fact . "-fact," . $trans . "<br />\n" . strip_tags($date->Display(false, '', NULL, false)) . " " . $place;
                 }
             }
         }
         $bdate = $value->getEstimatedBirthDate();
         $ddate = $value->getEstimatedDeathDate();
         if ($width > $minlength + 110) {
             echo "\n<div id=\"bar_" . $value->getXref() . "\" style=\"position: absolute; top:" . $Y . "px; left:" . $startPos . "px; width:" . $width . "px; height:" . $height . "px; background-color:" . $this->color . "; border: solid blue 1px; z-index:{$Z};\">";
             foreach ($eventinformation as $evtwidth => $val) {
                 print "<div style=\"position:absolute; left:" . $evtwidth . ";\"><a class=\"showit\" href=\"#\" style=\"top:-2px; font-size:10px;\"><b>";
                 $text = explode("-fact,", $val);
                 $fact = $text[0];
                 $val = $text[1];
                 if (isset($factAbbrev[$fact])) {
                     print $factAbbrev[$fact];
                 } else {
                     print get_first_letter($val);
                 }
                 print "</b><span>" . PrintReady($val) . "</span></a></div>";
             }
             $indiName = PrintReady(str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $value->getFullName()));
             print "\n\t<table><tr>\n\t\t<td width=\"15\"><a class=\"showit\" href=\"#\"><b>";
             if (isset($factAbbrev["BIRT"])) {
                 print $factAbbrev["BIRT"];
             } else {
                 print get_first_letter($factarray["BIRT"]);
             }
             if (!$birthReal) {
                 print "*";
             }
             print "</b><span>" . $value->getSexImage() . $indiName . "<br/>" . $factarray["BIRT"] . " " . strip_tags($bdate->Display(false)) . " " . PrintReady($value->getBirthPlace()) . "</span></a></td>" . "\n\t\t<td align=\"left\" width=\"100%\"><a href=\"" . encode_url($value->getLinkUrl()) . "\">" . $value->getSexImage() . $indiName . ":  {$lifespan} </a></td>" . "\n\t\t<td width=\"15\">";
             if ($value->isDead()) {
                 if ($deathReal || $value->isDead()) {
                     print "<a class=\"showit\" href=\"#\"><b>";
                     if (isset($factAbbrev["DEAT"])) {
                         print $factAbbrev["DEAT"];
                     } else {
                         print get_first_letter($factarray["DEAT"]);
                     }
                     if (!$deathReal) {
                         print "*";
                     }
                     print "</b><span>" . $value->getSexImage() . $indiName . "<br/>" . $factarray["DEAT"] . " " . strip_tags($ddate->Display(false)) . " " . PrintReady($value->getDeathPlace()) . "</span></a>";
                 }
             }
             print "</td></tr></table>";
             echo '</div>';
         } else {
             if ($width > $minlength + 5) {
                 echo "\n<div style=\"text-align: left; position: absolute; top:" . $Y . "px; left:" . $startPos . "px; width:" . $width . "px; height:" . $height . "px; background-color:" . $this->color . "; border: solid blue 1px; z-index:{$Z};\">";
                 foreach ($eventinformation as $evtwidth => $val) {
                     print "<div style=\"position:absolute; left:" . $evtwidth . " \"><a class=\"showit\" href=\"#\" style=\"top:-2px; font-size:10px;\"><b>";
                     $text = explode("-fact,", $val);
                     $fact = $text[0];
                     $val = $text[1];
                     if (isset($factAbbrev[$fact])) {
                         print $factAbbrev[$fact];
                     } else {
                         print get_first_letter($val);
                     }
                     print "</b><span>" . PrintReady($val) . "</span></a></div>";
                 }
                 $indiName = PrintReady(str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $value->getFullName()));
                 print "\n\t<table dir=\"ltr\"><tr>\n\t\t<td width=\"15\"><a class=\"showit\" href=\"#\"><b>";
                 if (isset($factAbbrev["BIRT"])) {
                     print $factAbbrev["BIRT"];
                 } else {
                     print get_first_letter($factarray["BIRT"]);
                 }
                 if (!$birthReal) {
                     print "*";
                 }
                 print "</b><span>" . $value->getSexImage() . $indiName . "<br/>" . $factarray["BIRT"] . " " . strip_tags($bdate->Display(false)) . " " . PrintReady($value->getBirthPlace()) . "</span></a></td>" . "<td align=\"left\" width=\"100%\"><a href=\"" . encode_url($value->getLinkUrl()) . "\">" . $value->getSexImage() . $indiName . "</a></td>" . "\n\t\t<td width=\"15\">";
                 if ($value->isDead()) {
                     if ($deathReal || $value->isDead()) {
                         print "<a class=\"showit\" href=\"#\"><b>";
                         if (isset($factAbbrev["DEAT"])) {
                             print $factAbbrev["DEAT"];
                         } else {
                             print get_first_letter($factarray["DEAT"]);
                         }
                         if (!$deathReal) {
                             print "*";
                         }
                         print "</b><span>" . $value->getSexImage() . $indiName . "<br/>" . $factarray["DEAT"] . " " . strip_tags($ddate->Display(false)) . " " . PrintReady($value->getDeathPlace()) . "</span></a>";
                     }
                 }
                 print "</td></tr></table>";
                 echo '</div>';
             } else {
                 echo "\n<div style=\"text-align: left; position: absolute;top:" . $Y . "px; left:" . $startPos . "px;width:" . $width . "px; height:" . $height . "px; background-color:" . $this->color . "; border: solid blue 1px; z-index:{$Z};\">";
                 $indiName = PrintReady(str_replace(array('<span class="starredname">', '</span>'), array('<u>', '</u>'), $value->getFullName()));
                 print "<a class=\"showit\" href=\"" . encode_url($value->getLinkUrl()) . "\"><b>";
                 if (isset($factAbbrev["BIRT"])) {
                     print $factAbbrev["BIRT"];
                 } else {
                     print get_first_letter($factarray["BIRT"]);
                 }
                 if (!$birthReal) {
                     print "*";
                 }
                 print "</b><span>" . $value->getSexImage() . $indiName . "<br/>" . $factarray["BIRT"] . " " . strip_tags($bdate->Display(false)) . " " . PrintReady($value->getBirthPlace()) . "<br/>";
                 foreach ($eventinformation as $evtwidth => $val) {
                     $text = explode("-fact,", $val);
                     $val = $text[1];
                     print $val . "<br />\n";
                 }
                 if ($value->isDead() && $deathReal) {
                     print $factarray["DEAT"] . " " . strip_tags($ddate->Display(false)) . " " . PrintReady($value->getDeathPlace());
                 }
                 print "</span></a>";
                 echo '</div>';
             }
         }
         $zindex--;
         if ($maxX < $startPos + $width) {
             $maxX = $startPos + $width;
         }
         if ($maxY < $Y) {
             $maxY = $Y;
         }
     }
     return $maxY;
 }
Пример #6
0
 if (!isset($_SESSION[$surname . "_firstalphafams"]) || $DEBUG) {
     $firstalpha = array();
     foreach ($tfamlist as $gid => $fam) {
         $names = preg_split("/[,+] ?/", $fam["name"]);
         $letter = str2upper(get_first_letter(trim($names[1])));
         if (!isset($firstalpha[$letter])) {
             if (isset($names[0]) && isset($names[1]) && $names[0] == $surname) {
                 $firstalpha[$letter] = array("letter" => $letter, "ids" => $gid);
             }
         } else {
             if ($names[0] == $surname) {
                 $firstalpha[$letter]["ids"] .= "," . $gid;
             }
         }
         if (isset($names[2]) && isset($names[3])) {
             $letter = str2upper(get_first_letter(trim($names[3])));
             if (!isset($firstalpha[$letter])) {
                 if ($names[2] == $surname) {
                     $firstalpha[$letter] = array("letter" => $letter, "ids" => $gid);
                 }
             } else {
                 if ($names[2] == $surname) {
                     $firstalpha[$letter]["ids"] .= "," . $gid;
                 }
             }
             // Make sure that the same gid is not already defined for the letter
         }
     }
     uasort($firstalpha, "lettersort");
     //-- put the list in the session so that we don't have to calculate this the next time
     $_SESSION[$surname . "_firstalphafams"] = $firstalpha;
Пример #7
0
     print "</ul></td>\n";
     print "</tr><tr><td colspan=\"2\" align=\"center\">";
     if ($SHOW_MARRIED_NAMES) {
         print $pgv_lang["total_names"] . " " . $count . "<br />\n";
     }
     print $pgv_lang["total_indis"] . " " . $total_indis;
     print "<br />" . $pgv_lang["total_living"] . " {$total_living} -- " . $pgv_lang["total_dead"] . " {$indi_dead} -- " . $pgv_lang["total_not_born"] . " " . $indi_unborn;
     print "</td>\n";
 } else {
     //--- the list is really long so divide it up again by the first letter of the first name
     if ($firstname_alpha) {
         if (!isset($_SESSION[$surname . "_firstalpha"])) {
             $firstalpha = array();
             foreach ($tindilist as $gid => $indi) {
                 foreach ($indi["names"] as $indexval => $namearray) {
                     $letter = str2upper(get_first_letter($namearray[0]));
                     if (!isset($firstalpha[$letter])) {
                         $firstalpha[$letter] = array("letter" => $letter, "ids" => $gid);
                     } else {
                         $firstalpha[$letter]["ids"] .= "," . $gid;
                     }
                 }
             }
             uasort($firstalpha, "lettersort");
             //-- put the list in the session so that we don't have to calculate this the next time
             $_SESSION[$surname . "_firstalpha"] = $firstalpha;
         } else {
             $firstalpha = $_SESSION[$surname . "_firstalpha"];
         }
         print "<div class=\"center\">" . $pgv_lang["first_letter_fname"] . "<br />\n";
         foreach ($firstalpha as $letter => $list) {
Пример #8
0
/**
* @todo add info
* @param array $attrs an array of key value pairs for the attributes
*/
function PGVRvarLetterSHandler($attrs)
{
    global $currentElement, $factarray, $fact, $desc;
    $var = $attrs["var"];
    if (!empty($var)) {
        $tfact = $fact;
        $var = preg_replace(array("/\\[/", "/\\]/", "/@fact/", "/@desc/"), array("['", "']", $tfact, $desc), $var);
        eval("if (!empty(\${$var})) \$var = \${$var};");
        $letter = get_first_letter($var);
        $currentElement->addText($letter);
    }
}
Пример #9
0
    /**
     * Get the details for a person and their spouse
     * @param Person $person the person to print the details for
     */
    function getDetails(&$person)
    {
        global $pgv_lang, $factarray, $factAbbrev, $SHOW_ID_NUMBERS, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $SERVER_URL;
        if (empty($person)) {
            $person = $this->rootPerson;
        }
        //if (!$person->canDisplayDetails()) return;
        $families = array();
        if (!empty($_REQUEST['famid'])) {
            $famid = $_REQUEST['famid'];
            if ($famid != 'all') {
                $family = Family::getInstance($_REQUEST['famid']);
                if (!empty($family)) {
                    $families[] = $family;
                }
            } else {
                $fams = $person->getSpouseFamilies();
                foreach ($fams as $fam) {
                    $families[] = $fam;
                }
            }
        } else {
            if ($this->allSpouses) {
                $fams = $person->getSpouseFamilies();
                foreach ($fams as $fam) {
                    $families[] = $fam;
                }
            } else {
                $fams = $person->getSpouseFamilies();
                $families[] = end($fams);
            }
        }
        $name = $person->getFullName();
        if ($SHOW_ID_NUMBERS) {
            $name .= " (" . $person->getXref() . ")";
        }
        ?>
		<span class="name1">
		<?php 
        print $this->getThumbnail($person);
        ?>
		<a href="<?php 
        print $person->getLinkUrl();
        ?>
" onclick="if (!<?php 
        print $this->name;
        ?>
.collapseBox) return false;"><?php 
        print $person->getSexImage() . PrintReady($name);
        ?>
</a>
		<img src="<?php 
        print $SERVER_URL . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["gedcom"]["small"];
        ?>
" border="0" width="15" onclick="<?php 
        print $this->name;
        ?>
.newRoot('<?php 
        print $person->getXref();
        ?>
', <?php 
        print $this->name;
        ?>
.innerPort, '<?php 
        print htmlentities($GEDCOM, ENT_COMPAT, 'UTF-8');
        ?>
');" />
		</span><br />
		<div class="details1 indent">
			<b><?php 
        if (isset($factAbbrev["BIRT"])) {
            print $factAbbrev["BIRT"];
        } else {
            print get_first_letter($factarray['BIRT']);
        }
        ?>
:</b>
				<?php 
        echo $person->getBirthDate()->Display(), ' ', PrintReady($person->getBirthPlace());
        ?>
			<br />
			<b><?php 
        if ($person->isDead()) {
            if (isset($factAbbrev["DEAT"])) {
                print $factAbbrev["DEAT"];
            } else {
                print get_first_letter($factarray['DEAT']);
            }
            ?>
:</b>
				<?php 
            echo $person->getDeathDate()->Display(), ' ', PrintReady($person->getDeathPlace());
        }
        ?>
		</div>
		<br />
		<span class="name1"><?php 
        foreach ($families as $family) {
            if (!empty($family)) {
                $spouse = $family->getSpouse($person);
            }
            if (!empty($spouse)) {
                $name = $spouse->getFullName();
                if ($SHOW_ID_NUMBERS) {
                    $name .= " (" . $spouse->getXref() . ")";
                }
                ?>
				<?php 
                print $this->getThumbnail($spouse);
                ?>
				<a href="<?php 
                print $spouse->getLinkUrl();
                ?>
" onclick="if (!<?php 
                print $this->name;
                ?>
.collapseBox) return false;">
				<?php 
                print $spouse->getSexImage() . PrintReady($name);
                ?>
</a>
				<img src="<?php 
                print $SERVER_URL . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["gedcom"]["small"];
                ?>
" border="0" width="15" onclick="<?php 
                print $this->name;
                ?>
.newRoot('<?php 
                print $spouse->getXref();
                ?>
', <?php 
                print $this->name;
                ?>
.innerPort, '<?php 
                print htmlentities($GEDCOM, ENT_COMPAT, 'UTF-8');
                ?>
');" />
				<br />
				<div class="details1 indent">
				<b><?php 
                if (isset($factAbbrev["BIRT"])) {
                    print $factAbbrev["BIRT"];
                } else {
                    print get_first_letter($factarray['BIRT']);
                }
                ?>
:</b>
				<?php 
                echo $spouse->getBirthDate()->Display(), ' ', PrintReady($spouse->getBirthPlace());
                ?>
				<br />
				<b><?php 
                if (isset($factAbbrev["MARR"])) {
                    print $factAbbrev["MARR"];
                } else {
                    print get_first_letter($factarray['MARR']);
                }
                ?>
:</b>
				<?php 
                $mdate = $family->getMarriageDate();
                if (!is_null($mdate)) {
                    print $mdate->Display() . " ";
                }
                $place = '';
                $place = $family->getMarriagePlace();
                if (!empty($place)) {
                    print PrintReady($place);
                }
                ?>
					<a href="family.php?famid=<?php 
                print $family->getXref();
                ?>
" onclick="if (!<?php 
                print $this->name;
                ?>
.collapseBox) return false;"><img id="d_<?php 
                print $family->getXref();
                ?>
" alt="<?php 
                print $family->getXref();
                ?>
" class="draggable" src="<?php 
                print $SERVER_URL . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES['family']['button'];
                ?>
" border="0" /></a>
				<br />
				<b><?php 
                if ($spouse->isDead()) {
                    if (isset($factAbbrev["DEAT"])) {
                        echo $factAbbrev["DEAT"];
                    } else {
                        echo get_first_letter($factarray['DEAT']);
                    }
                    ?>
:</b>
					<?php 
                    echo $spouse->getDeathDate()->Display(), ' ', PrintReady($spouse->getDeathPlace());
                }
                ?>
				</div>
				<?php 
            } else {
                print "<br />\n";
            }
        }
        ?>
		</span>
		<?php 
    }