/** * Parse the facts from the record */ function parseFacts($nfacts = NULL) { //-- only run this function once if (!is_null($this->facts) && is_array($this->facts)) { return; } $this->facts = array(); //-- don't run this function if privacy does not allow viewing of details if (!$this->canDisplayDetails()) { return; } //-- must trim the record here because the record is trimmed in edit and it could mess up line numbers $this->gedrec = trim($this->gedrec); //-- find all the fact information $indilines = explode("\n", $this->gedrec); // -- find the number of lines in the individuals record $lct = count($indilines); $factrec = ''; // -- complete fact record $line = ''; // -- temporary line buffer $linenum = 1; for ($i = 1; $i <= $lct; $i++) { if ($i < $lct) { $line = $indilines[$i]; } else { $line = ' '; } if (empty($line)) { $line = ' '; } if ($i == $lct || $line[0] == 1) { if ($i > 1) { $event = new Event($factrec, $linenum); $fact = $event->getTag(); if ($nfacts == NULL || !in_array($fact, $nfacts)) { $event->setParentObject($this); $this->facts[] = $event; } } $factrec = $line; $linenum = $i; } else { $factrec .= "\n" . $line; } } }
/** * add historical events to individual facts array * * @return records added to indifacts array * * Historical facts are imported from optional language file : histo.xx.php * where xx is language code * This file should contain records similar to : * * $histo[]="1 EVEN\n2 TYPE History\n2 DATE 11 NOV 1918\n2 NOTE WW1 Armistice"; * $histo[]="1 EVEN\n2 TYPE History\n2 DATE 8 MAY 1945\n2 NOTE WW2 Armistice"; * etc... * */ function add_historical_facts() { global $LANGUAGE, $lang_short_cut; global $SHOW_RELATIVES_EVENTS; if (!$SHOW_RELATIVES_EVENTS) { return; } // Only include events between birth and death $bDate = $this->getEstimatedBirthDate(); $dDate = $this->getEstimatedDeathDate(); if (!$bDate->isOK()) { return; } if ($SHOW_RELATIVES_EVENTS && file_exists('languages/histo.' . $lang_short_cut[$LANGUAGE] . '.php')) { include 'languages/histo.' . $lang_short_cut[$LANGUAGE] . '.php'; foreach ($histo as $indexval => $hrec) { $sdate = new GedcomDate(get_gedcom_value('DATE', 2, $hrec, '', false)); if ($sdate->isOK() && GedcomDate::Compare($this->getEstimatedBirthDate(), $sdate) <= 0 && GedcomDate::Compare($sdate, $this->getEstimatedDeathDate()) <= 0) { $event = new Event($hrec); $event->setParentObject($this); $this->indifacts[] = $event; } } } }