예제 #1
0
 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     if ($individual->getSex() === 'F') {
         return '';
     } else {
         return (string) Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
     }
 }
 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     if ($individual->getSex() === 'M') {
         return '';
     } else {
         $years = Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
         if ($years > 15) {
             $years -= $years % 5;
         }
         return (string) $years;
     }
 }
예제 #3
0
 /**
  * Generate the likely value of this census column, based on available information.
  *
  * @param Individual      $individual
  * @param Individual|null $head
  *
  * @return string
  */
 public function generate(Individual $individual, Individual $head = null)
 {
     return $individual->getEstimatedBirthDate()->minimumDate()->format('%Y');
 }
예제 #4
0
 /**
  * Static helper function to sort an array of people by birth date
  *
  * @param Individual $x
  * @param Individual $y
  *
  * @return int
  */
 public static function compareBirthDate(Individual $x, Individual $y)
 {
     return Date::compare($x->getEstimatedBirthDate(), $y->getEstimatedBirthDate());
 }
 /**
  * Get any historical events.
  *
  * @param Individual $person
  *
  * @return Fact[]
  */
 private static function historicalFacts(Individual $person)
 {
     $SHOW_RELATIVES_EVENTS = $person->getTree()->getPreference('SHOW_RELATIVES_EVENTS');
     $facts = array();
     if ($SHOW_RELATIVES_EVENTS) {
         // Only include events between birth and death
         $birt_date = $person->getEstimatedBirthDate();
         $deat_date = $person->getEstimatedDeathDate();
         if (file_exists(Site::getPreference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php')) {
             $histo = array();
             require Site::getPreference('INDEX_DIRECTORY') . 'histo.' . WT_LOCALE . '.php';
             foreach ($histo as $hist) {
                 // Earlier versions of the WIKI encouraged people to use HTML entities,
                 // rather than UTF8 encoding.
                 $hist = html_entity_decode($hist, ENT_QUOTES, 'UTF-8');
                 $fact = new Fact($hist, $person, 'histo');
                 $sdate = $fact->getDate();
                 if ($sdate->isOK() && Date::compare($birt_date, $sdate) <= 0 && Date::compare($sdate, $deat_date) <= 0) {
                     $facts[] = $fact;
                 }
             }
         }
     }
     return $facts;
 }
예제 #6
0
 /**
  * Recursive method to add individual to the Sosa table, and flush it regularly
  * @param Individual $indi Individual to add
  * @param int $sosa Individual's sosa
  */
 protected function addNode(Individual $indi, $sosa)
 {
     $birth_year = $indi->getEstimatedBirthDate()->gregorianYear();
     $death_year = $indi->getEstimatedDeathDate()->gregorianYear();
     $this->tmp_sosa_table[] = array('indi' => $indi->getXref(), 'sosa' => $sosa, 'birth_year' => $birth_year, 'death_year' => $death_year);
     $this->flushTmpSosaTable();
     if ($fam = $indi->getPrimaryChildFamily()) {
         if ($husb = $fam->getHusband()) {
             $this->addNode($husb, 2 * $sosa);
         }
         if ($wife = $fam->getWife()) {
             $this->addNode($wife, 2 * $sosa + 1);
         }
     }
 }
 /**
  * Is the individual a child.
  *
  * @param Individual $individual
  *
  * @return bool
  */
 private function isChild(Individual $individual)
 {
     $age = (int) Date::getAge($individual->getEstimatedBirthDate(), $this->date(), 0);
     return $age < $this->age_adult;
 }