Esempio n. 1
0
 function Person($data, $simple = true)
 {
     if (is_array($data)) {
         // Construct from a row from the database
         $this->isdead = $data['i_isdead'];
         $this->sex = $data['i_sex'];
     } else {
         // Construct from raw GEDCOM data
     }
     parent::GedcomRecord($data, $simple);
     $this->dispname = $this->disp || showLivingNameById($this->xref);
 }
Esempio n. 2
0
 /**
  * Inserts a clipping into the clipping cart
  *
  * @param
  */
 function add_clipping($clipping)
 {
     global $cart, $pgv_lang, $SHOW_SOURCES, $MULTI_MEDIA, $GEDCOM;
     if ($clipping['id'] == false || $clipping['id'] == "") {
         return false;
     }
     if (!id_in_cart($clipping['id'])) {
         $clipping['gedcom'] = $GEDCOM;
         if ($clipping['type'] == "indi") {
             if (displayDetailsById($clipping['id']) || showLivingNameById($clipping['id'])) {
                 $cart[] = $clipping;
                 $this->addCount++;
             } else {
                 $this->privCount++;
                 return false;
             }
         } else {
             if ($clipping['type'] == "fam") {
                 $parents = find_parents($clipping['id']);
                 if ((displayDetailsById($parents['HUSB']) || showLivingNameById($parents['HUSB'])) && (displayDetailsById($parents['WIFE']) || showLivingNameById($parents['WIFE']))) {
                     $cart[] = $clipping;
                     $this->addCount++;
                 } else {
                     $this->privCount++;
                     return false;
                 }
             } else {
                 if (displayDetailsById($clipping['id'], strtoupper($clipping['type']))) {
                     $cart[] = $clipping;
                     $this->addCount++;
                 } else {
                     $this->privCount++;
                     return false;
                 }
             }
         }
         //-- look in the gedcom record for any linked SOUR, NOTE, or OBJE and also add them to the
         //- clippings cart
         $gedrec = find_gedcom_record($clipping['id']);
         if ($SHOW_SOURCES >= PGV_USER_ACCESS_LEVEL) {
             $st = preg_match_all("/\\d SOUR @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
             for ($i = 0; $i < $st; $i++) {
                 // add SOUR
                 $clipping = array();
                 $clipping['type'] = "source";
                 $clipping['id'] = $match[$i][1];
                 $clipping['gedcom'] = $GEDCOM;
                 $this->add_clipping($clipping);
                 // add REPO
                 $sourec = find_gedcom_record($match[$i][1]);
                 $rt = preg_match_all("/\\d REPO @(.*)@/", $sourec, $rmatch, PREG_SET_ORDER);
                 for ($j = 0; $j < $rt; $j++) {
                     $clipping = array();
                     $clipping['type'] = "repository";
                     $clipping['id'] = $rmatch[$j][1];
                     $clipping['gedcom'] = $GEDCOM;
                     $this->add_clipping($clipping);
                 }
             }
         }
         $nt = preg_match_all("/\\d NOTE @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
         for ($i = 0; $i < $nt; $i++) {
             $clipping = array();
             $clipping['type'] = "note";
             $clipping['id'] = $match[$i][1];
             $clipping['gedcom'] = $GEDCOM;
             $this->add_clipping($clipping);
         }
         if ($MULTI_MEDIA) {
             $nt = preg_match_all("/\\d OBJE @(.*)@/", $gedrec, $match, PREG_SET_ORDER);
             for ($i = 0; $i < $nt; $i++) {
                 $clipping = array();
                 $clipping['type'] = "obje";
                 $clipping['id'] = $match[$i][1];
                 $clipping['gedcom'] = $GEDCOM;
                 $this->add_clipping($clipping);
             }
         }
     }
     return true;
 }
Esempio n. 3
0
 function print_time_fact($event)
 {
     global $basexoffset, $baseyoffset, $factcount, $TEXT_DIRECTION;
     global $factarray, $pgv_lang, $lang_short_cut, $LANGUAGE, $PGV_IMAGE_DIR, $PGV_IMAGES, $SHOW_PEDIGREE_PLACES, $placements;
     global $familyfacts, $GEDCOM;
     /* @var $event Event */
     $factrec = $event->getGedComRecord();
     $fact = $event->getTag();
     $desc = $event->getDetail();
     if ($fact == "EVEN" || $fact == "FACT") {
         $fact = $event->getType();
     }
     //-- check if this is a family fact
     $famid = $event->getFamilyId();
     if ($famid != null) {
         //-- if we already showed this family fact then don't print it
         if (isset($familyfacts[$famid . $fact]) && $familyfacts[$famid . $fact] != $event->temp) {
             return;
         }
         $familyfacts[$famid . $fact] = $event->temp;
     }
     $gdate = $event->getDate();
     $date = $gdate->MinDate();
     $date = $date->convert_to_cal('gregorian');
     $year = $date->y;
     $month = max(1, $date->m);
     $day = max(1, $date->d);
     $xoffset = $basexoffset + 22;
     $yoffset = $baseyoffset + ($year - $this->baseyear) * $this->scale - $this->scale;
     $yoffset = $yoffset + $month / 12 * $this->scale;
     $yoffset = $yoffset + $day / 30 * ($this->scale / 12);
     $yoffset = floor($yoffset);
     $place = round($yoffset / $this->bheight);
     $i = 1;
     $j = 0;
     $tyoffset = 0;
     while (isset($placements[$place])) {
         if ($i == $j) {
             $tyoffset = $this->bheight * $i;
             $i++;
         } else {
             $tyoffset = -1 * $this->bheight * $j;
             $j++;
         }
         $place = round(($yoffset + $tyoffset) / $this->bheight);
     }
     $yoffset += $tyoffset;
     $xoffset += abs($tyoffset);
     $placements[$place] = $yoffset;
     print "\n\t\t<div id=\"fact{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . $xoffset : "right: " . $xoffset) . "px; top:" . $yoffset . "px; font-size: 8pt; height: " . $this->bheight . "px; \" onmousedown=\"factMD(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ");\">\n";
     print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"cursor: hand;\"><tr><td>\n";
     print "<img src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["hline"]["other"] . "\" name=\"boxline{$factcount}\" id=\"boxline{$factcount}\" height=\"3\" align=\"left\" hspace=\"0\" width=\"10\" vspace=\"0\" alt=\"\" style=\"padding-";
     if ($TEXT_DIRECTION == "ltr") {
         print "left";
     } else {
         print "right";
     }
     print ": 3px;\" />\n";
     $col = $event->temp % 6;
     print "</td><td valign=\"top\" class=\"person" . $col . "\">\n";
     if (count($this->pids) > 6) {
         print $event->getParentObject()->getFullName() . " - ";
     }
     $indi = $event->getParentObject();
     if ($fact == "_AKAN" || $fact == "_AKA" || $fact == "ALIA" || $fact == "_INTE") {
         // Allow special processing for different languages
         $func = "fact_AKA_localisation_{$lang_short_cut[$LANGUAGE]}";
         if (function_exists($func) && get_class($indi) == "Person") {
             // Localise the facts
             $func($fact, $indi->getXref());
             print $factarray[$fact];
         } else {
             print $event->getLabel();
         }
     } else {
         print $event->getLabel();
     }
     print " -- ";
     if (get_class($indi) == "Person") {
         print format_fact_date($event);
     }
     if (get_class($indi) == "Family") {
         print $gdate->Display(false);
         $family = $indi;
         $husbid = $family->getHusbId();
         $wifeid = $family->getWifeId();
         //-- Retrieve husband and wife age
         for ($p = 0; $p < count($this->pids); $p++) {
             if ($this->pids[$p] == $husbid) {
                 $husb = $family->getHusband();
                 if (is_null($husb)) {
                     $husb = new Person('');
                 }
                 $hdate = $husb->getBirthDate();
                 if ($hdate->isOK()) {
                     $ageh = get_age_at_event(GedcomDate::GetAgeGedcom($hdate, $gdate), false);
                 }
             } else {
                 if ($this->pids[$p] == $wifeid) {
                     $wife = $family->getWife();
                     if (is_null($wife)) {
                         $wife = new Person('');
                     }
                     $wdate = $wife->getBirthDate();
                     if ($wdate->isOK()) {
                         $agew = get_age_at_event(GedcomDate::GetAgeGedcom($wdate, $gdate), false);
                     }
                 }
             }
         }
         if (!empty($ageh) && $ageh > 0) {
             if (empty($agew)) {
                 print '<span class="age"> ' . PrintReady("({$pgv_lang["age"]} {$ageh})") . '</span>';
             } else {
                 print '<span class="age"> ' . PrintReady("({$pgv_lang["husb_age"]} {$ageh},") . ' ';
             }
         }
         if (!empty($agew) && $agew > 0) {
             if (empty($ageh)) {
                 print '<span class="age"> ' . PrintReady("({$pgv_lang["age"]} {$agew})") . '</span>';
             } else {
                 print PrintReady("{$pgv_lang["wife_age"]} {$agew})") . '</span>';
             }
         }
     }
     print " " . PrintReady($desc);
     if ($SHOW_PEDIGREE_PLACES > 0) {
         $place = $event->getPlace();
         if ($place != null) {
             if ($desc != null) {
                 print " - ";
             }
             $plevels = explode(',', $place);
             for ($plevel = 0; $plevel < $SHOW_PEDIGREE_PLACES; $plevel++) {
                 if (!empty($plevels[$plevel])) {
                     if ($plevel > 0) {
                         print ", ";
                     }
                     print PrintReady($plevels[$plevel]);
                 }
             }
         }
     }
     //-- print spouse name for marriage events
     $spouse = Person::getInstance($event->getSpouseId());
     if ($spouse) {
         for ($p = 0; $p < count($this->pids); $p++) {
             if ($this->pids[$p] == $spouse->getXref()) {
                 break;
             }
         }
         if ($p == count($this->pids)) {
             $p = $event->temp;
         }
         $col = $p % 6;
         if ($spouse->getXref() != $this->pids[$p]) {
             echo ' <a href="', $spouse->getLinkUrl(), '">', $spouse->getFullName(), '</a>';
         } else {
             $ct = preg_match("/2 _PGVFS @(.*)@/", $factrec, $match);
             if ($ct > 0) {
                 print " <a href=\"" . encode_url("family.php?famid={$match[1]}&ged={$GEDCOM}") . "\">";
                 if (displayDetailsById($match[1]) || showLivingNameById($match[1])) {
                     print $event->getParentObject()->getFullName();
                 } else {
                     print $pgv_lang["private"];
                 }
                 print "</a>";
             }
         }
     }
     print "</td></tr></table>\n";
     print "</div>";
     if ($TEXT_DIRECTION == 'ltr') {
         $img = "dline2";
         $ypos = "0%";
     } else {
         $img = "dline";
         $ypos = "100%";
     }
     $dyoffset = $yoffset - $tyoffset + $this->bheight / 3;
     if ($tyoffset < 0) {
         $dyoffset = $yoffset + $this->bheight / 3;
         if ($TEXT_DIRECTION == 'ltr') {
             $img = "dline";
             $ypos = "100%";
         } else {
             $img = "dline2";
             $ypos = "0%";
         }
     }
     //-- print the diagnal line
     print "\n\t\t<div id=\"dbox{$factcount}\" style=\"position:absolute; " . ($TEXT_DIRECTION == "ltr" ? "left: " . ($basexoffset + 25) : "right: " . ($basexoffset + 25)) . "px; top:" . $dyoffset . "px; font-size: 8pt; height: " . abs($tyoffset) . "px; width: " . abs($tyoffset) . "px;";
     print " background-image: url('" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES[$img]["other"] . "');";
     print " background-position: 0% {$ypos}; \" >\n";
     print "</div>\n";
 }
Esempio n. 4
0
function print_family_book($pid, $descent)
{
    global $generations, $dgenerations, $pgv_lang, $firstrun;
    if ($descent == 0) {
        return;
    }
    $famids = find_sfamily_ids($pid);
    if (count($famids) > 0 || empty($firstrun)) {
        $firstrun = true;
        $pid = check_rootid($pid);
        $person = Person::getInstance($pid);
        $name = $person->getFullName();
        print "\n\t<h2 style=\"text-align: center\">" . $pgv_lang["family_of"] . PrintReady($name) . "</h2>";
        print "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr>\n";
        //-- descendancy
        print "<td valign=\"middle\">\n";
        $dgenerations = $generations;
        // $dgenerations = max_descendency_generations($pid, 0);
        print_descendency($pid, 1);
        print "</td>\n";
        //-- pedigree
        print "<td valign=\"middle\">\n";
        print_person_pedigree($pid, 1);
        print "</td>\n";
        print "</tr></table>\n";
        print "<br /><br />\n";
        print "<hr style=\"page-break-after:always;\"/>\n";
        print "<br /><br />\n";
        foreach ($famids as $indexval => $famid) {
            $famrec = find_family_record($famid, PGV_GED_ID);
            $ct = preg_match_all("/1 CHIL @(.*)@/", $famrec, $match, PREG_SET_ORDER);
            for ($i = 0; $i < $ct; $i++) {
                $chil = trim($match[$i][1]);
                if (showLivingNameById($chil) || displayDetailsById($chil)) {
                    print_family_book($chil, $descent - 1);
                }
            }
        }
    }
}
Esempio n. 5
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;
     }
 }
