function search_indis_year_range($startyear, $endyear)
{
    // TODO: We should use Julian-days, rather than gregorian years,
    // to allow
    // the lifespan chart, etc., to use other calendars.
    $startjd = GregorianDate::YMDtoJD($startyear, 1, 1);
    $endjd = GregorianDate::YMDtoJD($endyear + 1, 1, 1) - 1;
    return search_indis_daterange($startjd, $endjd, '');
}
Exemple #2
0
 function gregorianYear()
 {
     if ($this->isOK()) {
         list($y) = GregorianDate::JDtoYMD($this->JD());
         return $y;
     } else {
         return 0;
     }
 }
 function getEstimatedBirthDate()
 {
     if (is_null($this->_getEstimatedBirthDate)) {
         foreach ($this->getAllBirthDates() as $date) {
             if ($date->isOK()) {
                 $this->_getEstimatedBirthDate = $date;
                 break;
             }
         }
         if (is_null($this->_getEstimatedBirthDate)) {
             $min = array();
             $max = array();
             $tmp = $this->getDeathDate();
             if ($tmp->MinJD()) {
                 global $MAX_ALIVE_AGE;
                 $min[] = $tmp->MinJD() - $MAX_ALIVE_AGE * 365;
                 $max[] = $tmp->MaxJD();
             }
             foreach ($this->getChildFamilies() as $family) {
                 foreach ($family->getChildren() as $child) {
                     $tmp = $child->getBirthDate();
                     if ($tmp->MinJD()) {
                         $min[] = $tmp->MaxJD() - 365 * ($this->getSex() == 'F' ? 45 : 65);
                         $max[] = $tmp->MinJD() - 365 * 15;
                     }
                 }
             }
             foreach ($this->getSpouseFamilies() as $family) {
                 $tmp = $family->getMarriageDate();
                 if (is_object($tmp) && $tmp->MinJD()) {
                     $min[] = $tmp->MaxJD() - 365 * 45;
                     $max[] = $tmp->MinJD() - 365 * 15;
                 }
                 if ($spouse = $family->getSpouse($this)) {
                     $tmp = $spouse->getBirthDate();
                     if (is_object($tmp) && $tmp->MinJD()) {
                         $min[] = $tmp->MaxJD() - 365 * 25;
                         $max[] = $tmp->MinJD() + 365 * 25;
                     }
                 }
             }
             if ($min && $max) {
                 list($y) = GregorianDate::JDtoYMD(floor((max($min) + min($max)) / 2));
                 $this->_getEstimatedBirthDate = new GedcomDate("EST {$y}");
             } else {
                 $this->_getEstimatedBirthDate = new GedcomDate('');
                 // always return a date object
             }
         }
     }
     return $this->_getEstimatedBirthDate;
 }