function print_fact(WT_Fact $fact, WT_GedcomRecord $record) { global $HIDE_GEDCOM_ERRORS, $SHOW_FACT_ICONS; static $n_chil = 0, $n_gchi = 0; $parent = $fact->getParent(); // Some facts don't get printed here ... switch ($fact->getTag()) { case 'NOTE': print_main_notes($fact, 1); return; case 'SOUR': print_main_sources($fact, 1); return; case 'OBJE': print_main_media($fact, 1); return; case 'FAMC': case 'FAMS': case 'CHIL': case 'HUSB': case 'WIFE': // These are internal links, not facts return; case '_WT_OBJE_SORT': // These links are used internally to record the sort order. return; default: // Hide unrecognized/custom tags? if ($HIDE_GEDCOM_ERRORS && !WT_Gedcom_Tag::isTag($fact->getTag())) { return; } break; } // Who is this fact about? Need it to translate fact label correctly if ($parent instanceof WT_Family && $record instanceof WT_Individual) { // Family event $label_person = $fact->getParent()->getSpouse($record); } else { // Individual event $label_person = $parent; } // New or deleted facts need different styling $styleadd = ''; if ($fact->isNew()) { $styleadd = 'new'; } if ($fact->isOld()) { $styleadd = 'old'; } // Event of close relative if (preg_match('/^_[A-Z_]{3,5}_[A-Z0-9]{4}$/', $fact->getTag())) { $styleadd = trim($styleadd . ' rela'); } // Event of close associates if ($fact->getFactId() == 'asso') { $styleadd = trim($styleadd . ' rela'); } // historical facts if ($fact->getFactId() == 'histo') { $styleadd = trim($styleadd . ' histo'); } // Does this fact have a type? if (preg_match('/\\n2 TYPE (.+)/', $fact->getGedcom(), $match)) { $type = $match[1]; } else { $type = ''; } switch ($fact->getTag()) { case 'EVEN': case 'FACT': if (WT_Gedcom_Tag::isTag($type)) { // Some users (just Meliza?) use "1 EVEN/2 TYPE BIRT". Translate the TYPE. $label = WT_Gedcom_Tag::getLabel($type, $label_person); $type = ''; // Do not print this again } elseif ($type) { // We don't have a translation for $type - but a custom translation might exist. $label = WT_I18N::translate(WT_Filter::escapeHtml($type)); $type = ''; // Do not print this again } else { // An unspecified fact/event $label = $fact->getLabel(); } break; case 'MARR': // This is a hack for a proprietory extension. Is it still used/needed? $utype = strtoupper($type); if ($utype == 'CIVIL' || $utype == 'PARTNERS' || $utype == 'RELIGIOUS') { $label = WT_Gedcom_Tag::getLabel('MARR_' . $utype, $label_person); $type = ''; // Do not print this again } else { $label = $fact->getLabel(); } break; default: // Normal fact/event $label = $fact->getLabel(); break; } echo '<tr class="', $styleadd, '">'; echo '<td class="descriptionbox width20">'; if ($SHOW_FACT_ICONS) { echo $fact->Icon(), ' '; } if ($fact->getFactId() != 'histo' && $fact->canEdit()) { ?> <a href="#" title="<?php echo WT_I18N::translate('Edit'); ?> " onclick="return edit_record('<?php echo $parent->getXref(); ?> ', '<?php echo $fact->getFactId(); ?> ');" ><?php echo $label; ?> </a> <div class="editfacts"> <div class="editlink"> <a href="#" title="<?php echo WT_I18N::translate('Edit'); ?> " class="editicon" onclick="return edit_record('<?php echo $parent->getXref(); ?> ', '<?php echo $fact->getFactId(); ?> ');" ><span class="link_text"><?php echo WT_I18N::translate('Edit'); ?> </span></a> </div> <div class="copylink"> <a href="#" title="<?php echo WT_I18N::translate('Copy'); ?> " class="copyicon" onclick="return copy_fact('<?php echo $parent->getXref(); ?> ', '<?php echo $fact->getFactId(); ?> ');" ><span class="link_text"><?php echo WT_I18N::translate('Copy'); ?> </span></a> </div> <div class="deletelink"> <a href="#" title="<?php echo WT_I18N::translate('Delete'); ?> " class="deleteicon" onclick="return delete_fact('<?php echo WT_I18N::translate('Are you sure you want to delete this fact?'); ?> ', '<?php echo $parent->getXref(); ?> ', '<?php echo $fact->getFactId(); ?> ');" ><span class="link_text"><?php echo WT_I18N::translate('Delete'); ?> </span></a> </div> </div> <?php } else { echo $label; } switch ($fact->getTag()) { case '_BIRT_CHIL': echo '<br>', WT_I18N::translate('#%s', ++$n_chil); break; case '_BIRT_GCHI': case '_BIRT_GCH1': case '_BIRT_GCH2': echo '<br>', WT_I18N::translate('#%s', ++$n_gchi); break; } echo '</td><td class="optionbox ', $styleadd, ' wrap">'; // Event from another record? if ($parent !== $record) { if ($parent instanceof WT_Family) { foreach ($parent->getSpouses() as $spouse) { if ($record !== $spouse) { echo '<a href="', $spouse->getHtmlUrl(), '">', $spouse->getFullName(), '</a> — '; } } echo '<a href="', $parent->getHtmlUrl(), '">', WT_I18N::translate('View family'), '</a><br>'; } elseif ($parent instanceof WT_Individual) { echo '<a href="', $parent->getHtmlUrl(), '">', $parent->getFullName(), '</a><br>'; } } // Print the value of this fact/event switch ($fact->getTag()) { case 'ADDR': echo $fact->getValue(); break; case 'AFN': echo '<div class="field"><a href="https://familysearch.org/search/tree/results#count=20&query=afn:', rawurlencode($fact->getValue()), '" target="new">', WT_Filter::escapeHtml($fact->getValue()), '</a></div>'; break; case 'ASSO': // we handle this later, in format_asso_rela_record() break; case 'EMAIL': case 'EMAI': case '_EMAIL': echo '<div class="field"><a href="mailto:', WT_Filter::escapeHtml($fact->getValue()), '">', WT_Filter::escapeHtml($fact->getValue()), '</a></div>'; break; case 'FILE': if (WT_USER_CAN_EDIT || WT_USER_CAN_ACCEPT) { echo '<div class="field">', WT_Filter::escapeHtml($fact->getValue()), '</div>'; } break; case 'RESN': echo '<div class="field">'; switch ($fact->getValue()) { case 'none': // Note: "1 RESN none" is not valid gedcom. // However, webtrees privacy rules will interpret it as "show an otherwise private record to public". echo '<i class="icon-resn-none"></i> ', WT_I18N::translate('Show to visitors'); break; case 'privacy': echo '<i class="icon-class-none"></i> ', WT_I18N::translate('Show to members'); break; case 'confidential': echo '<i class="icon-confidential-none"></i> ', WT_I18N::translate('Show to managers'); break; case 'locked': echo '<i class="icon-locked-none"></i> ', WT_I18N::translate('Only managers can edit'); break; default: echo WT_Filter::escapeHtml($fact->getValue()); break; } echo '</div>'; break; case 'PUBL': // Publication details might contain URLs. echo '<div class="field">', WT_Filter::expandUrls($fact->getValue()), '</div>'; break; case 'REPO': if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) { print_repository_record($match[1]); } else { echo '<div class="error">', WT_Filter::escapeHtml($fact->getValue()), '</div>'; } break; case 'URL': case '_URL': case 'WWW': echo '<div class="field"><a href="', WT_Filter::escapeHtml($fact->getValue()), '">', WT_Filter::escapeHtml($fact->getValue()), '</a></div>'; break; case 'TEXT': // 0 SOUR / 1 TEXT echo '<div class="field">', nl2br(WT_Filter::escapeHtml($fact->getValue()), false), '</div>'; break; default: // Display the value for all other facts/events switch ($fact->getValue()) { case '': // Nothing to display break; case 'N': // Not valid GEDCOM echo '<div class="field">', WT_I18N::translate('No'), '</div>'; break; case 'Y': // Do not display "Yes". break; default: if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $fact->getValue(), $match)) { $target = WT_GedcomRecord::getInstance($match[1]); if ($target) { echo '<div><a href="', $target->getHtmlUrl(), '">', $target->getFullName(), '</a></div>'; } else { echo '<div class="error">', WT_Filter::escapeHtml($fact->getValue()), '</div>'; } } else { echo '<div class="field"><span dir="auto">', WT_Filter::escapeHtml($fact->getValue()), '</span></div>'; } break; } break; } // Print the type of this fact/event if ($type) { $utype = strtoupper($type); // Events of close relatives, e.g. _MARR_CHIL if (substr($fact->getTag(), 0, 6) == '_MARR_' && ($utype == 'CIVIL' || $utype == 'PARTNERS' || $utype == 'RELIGIOUS')) { // Translate MARR/TYPE using the code that supports MARR_CIVIL, etc. tags $type = WT_Gedcom_Tag::getLabel('MARR_' . $utype); } else { // Allow (custom) translations for other types $type = WT_I18N::translate($type); } echo WT_Gedcom_Tag::getLabelValue('TYPE', WT_Filter::escapeHtml($type)); } // Print the date of this fact/event echo format_fact_date($fact, $record, true, true); // Print the place of this fact/event echo '<div class="place">', format_fact_place($fact, true, true, true), '</div>'; // A blank line between the primary attributes (value, date, place) and the secondary ones echo '<br>'; $addr = $fact->getAttribute('ADDR'); if ($addr) { echo WT_Gedcom_Tag::getLabelValue('ADDR', $addr); } // Print the associates of this fact/event echo format_asso_rela_record($fact); // Print any other "2 XXXX" attributes, in the order in which they appear. preg_match_all('/\\n2 (' . WT_REGEX_TAG . ') (.+)/', $fact->getGedcom(), $matches, PREG_SET_ORDER); foreach ($matches as $match) { switch ($match[1]) { case 'DATE': case 'TIME': case 'AGE': case 'PLAC': case 'ADDR': case 'ALIA': case 'ASSO': case '_ASSO': case 'DESC': case 'RELA': case 'STAT': case 'TEMP': case 'TYPE': case 'FAMS': case 'CONT': // These were already shown at the beginning break; case 'NOTE': case 'OBJE': case 'SOUR': // These will be shown at the end break; case 'EVEN': // 0 SOUR / 1 DATA / 2 EVEN / 3 DATE / 3 PLAC $events = array(); foreach (preg_split('/ *, */', $match[2]) as $event) { $events[] = WT_Gedcom_Tag::getLabel($event); } if (count($events) == 1) { echo WT_Gedcom_Tag::getLabelValue('EVEN', $event); } else { echo WT_Gedcom_Tag::getLabelValue('EVEN', implode(WT_I18N::$list_separator, $events)); } if (preg_match('/\\n3 DATE (.+)/', $fact->getGedcom(), $date_match)) { $date = new WT_Date($date_match[1]); echo WT_Gedcom_Tag::getLabelValue('DATE', $date->Display()); } if (preg_match('/\\n3 PLAC (.+)/', $fact->getGedcom(), $plac_match)) { echo WT_Gedcom_Tag::getLabelValue('PLAC', $plac_match[1]); } break; case 'FAMC': // 0 INDI / 1 ADOP / 2 FAMC / 3 ADOP $family = WT_Family::getInstance(str_replace('@', '', $match[2])); if ($family) { // May be a pointer to a non-existant record echo WT_Gedcom_Tag::getLabelValue('FAM', '<a href="' . $family->getHtmlUrl() . '">' . $family->getFullName() . '</a>'); if (preg_match('/\\n3 ADOP (HUSB|WIFE|BOTH)/', $fact->getGedcom(), $match)) { echo WT_Gedcom_Tag::getLabelValue('ADOP', WT_Gedcom_Code_Adop::getValue($match[1], $label_person)); } } else { echo WT_Gedcom_Tag::getLabelValue('FAM', '<span class="error">' . $match[2] . '</span>'); } break; case '_WT_USER': $user = User::findByIdentifier($match[2]); // may not exist if ($user) { echo WT_Gedcom_Tag::getLabelValue('_WT_USER', WT_Filter::escapeHtml($user->getRealName())); } else { echo WT_Gedcom_Tag::getLabelValue('_WT_USER', WT_Filter::escapeHtml($match[2])); } break; case 'RESN': switch ($match[2]) { case 'none': // Note: "2 RESN none" is not valid gedcom. // However, webtrees privacy rules will interpret it as "show an otherwise private fact to public". echo WT_Gedcom_Tag::getLabelValue('RESN', '<i class="icon-resn-none"></i> ' . WT_I18N::translate('Show to visitors')); break; case 'privacy': echo WT_Gedcom_Tag::getLabelValue('RESN', '<i class="icon-resn-privacy"></i> ' . WT_I18N::translate('Show to members')); break; case 'confidential': echo WT_Gedcom_Tag::getLabelValue('RESN', '<i class="icon-resn-confidential"></i> ' . WT_I18N::translate('Show to managers')); break; case 'locked': echo WT_Gedcom_Tag::getLabelValue('RESN', '<i class="icon-resn-locked"></i> ' . WT_I18N::translate('Only managers can edit')); break; default: echo WT_Gedcom_Tag::getLabelValue('RESN', WT_Filter::escapeHtml($match[2])); break; } break; case 'CALN': echo WT_Gedcom_Tag::getLabelValue('CALN', WT_Filter::expandUrls($match[2])); break; case 'FORM': // 0 OBJE / 1 FILE / 2 FORM / 3 TYPE echo WT_Gedcom_Tag::getLabelValue('FORM', $match[2]); if (preg_match('/\\n3 TYPE (.+)/', $fact->getGedcom(), $type_match)) { echo WT_Gedcom_Tag::getLabelValue('TYPE', WT_Gedcom_Tag::getFileFormTypeValue($type_match[1])); } break; case 'URL': case '_URL': case 'WWW': $link = '<a href="' . WT_Filter::escapeHtml($match[2]) . '">' . WT_Filter::escapeHtml($match[2]) . '</a>'; echo WT_Gedcom_Tag::getLabelValue($fact->getTag() . ':' . $match[1], $link); break; default: if (!$HIDE_GEDCOM_ERRORS || WT_Gedcom_Tag::isTag($match[1])) { if (preg_match('/^@(' . WT_REGEX_XREF . ')@$/', $match[2], $xmatch)) { // Links $linked_record = WT_GedcomRecord::getInstance($xmatch[1]); if ($linked_record) { $link = '<a href="' . $linked_record->getHtmlUrl() . '">' . $linked_record->getFullName() . '</a>'; echo WT_Gedcom_Tag::getLabelValue($fact->getTag() . ':' . $match[1], $link); } else { echo WT_Gedcom_Tag::getLabelValue($fact->getTag() . ':' . $match[1], WT_Filter::escapeHtml($match[2])); } } else { // Non links echo WT_Gedcom_Tag::getLabelValue($fact->getTag() . ':' . $match[1], WT_Filter::escapeHtml($match[2])); } } break; } } echo print_fact_sources($fact->getGedcom(), 2); echo print_fact_notes($fact->getGedcom(), 2); print_media_links($fact->getGedcom(), 2); echo '</td></tr>'; }
/** * Print a simple fact version of this event * * @param boolean $return whether to print or return * @param boolean $anchor whether to add anchor to date and place */ function print_simple_fact($return = false, $anchor = false) { global $pgv_lang, $SHOW_PEDIGREE_PLACES, $factarray, $ABBREVIATE_CHART_LABELS; if (!$this->canShow()) { return ""; } $data = ""; if ($this->gedcomRecord != "1 DEAT") { $data .= "<span class=\"details_label\">" . $this->getLabel($ABBREVIATE_CHART_LABELS) . "</span> "; } if ($this->canShowDetails()) { $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"); if (!in_array($this->tag, $emptyfacts)) { $data .= PrintReady($this->detail); } if (!$this->dest) { $data .= format_fact_date($this, $anchor, false, true); } $data .= format_fact_place($this, $anchor, false, false); } $data .= "<br />\n"; if (!$return) { print $data; } else { return $data; } }
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"; }
function print_time_fact(WT_Fact $event) { global $basexoffset, $baseyoffset, $factcount, $TEXT_DIRECTION, $WT_IMAGES, $placements; $desc = $event->getValue(); // check if this is a family fact $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 = (int) $yoffset; $place = (int) ($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 = (int) (($yoffset + $tyoffset) / $this->bheight); } $yoffset += $tyoffset; $xoffset += abs($tyoffset); $placements[$place] = $yoffset; echo "<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=\"factMouseDown(this, '" . $factcount . "', " . ($yoffset - $tyoffset) . ");\">"; echo "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"cursor: hand;\"><tr><td>"; echo "<img src=\"" . $WT_IMAGES["hline"] . "\" name=\"boxline{$factcount}\" id=\"boxline{$factcount}\" height=\"3\" align=\"left\" width=\"10\" alt=\"\" style=\"padding-"; if ($TEXT_DIRECTION == "ltr") { echo "left"; } else { echo "right"; } echo ": 3px;\">"; $col = $event->temp % 6; echo "</td><td valign=\"top\" class=\"person" . $col . "\">"; if (count($this->pids) > 6) { echo $event->getParent()->getFullName() . ' — '; } $record = $event->getParent(); echo $event->getLabel(); echo ' — '; if ($record instanceof WT_Individual) { echo format_fact_date($event, $record, false, false); } elseif ($record instanceof WT_Family) { echo $gdate->Display(false); if ($record->getHusband() && $record->getHusband()->getBirthDate()->isOK()) { $ageh = get_age_at_event(WT_Date::GetAgeGedcom($record->getHusband()->getBirthDate(), $gdate), false); } else { $ageh = null; } if ($record->getWife() && $record->getWife()->getBirthDate()->isOK()) { $agew = get_age_at_event(WT_Date::GetAgeGedcom($record->getWife()->getBirthDate(), $gdate), false); } else { $agew = null; } if ($ageh && $agew) { echo '<span class="age"> ', WT_I18N::translate('Husband’s age'), ' ', $ageh, ' ', WT_I18N::translate('Wife’s age'), ' ', $agew, '</span>'; } elseif ($ageh) { echo '<span class="age"> ', WT_I18N::translate('Age'), ' ', $ageh, '</span>'; } elseif ($agew) { echo '<span class="age"> ', WT_I18N::translate('Age'), ' ', $ageh, '</span>'; } } echo ' ' . WT_Filter::escapeHtml($desc); if (!$event->getPlace()->isEmpty()) { echo ' — ' . $event->getPlace()->getShortName(); } // print spouse name for marriage events if (isset($event->spouse)) { $spouse = $event->spouse; } else { $spouse = null; } 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; } if ($spouse->getXref() != $this->pids[$p]) { echo ' <a href="', $spouse->getHtmlUrl(), '">', $spouse->getFullName(), '</a>'; } else { echo ' <a href="', $event->getParent()->getHtmlUrl(), '">', $event->getParent()->getFullName(), '</a>'; } } echo "</td></tr></table>"; echo "</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 echo "<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;"; echo " background-image: url('" . $WT_IMAGES[$img] . "');"; echo " background-position: 0% {$ypos};\">"; echo "</div>"; }
/** * prints a form to add an individual or edit an individual's name * * @param string $nextaction the next action the edit_interface.php file should take after the form is submitted * @param string $famid the family that the new person should be added to * @param string $namerec the name subrecord when editing a name * @param string $famtag how the new person is added to the family */ function print_indi_form($nextaction, $famid, $linenum = "", $namerec = "", $famtag = "CHIL", $sextag = "") { global $pgv_lang, $factarray, $pid, $PGV_IMAGE_DIR, $PGV_IMAGES, $WORD_WRAPPED_NOTES; global $NPFX_accept, $SPFX_accept, $NSFX_accept, $FILE_FORM_accept, $GEDCOM, $NAME_REVERSE; global $bdm, $TEXT_DIRECTION, $STANDARD_NAME_FACTS, $REVERSED_NAME_FACTS, $ADVANCED_NAME_FACTS, $ADVANCED_PLAC_FACTS, $SURNAME_TRADITION; global $QUICK_REQUIRED_FACTS, $QUICK_REQUIRED_FAMFACTS; $bdm = ""; // used to copy '1 SOUR' to '2 SOUR' for BIRT DEAT MARR init_calendar_popup(); echo "<form method=\"post\" name=\"addchildform\" onsubmit=\"return checkform();\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"{$nextaction}\" />\n"; echo "<input type=\"hidden\" name=\"linenum\" value=\"{$linenum}\" />\n"; echo "<input type=\"hidden\" name=\"famid\" value=\"{$famid}\" />\n"; echo "<input type=\"hidden\" name=\"pid\" value=\"{$pid}\" />\n"; echo "<input type=\"hidden\" name=\"famtag\" value=\"{$famtag}\" />\n"; echo "<input type=\"submit\" value=\"" . $pgv_lang["save"] . "\" />\n"; echo "<input type=\"hidden\" name=\"goto\" value=\"\" />\n"; if (preg_match('/^add(child|spouse|newparent|newrepository)/', $nextaction)) { echo "<input type=\"submit\" value=\"{$pgv_lang['saveandgo']}\" onclick=\"document.addchildform.goto.value='new';\"/>\n"; } echo "<table class=\"facts_table\">"; // When adding a new child, specify the pedigree if ($nextaction == 'addchildaction') { add_simple_tag("0 PEDI"); } // Populate the standard NAME field and subfields $name_fields = array(); if (!$NAME_REVERSE) { foreach ($STANDARD_NAME_FACTS as $tag) { $name_fields[$tag] = get_gedcom_value($tag, 0, $namerec); } } else { foreach ($REVERSED_NAME_FACTS as $tag) { $name_fields[$tag] = get_gedcom_value($tag, 0, $namerec); } } $new_marnm = ''; // Inherit surname from parents, spouse or child if (empty($namerec)) { // We'll need the parent's name to set the child's surname if (isset($pgv_changes[$famid . "_" . $GEDCOM])) { $famrec = find_updated_record($famid); } else { $famrec = find_family_record($famid); } $parents = find_parents_in_record($famrec); $father_name = get_gedcom_value('NAME', 0, find_person_record($parents['HUSB'])); $mother_name = get_gedcom_value('NAME', 0, find_person_record($parents['WIFE'])); // We'll need the spouse/child's name to set the spouse/parent's surname if (isset($pgv_changes[$pid . "_" . $GEDCOM])) { $prec = find_updated_record($pid); } else { $prec = find_person_record($pid); } $indi_name = get_gedcom_value('NAME', 0, $prec); // Different cultures do surnames differently switch ($SURNAME_TRADITION) { case 'spanish': //Mother: Maria /AAAA BBBB/ //Father: Jose /CCCC DDDD/ //Child: Pablo /CCCC AAAA/ switch ($nextaction) { case 'addchildaction': if (preg_match('/\\/(\\S+)\\s+\\S+\\//', $mother_name, $matchm) && preg_match('/\\/(\\S+)\\s+\\S+\\//', $father_name, $matchf)) { $name_fields['SURN'] = $matchf[1] . ' ' . $matchm[1]; $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/'; } break; case 'addnewparentaction': if ($famtag == 'HUSB' && preg_match('/\\/(\\S+)\\s+\\S+\\//', $indi_name, $match)) { $name_fields['SURN'] = $match[1] . ' '; $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/'; } if ($famtag == 'WIFE' && preg_match('/\\/\\S+\\s+(\\S+)\\//', $indi_name, $match)) { $name_fields['SURN'] = $match[1] . ' '; $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/'; } break; } break; case 'portuguese': //Mother: Maria /AAAA BBBB/ //Father: Jose /CCCC DDDD/ //Child: Pablo /BBBB DDDD/ switch ($nextaction) { case 'addchildaction': if (preg_match('/\\/\\S+\\s+(\\S+)\\//', $mother_name, $matchm) && preg_match('/\\/\\S+\\s+(\\S+)\\//', $father_name, $matchf)) { $name_fields['SURN'] = $matchf[1] . ' ' . $matchm[1]; $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/'; } break; case 'addnewparentaction': if ($famtag == 'HUSB' && preg_match('/\\/\\S+\\s+(\\S+)\\//', $indi_name, $match)) { $name_fields['SURN'] = ' ' . $match[1]; $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/'; } if ($famtag == 'WIFE' && preg_match('/\\/(\\S+)\\s+\\S+\\//', $indi_name, $match)) { $name_fields['SURN'] = ' ' . $match[1]; $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/'; } break; } break; case 'icelandic': // Sons get their father's given name plus "sson" // Daughters get their father's given name plus "sdottir" switch ($nextaction) { case 'addchildaction': if ($sextag == 'M' && preg_match('/(\\S+)\\s+\\/.*\\//', $father_name, $match)) { $name_fields['SURN'] = preg_replace('/s$/', '', $match[1]) . 'sson'; $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/'; } if ($sextag == 'F' && preg_match('/(\\S+)\\s+\\/.*\\//', $father_name, $match)) { $name_fields['SURN'] = preg_replace('/s$/', '', $match[1]) . 'sdottir'; $name_fields['NAME'] = '/' . $name_fields['SURN'] . '/'; } break; case 'addnewparentaction': if ($famtag == 'HUSB' && preg_match('/(\\S+)sson\\s+\\/.*\\//i', $indi_name, $match)) { $name_fields['GIVN'] = $match[1]; $name_fields['NAME'] = $name_fields['GIVN'] . ' //'; } if ($famtag == 'WIFE' && preg_match('/(\\S+)sdottir\\s+\\/.*\\//i', $indi_name, $match)) { $name_fields['GIVN'] = $match[1]; $name_fields['NAME'] = $name_fields['GIVN'] . ' //'; } break; } break; case 'paternal': case 'polish': // Father gives his surname to his wife and children switch ($nextaction) { case 'addspouseaction': if ($famtag == 'WIFE' && preg_match('/\\/(.*)\\//', $indi_name, $match)) { if ($SURNAME_TRADITION == 'polish') { $match[1] = preg_replace(array('/ski$/', '/cki$/', '/dzki$/'), array('ska', 'cka', 'dzka'), $match[1]); } $new_marnm = $match[1]; } break; case 'addchildaction': if (preg_match('/\\/((?:[a-z]{2,3}\\s+)*)(.*)\\//i', $father_name, $match)) { if ($SURNAME_TRADITION == 'polish' && $sextag == 'F') { $match[2] = preg_replace(array('/ski$/', '/cki$/', '/dzki$/'), array('ska', 'cka', 'dzka'), $match[2]); } $name_fields['SPFX'] = trim($match[1]); $name_fields['SURN'] = $match[2]; $name_fields['NAME'] = "/{$match[1]}{$match[2]}/"; } break; case 'addnewparentaction': if ($famtag == 'HUSB' && preg_match('/\\/((?:[a-z]{2,3}\\s+)*)(.*)\\//i', $indi_name, $match)) { if ($SURNAME_TRADITION == 'polish' && $sextag == 'M') { $match[2] = preg_replace(array('/ska$/', '/cka$/', '/dzka$/'), array('ski', 'cki', 'dzki'), $match[2]); } $name_fields['SPFX'] = trim($match[1]); $name_fields['SURN'] = $match[2]; $name_fields['NAME'] = "/{$match[1]}{$match[2]}/"; } break; } break; } } // Make sure there are two slashes in the name if (!preg_match('/\\//', $name_fields['NAME'])) { $name_fields['NAME'] .= ' /'; } if (!preg_match('/\\/.*\\//', $name_fields['NAME'])) { $name_fields['NAME'] .= '/'; } // Populate any missing 2 XXXX fields from the 1 NAME field $npfx_accept = implode('|', $NPFX_accept); if (preg_match("/((({$npfx_accept})\\.? +)*)([^\n\\/\"]*)(\"(.*)\")? *\\/(([a-z]{2,3} +)*)(.*)\\/ *(.*)/i", $name_fields['NAME'], $name_bits)) { if (empty($name_fields['NPFX'])) { $name_fields['NPFX'] = $name_bits[1]; } if (!$NAME_REVERSE && empty($name_fields['GIVN'])) { $name_fields['GIVN'] = $name_bits[4]; } if (empty($name_fields['SPFX']) && empty($name_fields['SURN'])) { $name_fields['SPFX'] = trim($name_bits[7]); $name_fields['SURN'] = $name_bits[9]; } if (empty($name_fields['NSFX'])) { $name_fields['NSFX'] = $name_bits[10]; } if ($NAME_REVERSE && empty($name_fields['GIVN'])) { $name_fields['GIVN'] = $name_bits[4]; } // Don't automatically create an empty NICK - it is an "advanced" field. if (empty($name_fields['NICK']) && !empty($name_bits[6]) && !preg_match('/^2 NICK/m', $namerec)) { $name_fields['NICK'] = $name_bits[6]; } } // Edit the standard name fields foreach ($name_fields as $tag => $value) { add_simple_tag("0 {$tag} {$value}"); } // Get the advanced name fields $adv_name_fields = array(); if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $ADVANCED_NAME_FACTS, $match)) { foreach ($match[1] as $tag) { $adv_name_fields[$tag] = ''; } } // This is a custom tag, but PGV uses it extensively. if ($SURNAME_TRADITION == 'paternal' || $SURNAME_TRADITION == 'polish' || preg_match('/2 _MARNM/', $namerec)) { $adv_name_fields['_MARNM'] = ''; } foreach ($adv_name_fields as $tag => $dummy) { // Edit existing tags if (preg_match_all("/2 {$tag} (.+)/", $namerec, $match)) { foreach ($match[1] as $value) { if ($tag == '_MARNM') { $mnsct = preg_match('/\\/(.+)\\//', $value, $match2); $marnm_surn = ""; if ($mnsct > 0) { $marnm_surn = $match2[1]; } add_simple_tag("2 _MARNM " . $value); add_simple_tag("2 _MARNM_SURN " . $marnm_surn); } else { add_simple_tag("2 {$tag} {$value}", "", fact_label("NAME:{$tag}")); } } } // Allow a new row to be entered if there was no row provided if (count($match[1]) == 0 && empty($name_fields[$tag]) || $tag != '_HEB' && $tag != 'NICK') { if ($tag == '_MARNM') { add_simple_tag("0 _MARNM"); add_simple_tag("0 _MARNM_SURN {$new_marnm}"); } else { add_simple_tag("0 {$tag}", "", fact_label("NAME:{$tag}")); } } } // Handle any other NAME subfields that aren't included above (SOUR, NOTE, _CUSTOM, etc) if ($namerec != "" && $namerec != "NEW") { $gedlines = split("\n", $namerec); // -- find the number of lines in the record $fields = explode(' ', $gedlines[0]); $glevel = $fields[0]; $level = $glevel; $type = trim($fields[1]); $level1type = $type; $tags = array(); $i = 0; do { if (!isset($name_fields[$type]) && !isset($adv_name_fields[$type])) { $text = ""; for ($j = 2; $j < count($fields); $j++) { if ($j > 2) { $text .= " "; } $text .= $fields[$j]; } $iscont = false; while ($i + 1 < count($gedlines) && preg_match("/" . ($level + 1) . " (CON[CT])\\s?(.*)/", $gedlines[$i + 1], $cmatch) > 0) { $iscont = true; if ($cmatch[1] == "CONT") { $text .= "\n"; } if ($WORD_WRAPPED_NOTES) { $text .= " "; } $text .= $cmatch[2]; $i++; } add_simple_tag($level . " " . $type . " " . $text); } $tags[] = $type; $i++; if (isset($gedlines[$i])) { $fields = explode(' ', $gedlines[$i]); $level = $fields[0]; if (isset($fields[1])) { $type = $fields[1]; } } } while ($level > $glevel && $i < count($gedlines)); } // If we are adding a new individual, add the basic details if ($nextaction != 'update') { echo '</table><br/><table class="facts_table">'; // 1 SEX if ($famtag == "HUSB" || $sextag == "M") { add_simple_tag("0 SEX M"); } elseif ($famtag == "WIFE" || $sextag == "F") { add_simple_tag("0 SEX F"); } else { add_simple_tag("0 SEX"); } $bdm = "BD"; if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) { foreach ($matches[1] as $match) { if (!in_array($match, explode('|', PGV_EVENTS_DEAT))) { addSimpleTags($match); } } } //-- if adding a spouse add the option to add a marriage fact to the new family if ($nextaction == 'addspouseaction' || $nextaction == 'addnewparentaction' && $famid != 'new') { $bdm .= "M"; if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FAMFACTS, $matches)) { foreach ($matches[1] as $match) { addSimpleTags($match); } } } if (preg_match_all('/(' . PGV_REGEX_TAG . ')/', $QUICK_REQUIRED_FACTS, $matches)) { foreach ($matches[1] as $match) { if (in_array($match, explode('|', PGV_EVENTS_DEAT))) { addSimpleTags($match); } } } } if (PGV_USER_IS_ADMIN) { echo "<tr><td class=\"descriptionbox " . $TEXT_DIRECTION . " wrap width25\">"; print_help_link("no_update_CHAN_help", "qm"); echo $pgv_lang["admin_override"] . "</td><td class=\"optionbox wrap\">\n"; echo "<input type=\"checkbox\" name=\"preserve_last_changed\" />\n"; echo $pgv_lang["no_update_CHAN"] . "<br />\n"; if (isset($famrec)) { $event = new Event(get_sub_record(1, "1 CHAN", $famrec)); echo format_fact_date($event, false, true); } echo "</td></tr>\n"; } echo "</table>\n"; if ($nextaction == 'update') { // GEDCOM 5.5.1 spec says NAME doesn't get a OBJE print_add_layer('SOUR'); print_add_layer('NOTE'); print_add_layer('SHARED_NOTE'); } else { print_add_layer('SOUR', 1); print_add_layer('NOTE', 1); print_add_layer('SHARED_NOTE', 1); print_add_layer('OBJE', 1); } echo "<input type=\"submit\" value=\"" . $pgv_lang["save"] . "\" />\n"; if (preg_match('/^add(child|spouse|newparent|source)/', $nextaction)) { echo "<input type=\"submit\" value=\"{$pgv_lang['saveandgo']}\" onclick=\"document.addchildform.goto.value='new';\"/>\n"; } echo "</form>\n"; ?> <script type="text/javascript"> <!-- function trim(str) { // Commas are used in the GIVN and SURN field to separate lists of surnames. // For example, to differentiate the two Spanish surnames from an English // double-barred name. // Commas *may* be used in the NAME field, and will form part of the displayed // name. This is not encouraged, as it may confuse some logic that assumes // "list" format names are always "surn, givn". str=str.replace(/,/g," "); str=str.replace(/\s\s+/g," "); return str.replace(/(^\s+)|(\s+$)/g,''); } function lang_class(str) { if (str.match(/[\u0370-\u03FF]/)) return "greek"; if (str.match(/[\u0400-\u04FF]/)) return "cyrillic"; if (str.match(/[\u0590-\u05FF]/)) return "hebrew"; if (str.match(/[\u0600-\u06FF]/)) return "arabic"; return "latin"; // No matched text implies latin :-) } // Generate a full name from the name components function generate_name() { var frm =document.forms[0]; var npfx=frm.NPFX.value; var givn=frm.GIVN.value; var spfx=frm.SPFX.value; var surn=frm.SURN.value; var nsfx=frm.NSFX.value; return trim(npfx+" "+givn+" /"+trim(spfx+" "+surn.replace(/ *, */, " "))+"/ "+nsfx); } // Update the NAME and _MARNM fields from the name components // and also display the value in read-only "gedcom" format. function updatewholename() { // don't update the name if the user manually changed it if (manualChange) return; // Update NAME field from components and display it var frm =document.forms[0]; var npfx=frm.NPFX.value; var givn=frm.GIVN.value; var spfx=frm.SPFX.value; var surn=frm.SURN.value; var nsfx=frm.NSFX.value; document.getElementById('NAME').value=generate_name(); document.getElementById('NAME_display').innerHTML=frm.NAME.value; // Married names inherit some NSFX values, but not these nsfx=nsfx.replace(/^(I|II|III|IV|V|VI|Junior|Jr\.?|Senior|Sr\.?)$/i, ''); // Update _MARNM field from _MARNM_SURN field and display it // Be careful of mixing latin/hebrew/etc. character sets. var ip=document.getElementsByTagName('input'); var marnm_id=''; var romn=''; var heb=''; for (var i=0; i<ip.length; i++) { var val=ip[i].value; if (ip[i].id.indexOf("_HEB")==0) heb=val; if (ip[i].id.indexOf("ROMN")==0) romn=val; if (ip[i].id.indexOf("_MARNM")==0) { if (ip[i].id.indexOf("_MARNM_SURN")==0) { var msurn=''; if (val!='') { var lc=lang_class(document.getElementById(ip[i].id).value); if (lang_class(frm.NAME.value)==lc) msurn=trim(npfx+" "+givn+" /"+val+"/ "+nsfx); else if (lc=="hebrew") msurn=heb.replace(/\/.*\//, '/'+val+'/'); else if (lang_class(romn)==lc) msurn=romn.replace(/\/.*\//, '/'+val+'/'); } document.getElementById(marnm_id).value=msurn; document.getElementById(marnm_id+"_display").innerHTML=msurn; } else { marnm_id=ip[i].id; } } } } /** * convert a hidden field to a text box */ var oldName = ""; var manualChange = false; function convertHidden(eid) { var element = document.getElementById(eid); if (element) { if (element.type=="hidden") { // IE doesn't allow changing the "type" of an input field so we'll cludge it ( silly :P) if (IE) { var newInput = document.createElement('input'); newInput.setAttribute("type", "text"); newInput.setAttribute("name", element.Name); newInput.setAttribute("id", element.id); newInput.setAttribute("value", element.value); newInput.setAttribute("onchange", element.onchange); var parent = element.parentNode; parent.replaceChild(newInput, element); element = newInput; } else { element.type="text"; } element.size="40"; oldName = element.value; manualChange = true; var delement = document.getElementById(eid+"_display"); if (delement) { delement.style.display='none'; // force FF ui to update the display if (delement.innerHTML != oldName) { oldName = delement.innerHTML; element.value = oldName; } } } else { manualChange = false; // IE doesn't allow changing the "type" of an input field so we'll cludge it ( silly :P) if (IE) { var newInput = document.createElement('input'); newInput.setAttribute("type", "hidden"); newInput.setAttribute("name", element.Name); newInput.setAttribute("id", element.id); newInput.setAttribute("value", element.value); newInput.setAttribute("onchange", element.onchange); var parent = element.parentNode; parent.replaceChild(newInput, element); element = newInput; } else { element.type="hidden"; } var delement = document.getElementById(eid+"_display"); if (delement) { delement.style.display='inline'; } } } } /** * if the user manually changed the NAME field, then update the textual * HTML representation of it * If the value changed set manualChange to true so that changing * the other fields doesn't change the NAME line */ function updateTextName(eid) { var element = document.getElementById(eid); if (element) { if (element.value!=oldName) manualChange = true; var delement = document.getElementById(eid+"_display"); if (delement) { delement.innerHTML = element.value; } } } function checkform() { var ip=document.getElementsByTagName('input'); for (var i=0; i<ip.length; i++) { // ADD slashes to _HEB and _AKA names if (ip[i].id.indexOf('_AKA')==0 || ip[i].id.indexOf('_HEB')==0 || ip[i].id.indexOf('ROMN')==0) if (ip[i].value.indexOf('/')<0 && ip[i].value!='') ip[i].value=ip[i].value.replace(/([^\s]+)\s*$/, "/$1/"); // Blank out temporary _MARNM_SURN and empty name fields if (ip[i].id.indexOf("_MARNM_SURN")==0 || ip[i].value=='//') ip[i].value=''; // Convert "xxx yyy" and "xxx y yyy" surnames to "xxx,yyy" if ('<?php echo $SURNAME_TRADITION; ?> '=='spanish' || '<?php echo $SURNAME_TRADITION; ?> '=='portuguese') if (ip[i].id.indexOf("SURN")==0) ip[i].value=document.forms[0].SURN.value.replace(/^\s*([^\s,]{2,})\s+([iIyY] +)?([^\s,]{2,})\s*$/, "$1,$3");; } return true; } // If the name isn't initially formed from the components in a standard way, // then don't automatically update it. if (document.getElementById("NAME").value!=generate_name() && document.getElementById("NAME").value!="//") convertHidden("NAME"); //--> </script> <?php }
public function format_first_major_fact($facts, $style) { foreach ($this->getFacts($facts, true) as $event) { // Only display if it has a date or place (or both) if ($event->getDate()->isOK() || !$event->getPlace()->isEmpty()) { switch ($style) { case 1: return '<br><em>' . $event->getLabel() . ' ' . format_fact_date($event, $this, false, false) . ' ' . format_fact_place($event) . '</em>'; case 2: return '<dl><dt class="label">' . $event->getLabel() . '</dt><dd class="field">' . format_fact_date($event, $this, false, false) . ' ' . format_fact_place($event) . '</dd></dl>'; } } } return ''; }
</div> </td> </tr> <?php if (PGV_USER_IS_ADMIN) { echo "<tr><td class=\"descriptionbox ", $TEXT_DIRECTION, " wrap width25\">"; print_help_link("no_update_CHAN_help", "qm", "no_update_CHAN"); echo $pgv_lang["admin_override"], "</td><td class=\"optionbox wrap\">\n"; if ($NO_UPDATE_CHAN) { echo "<input type=\"checkbox\" checked=\"checked\" name=\"preserve_last_changed\" />\n"; } else { echo "<input type=\"checkbox\" name=\"preserve_last_changed\" />\n"; } echo $pgv_lang["no_update_CHAN"], "<br />\n"; $event = new Event(get_sub_record(1, "1 CHAN", "")); echo format_fact_date($event, false, true); echo "</td></tr>\n"; } ?> </table> <br /> <input type="submit" value="<?php echo $pgv_lang["label_add_remote_link"]; ?> " id="btnSubmit" name="btnSubmit" /> </form> <?php echo PGV_JS_START, 'swapComponents("', $controller->form_location, '");', PGV_JS_END; } // autoclose window when update successful if ($success && $EDIT_AUTOCLOSE) {
$f2++; // handle ASSO record if ($event->getTag() == 'ASSO') { print_asso_rela_record($pid, $event->getGedComRecord(), false); continue; } $fact = $event->getTag(); $details = $event->getDetail(); print "<span class=\"details_label\">"; print $event->getLabel(); print "</span> "; $details = $event->getDetail(); if ($details != "Y" && $details != "N") { print PrintReady($details); } echo format_fact_date($event, false, false, $fact, $pid, $person->getGedcomRecord()); //-- print spouse name for marriage events $famid = $event->getFamilyId(); $spouseid = $event->getSpouseId(); if (!empty($spouseid)) { $spouse = Person::getInstance($spouseid); if (!is_null($spouse)) { print " <a href=\"" . encode_url("individual.php?pid={$spouseid}&ged={$GEDCOM}") . "\">"; print PrintReady($spouse->getFullName()); print "</a>"; print " - "; } } if (!empty($famid)) { print "<a href=\"family.php?famid={$famid}\">[" . $pgv_lang["view_family"] . "]</a>\n"; }
function format_first_major_fact($facts, $style) { foreach ($this->getAllFactsByType(explode('|', $facts)) as $event) { // Only display if it has a date or place (or both) if ($event->getDate() || $event->getPlace()) { switch ($style) { case 1: return '<br /><i>' . $event->getLabel() . ' ' . format_fact_date($event) . format_fact_place($event) . '</i>'; case 2: return '<span class="label">' . $event->getLabel() . ':</span> <span class="field">' . format_fact_date($event) . format_fact_place($event) . '</span><br />'; } } } return ''; }