Esempio n. 6
0
    }
    $listHash = $_REQUEST;
    $listHash['sub_total'] = $total;
    $listHash['total_records'] = $n;
    $gBitSmarty->assign_by_ref("surnames", $surname_list);
    $gBitSmarty->assign_by_ref('listInfo', $listHash);
} else {
    if ($surname_sublist == "yes" && empty($surname) && $show_all == "no") {
        if (!isset($alpha)) {
            $alpha = "";
        }
        $tfamlist = get_famlist_surns($surname, $alpha, $SHOW_MARRIED_NAMES, $gGedcom->mGEDCOMId);
        $surnames = array();
        $fam_hide = array();
        foreach ($tfamlist as $gid => $fam) {
            if (displayDetailsByID($gid, "FAM") || showLivingNameById($gid, "FAM")) {
                foreach ($fam as $key => $name) {
                    //				$lname = strip_prefix($name);
                    //				if (empty($lname)) $lname = $name;
                    //				$firstLetter=get_first_letter($lname);
                    //				if ($alpha==$firstLetter) surname_count(trim($name));
                    $surnames[$gid]['match'] = count($fam[$key]);
                }
            } else {
                $fam_hide[$gid . "[" . $fam["gedfile"] . "]"] = 1;
            }
            $surnames[$gid]['name'] = $gid;
        }
        $i = 0;
        //	uasort($surnames, "itemsort");
        asort($surnames);
Esempio n. 7
0
 if ($surname_sublist == "yes" && empty($surname) && $show_all == "no") {
     if (!isset($alpha)) {
         $alpha = "";
     }
     $tindilist = array();
     // get all of the individuals whose last names start with this letter
     $tindilist = get_alpha_indis($alpha);
     $surnames = array();
     $indi_hide = array();
     $indi_dead = 0;
     $indi_unborn = 0;
     $indi_alive = 0;
     $temp = 0;
     $surnames = array();
     foreach ($tindilist as $gid => $indi) {
         if (displayDetailsByID($gid) || showLivingNameById($gid)) {
             $ret = check_alive($indi["gedcom"], $year);
             if ($ret == 0) {
                 $indi_alive++;
                 foreach ($indi["names"] as $name) {
                     if ($LANGUAGE == "danish" || $LANGUAGE == "norwegian") {
                         if ($alpha == "Ø") {
                             $text = "OE";
                         } else {
                             if ($alpha == "Æ") {
                                 $text = "AE";
                             } else {
                                 if ($alpha == "Å") {
                                     $text = "AA";
                                 }
                             }