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"; }
/** * get the birth and death years * @return string */ function getBirthDeathYears($age_at_death = true, $classname = "details1") { global $pgv_lang; if (!$this->getBirthYear()) { return ""; } $tmp = "<span dir=\"ltr\" title=\"" . strip_tags($this->getBirthDate()->Display()) . "\">" . $this->getBirthYear() . "-</span>"; $tmp .= "<span title=\"" . strip_tags($this->getDeathDate()->Display()) . "\">" . $this->getDeathYear() . "</span>"; // display age only for exact dates (empty date qualifier) if ($age_at_death && $this->getBirthYear() && empty($this->getBirthDate()->qual1) && $this->getDeathYear() && empty($this->getDeathDate()->qual1)) { $age = get_age_at_event(GedcomDate::GetAgeGedcom($this->getBirthDate(), $this->getDeathDate()), false); if (!empty($age)) { $tmp .= "<span class='age'> ({$pgv_lang['age']} {$age})</span>"; } } if ($classname) { return "<span class='{$classname}'>{$tmp}</span>"; } return $tmp; }