diff options
| author | Greg Roach <fisharebest@gmail.com> | 2015-03-02 14:28:39 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2015-03-02 14:28:39 +0000 |
| commit | f5b60dec5b2008942bb21825ea56f175562be22a (patch) | |
| tree | 600825b85dd5b81cdc2a606a01794198e45fe66a | |
| parent | 841014f17832a30761bc213858413d11cbeca0b7 (diff) | |
| download | webtrees-f5b60dec5b2008942bb21825ea56f175562be22a.tar.gz webtrees-f5b60dec5b2008942bb21825ea56f175562be22a.tar.bz2 webtrees-f5b60dec5b2008942bb21825ea56f175562be22a.zip | |
PSR-1
24 files changed, 223 insertions, 213 deletions
diff --git a/app/Controller/AdvancedSearchController.php b/app/Controller/AdvancedSearchController.php index e4ca49b7d0..7ba2631ccf 100644 --- a/app/Controller/AdvancedSearchController.php +++ b/app/Controller/AdvancedSearchController.php @@ -462,16 +462,12 @@ class AdvancedSearchController extends SearchController { // *:DATE $date = new Date($value); if ($date->isOK()) { - $jd1 = $date->date1->minJD; - if ($date->date2) { - $jd2 = $date->date2->maxJD; - } else { - $jd2 = $date->date1->maxJD; - } + $jd1 = $date->minimumJulianDay(); + $jd2 = $date->maximumJulianDay(); if (!empty($this->plusminus[$i])) { $adjd = $this->plusminus[$i] * 365; - $jd1 = $jd1 - $adjd; - $jd2 = $jd2 + $adjd; + $jd1 -= $adjd; + $jd2 += $adjd; } $sql .= " AND i_d.d_fact=? AND i_d.d_julianday1>=? AND i_d.d_julianday2<=?"; $bind[] = $parts[0]; @@ -482,16 +478,12 @@ class AdvancedSearchController extends SearchController { // FAMS:*:DATE $date = new Date($value); if ($date->isOK()) { - $jd1 = $date->date1->minJD; - if ($date->date2) { - $jd2 = $date->date2->maxJD; - } else { - $jd2 = $date->date1->maxJD; - } + $jd1 = $date->minimumJulianDay(); + $jd2 = $date->maximumJulianDay(); if (!empty($this->plusminus[$i])) { $adjd = $this->plusminus[$i] * 365; - $jd1 = $jd1 - $adjd; - $jd2 = $jd2 + $adjd; + $jd1 -= $adjd; + $jd2 += $adjd; } $sql .= " AND f_d.d_fact=? AND f_d.d_julianday1>=? AND f_d.d_julianday2<=?"; $bind[] = $parts[1]; diff --git a/app/Controller/LifespanController.php b/app/Controller/LifespanController.php index 6af7189101..8586099e2b 100644 --- a/app/Controller/LifespanController.php +++ b/app/Controller/LifespanController.php @@ -167,7 +167,7 @@ class LifespanController extends PageController { // Sort the array in order of birth year uasort($this->people, function(Individual $a, Individual $b) { - return Date::Compare($a->getEstimatedBirthDate(), $b->getEstimatedBirthDate()); + return Date::compare($a->getEstimatedBirthDate(), $b->getEstimatedBirthDate()); }); //If there is people in the array posted back this if occurs if (isset ($this->people[0])) { diff --git a/app/Controller/TimelineController.php b/app/Controller/TimelineController.php index 3a810fb592..6b41f0482b 100644 --- a/app/Controller/TimelineController.php +++ b/app/Controller/TimelineController.php @@ -99,7 +99,7 @@ class TimelineController extends PageController { $this->pidlinks .= 'pids%5B%5D=' . $indi->getXref() . '&'; $bdate = $indi->getBirthDate(); if ($bdate->isOK()) { - $date = new GregorianDate($bdate->MinDate()->minJD); + $date = new GregorianDate($bdate->minimumJulianDay()); $this->birthyears [$indi->getXref()] = $date->y; $this->birthmonths[$indi->getXref()] = max(1, $date->m); $this->birthdays [$indi->getXref()] = max(1, $date->d); @@ -118,7 +118,7 @@ class TimelineController extends PageController { // check for a date $date = $event->getDate(); if ($date->isOK()) { - $date = new GregorianDate($date->MinDate()->minJD); + $date = new GregorianDate($date->minimumJulianDay()); $this->baseyear = min($this->baseyear, $date->y); $this->topyear = max($this->topyear, $date->y); @@ -160,7 +160,7 @@ class TimelineController extends PageController { $desc = $event->getValue(); // check if this is a family fact $gdate = $event->getDate(); - $date = $gdate->MinDate(); + $date = $gdate->minimumDate(); $date = $date->convertToCalendar('gregorian'); $year = $date->y; $month = max(1, $date->m); diff --git a/app/Date.php b/app/Date.php index fefad04eb4..c36e778171 100644 --- a/app/Date.php +++ b/app/Date.php @@ -50,19 +50,19 @@ use Fisharebest\ExtCalendar\GregorianCalendar; */ class Date { /** @var string Optional qualifier, such as BEF, FROM, ABT */ - var $qual1; + private $qual1; /** @var CalendarDate The first (or only) date */ - var $date1; + private $date1; /** @var string Optional qualifier, such as TO, AND*/ - var $qual2; + private $qual2; /** @var CalendarDate Optional second date */ - var $date2; + private $date2; /** @var string ptional text, as included with an INTerpreted date */ - var $text; + private $text; /** * Create a date, from GEDCOM data. @@ -92,7 +92,7 @@ class Date { * When we copy a date object, we need to create copies of * its child objects. */ - function __clone() { + public function __clone() { $this->date1 = clone $this->date1; if (is_object($this->date2)) { $this->date2 = clone $this->date2; @@ -109,7 +109,7 @@ class Date { * @return CalendarDate * @throws \DomainException */ - static function parseDate($date) { + private function parseDate($date) { // Valid calendar escape specified? - use it if (preg_match('/^(@#D(?:GREGORIAN|JULIAN|HEBREW|HIJRI|JALALI|FRENCH R|ROMAN|JALALI)+@) ?(.*)/', $date, $match)) { $cal = $match[1]; @@ -208,7 +208,7 @@ class Date { * * @return string */ - function display($url = false, $date_format = null, $convert_calendars = true) { + public function display($url = false, $date_format = null, $convert_calendars = true) { global $WT_TREE; // Search engines do not get links to the calendar pages @@ -346,7 +346,7 @@ class Date { * * @return CalendarDate */ - function MinDate() { + public function minimumDate() { return $this->date1; } @@ -357,7 +357,7 @@ class Date { * * @return CalendarDate */ - function MaxDate() { + public function maximumDate() { if (is_null($this->date2)) { return $this->date1; } else { @@ -370,10 +370,8 @@ class Date { * * @return integer */ - function MinJD() { - $tmp = $this->MinDate(); - - return $tmp->minJD; + public function minimumJulianDay() { + return $this->minimumDate()->minJD; } /** @@ -381,22 +379,20 @@ class Date { * * @return integer */ - function MaxJD() { - $tmp = $this->MaxDate(); - - return $tmp->maxJD; + public function maximumJulianDay() { + return $this->maximumDate()->maxJD; } /** * Get the middle Julian day number from the GEDCOM date. * - * For a month-only date, this would be somewhere around the 16 day. + * For a month-only date, this would be somewhere around the 16th day. * For a year-only date, this would be somewhere around 1st July. * * @return integer */ - function JD() { - return (int) (($this->MinJD() + $this->MaxJD()) / 2); + public function julianDay() { + return (int) (($this->minimumJulianDay() + $this->maximumJulianDay()) / 2); } /** @@ -410,7 +406,7 @@ class Date { * * @return Date */ - function AddYears($years, $qualifier = '') { + public function addYears($years, $qualifier = '') { $tmp = clone $this; $tmp->date1->y += $years; $tmp->date1->m = 0; @@ -433,14 +429,14 @@ class Date { * @return int|string * @throws \InvalidArgumentException */ - static function getAge(Date $d1, Date $d2 = null, $format = 0) { + public static function getAge(Date $d1, Date $d2 = null, $format = 0) { if ($d2) { - if ($d2->MaxJD() >= $d1->MinJD() && $d2->MinJD() <= $d1->MinJD()) { + if ($d2->maximumJulianDay() >= $d1->minimumJulianDay() && $d2->minimumJulianDay() <= $d1->minimumJulianDay()) { // Overlapping dates - $jd = $d1->MinJD(); + $jd = $d1->minimumJulianDay(); } else { // Non-overlapping dates - $jd = $d2->MinJD(); + $jd = $d2->minimumJulianDay(); } } else { // If second date not specified, use today’s date @@ -450,25 +446,25 @@ class Date { switch ($format) { case 0: // Years - integer only (for statistics, rather than for display) - if ($jd && $d1->MinJD() && $d1->MinJD() <= $jd) { - return $d1->MinDate()->getAge(false, $jd, false); + if ($jd && $d1->minimumJulianDay() && $d1->minimumJulianDay() <= $jd) { + return $d1->minimumDate()->getAge(false, $jd, false); } else { return -1; } case 1: // Days - integer only (for sorting, rather than for display) - if ($jd && $d1->MinJD()) { - return $jd - $d1->MinJD(); + if ($jd && $d1->minimumJulianDay()) { + return $jd - $d1->minimumJulianDay(); } else { return -1; } case 2: // Just years, in local digits, with warning for negative/ - if ($jd && $d1->MinJD()) { - if ($d1->MinJD() > $jd) { + if ($jd && $d1->minimumJulianDay()) { + if ($d1->minimumJulianDay() > $jd) { return '<i class="icon-warning"></i>'; } else { - return I18N::number($d1->MinDate()->getAge(false, $jd)); + return I18N::number($d1->minimumDate()->getAge(false, $jd)); } } else { return ' '; @@ -488,14 +484,14 @@ class Date { * * @return string */ - static function GetAgeGedcom(Date $d1, Date $d2 = null, $warn_on_negative = true) { + public static function GetAgeGedcom(Date $d1, Date $d2 = null, $warn_on_negative = true) { if (is_null($d2)) { return $d1->date1->GetAge(true, WT_CLIENT_JD, $warn_on_negative); } else { // If dates overlap, then can’t calculate age. - if (self::Compare($d1, $d2)) { - return $d1->date1->GetAge(true, $d2->MinJD(), $warn_on_negative); - } elseif (self::Compare($d1, $d2) == 0 && $d1->date1->minJD == $d2->MinJD()) { + if (self::compare($d1, $d2)) { + return $d1->date1->GetAge(true, $d2->minimumJulianDay(), $warn_on_negative); + } elseif (self::compare($d1, $d2) == 0 && $d1->date1->minJD == $d2->minimumJulianDay()) { return '0d'; } else { return ''; @@ -516,34 +512,34 @@ class Date { * * @return integer */ - static function Compare(Date $a, Date $b) { + public static function compare(Date $a, Date $b) { // Get min/max JD for each date. switch ($a->qual1) { case 'BEF': - $amin = $a->MinJD() - 1; + $amin = $a->minimumJulianDay() - 1; $amax = $amin; break; case 'AFT': - $amax = $a->MaxJD() + 1; + $amax = $a->maximumJulianDay() + 1; $amin = $amax; break; default: - $amin = $a->MinJD(); - $amax = $a->MaxJD(); + $amin = $a->minimumJulianDay(); + $amax = $a->maximumJulianDay(); break; } switch ($b->qual1) { case 'BEF': - $bmin = $b->MinJD() - 1; + $bmin = $b->minimumJulianDay() - 1; $bmax = $bmin; break; case 'AFT': - $bmax = $b->MaxJD() + 1; + $bmax = $b->maximumJulianDay() + 1; $bmin = $bmax; break; default: - $bmin = $b->MinJD(); - $bmax = $b->MaxJD(); + $bmin = $b->minimumJulianDay(); + $bmax = $b->maximumJulianDay(); break; } if ($amax < $bmin) { @@ -567,8 +563,8 @@ class Date { * * @return boolean */ - function isOK() { - return $this->MinJD() && $this->MaxJD(); + public function isOK() { + return $this->minimumJulianDay() && $this->maximumJulianDay(); } /** @@ -579,10 +575,10 @@ class Date { * * @return integer */ - function gregorianYear() { + public function gregorianYear() { if ($this->isOK()) { $gregorian_calendar = new GregorianCalendar; - list($year) = $gregorian_calendar->jdToYmd($this->JD()); + list($year) = $gregorian_calendar->jdToYmd($this->julianDay()); return $year; } else { diff --git a/app/Fact.php b/app/Fact.php index a9cbe1f05c..63ae62c1bc 100644 --- a/app/Fact.php +++ b/app/Fact.php @@ -411,7 +411,7 @@ class Fact { public static function compareDate(Fact $a, Fact $b) { if ($a->getDate()->isOK() && $b->getDate()->isOK()) { // If both events have dates, compare by date - $ret = Date::Compare($a->getDate(), $b->getDate()); + $ret = Date::compare($a->getDate(), $b->getDate()); if ($ret == 0) { // If dates are the same, compare by fact type diff --git a/app/Family.php b/app/Family.php index 36c3a272d3..f94aac005d 100644 --- a/app/Family.php +++ b/app/Family.php @@ -207,7 +207,7 @@ class Family extends GedcomRecord { * @return integer */ public static function compareMarrDate(Family $x, Family $y) { - return Date::Compare($x->getMarriageDate(), $y->getMarriageDate()); + return Date::compare($x->getMarriageDate(), $y->getMarriageDate()); } /** @@ -253,7 +253,7 @@ class Family extends GedcomRecord { * @return integer */ public function getMarriageYear() { - return $this->getMarriageDate()->MinDate()->y; + return $this->getMarriageDate()->minimumDate()->y; } /** diff --git a/app/GedcomRecord.php b/app/GedcomRecord.php index 2bf583281d..d8d8e95012 100644 --- a/app/GedcomRecord.php +++ b/app/GedcomRecord.php @@ -1045,7 +1045,7 @@ class GedcomRecord { if ($chan) { // The record does have a CHAN event - $d = $chan->getDate()->MinDate(); + $d = $chan->getDate()->minimumDate(); if (preg_match('/\n3 TIME (\d\d):(\d\d):(\d\d)/', $chan->getGedcom(), $match)) { $t = mktime((int) $match[1], (int) $match[2], (int) $match[3], (int) $d->format('%n'), (int) $d->format('%j'), (int) $d->format('%Y')); } elseif (preg_match('/\n3 TIME (\d\d):(\d\d)/', $chan->getGedcom(), $match)) { diff --git a/app/Individual.php b/app/Individual.php index 73c8071a2e..a24a0b5bf0 100644 --- a/app/Individual.php +++ b/app/Individual.php @@ -229,7 +229,7 @@ class Individual extends GedcomRecord { * @return integer */ public static function compareBirthDate(Individual $x, Individual $y) { - return Date::Compare($x->getEstimatedBirthDate(), $y->getEstimatedBirthDate()); + return Date::compare($x->getEstimatedBirthDate(), $y->getEstimatedBirthDate()); } /** @@ -241,7 +241,7 @@ class Individual extends GedcomRecord { * @return integer */ public static function compareDeathDate(Individual $x, Individual $y) { - return Date::Compare($x->getEstimatedDeathDate(), $y->getEstimatedDeathDate()); + return Date::compare($x->getEstimatedDeathDate(), $y->getEstimatedDeathDate()); } /** @@ -262,7 +262,7 @@ class Individual extends GedcomRecord { if (preg_match_all('/\n2 DATE (.+)/', $this->gedcom, $date_matches)) { foreach ($date_matches[1] as $date_match) { $date = new Date($date_match); - if ($date->isOK() && $date->MaxJD() <= WT_CLIENT_JD - 365 * $MAX_ALIVE_AGE) { + if ($date->isOK() && $date->maximumJulianDay() <= WT_CLIENT_JD - 365 * $MAX_ALIVE_AGE) { return true; } } @@ -282,7 +282,7 @@ class Individual extends GedcomRecord { preg_match_all('/\n2 DATE (.+)/', $parent->gedcom, $date_matches); foreach ($date_matches[1] as $date_match) { $date = new Date($date_match); - if ($date->isOK() && $date->MaxJD() <= WT_CLIENT_JD - 365 * ($MAX_ALIVE_AGE + 45)) { + if ($date->isOK() && $date->maximumJulianDay() <= WT_CLIENT_JD - 365 * ($MAX_ALIVE_AGE + 45)) { return true; } } @@ -295,7 +295,7 @@ class Individual extends GedcomRecord { foreach ($date_matches[1] as $date_match) { $date = new Date($date_match); // Assume marriage occurs after age of 10 - if ($date->isOK() && $date->MaxJD() <= WT_CLIENT_JD - 365 * ($MAX_ALIVE_AGE - 10)) { + if ($date->isOK() && $date->maximumJulianDay() <= WT_CLIENT_JD - 365 * ($MAX_ALIVE_AGE - 10)) { return true; } } @@ -306,7 +306,7 @@ class Individual extends GedcomRecord { foreach ($date_matches[1] as $date_match) { $date = new Date($date_match); // Assume max age difference between spouses of 40 years - if ($date->isOK() && $date->MaxJD() <= WT_CLIENT_JD - 365 * ($MAX_ALIVE_AGE + 40)) { + if ($date->isOK() && $date->maximumJulianDay() <= WT_CLIENT_JD - 365 * ($MAX_ALIVE_AGE + 40)) { return true; } } @@ -317,7 +317,7 @@ class Individual extends GedcomRecord { // Assume children born after age of 15 foreach ($date_matches[1] as $date_match) { $date = new Date($date_match); - if ($date->isOK() && $date->MaxJD() <= WT_CLIENT_JD - 365 * ($MAX_ALIVE_AGE - 15)) { + if ($date->isOK() && $date->maximumJulianDay() <= WT_CLIENT_JD - 365 * ($MAX_ALIVE_AGE - 15)) { return true; } } @@ -328,7 +328,7 @@ class Individual extends GedcomRecord { // Assume grandchildren born after age of 30 foreach ($date_matches[1] as $date_match) { $date = new Date($date_match); - if ($date->isOK() && $date->MaxJD() <= WT_CLIENT_JD - 365 * ($MAX_ALIVE_AGE - 30)) { + if ($date->isOK() && $date->maximumJulianDay() <= WT_CLIENT_JD - 365 * ($MAX_ALIVE_AGE - 30)) { return true; } } @@ -455,7 +455,7 @@ class Individual extends GedcomRecord { * @return string the year of birth */ function getBirthYear() { - return $this->getBirthDate()->MinDate()->format('%Y'); + return $this->getBirthDate()->minimumDate()->format('%Y'); } /** @@ -494,7 +494,7 @@ class Individual extends GedcomRecord { * @return string the year of death */ function getDeathYear() { - return $this->getDeathDate()->MinDate()->format('%Y'); + return $this->getDeathDate()->minimumDate()->format('%Y'); } /** @@ -509,8 +509,8 @@ class Individual extends GedcomRecord { return /* I18N: A range of years, e.g. “1870–”, “1870–1920”, “–1920” */ I18N::translate( '%1$s–%2$s', - '<span title="' . strip_tags($this->getBirthDate()->display()) . '">' . $this->getBirthDate()->MinDate()->format('%Y') . '</span>', - '<span title="' . strip_tags($this->getDeathDate()->display()) . '">' . $this->getDeathDate()->MinDate()->format('%Y') . '</span>' + '<span title="' . strip_tags($this->getBirthDate()->display()) . '">' . $this->getBirthDate()->minimumDate()->format('%Y') . '</span>', + '<span title="' . strip_tags($this->getDeathDate()->display()) . '">' . $this->getDeathDate()->minimumDate()->format('%Y') . '</span>' ); } @@ -595,57 +595,57 @@ class Individual extends GedcomRecord { $min = array(); $max = array(); $tmp = $this->getDeathDate(); - if ($tmp->MinJD()) { - $min[] = $tmp->MinJD() - $this->tree->getPreference('MAX_ALIVE_AGE') * 365; - $max[] = $tmp->MaxJD(); + if ($tmp->isOK()) { + $min[] = $tmp->minimumJulianDay() - $this->tree->getPreference('MAX_ALIVE_AGE') * 365; + $max[] = $tmp->maximumJulianDay(); } foreach ($this->getChildFamilies() as $family) { $tmp = $family->getMarriageDate(); - if (is_object($tmp) && $tmp->MinJD()) { - $min[] = $tmp->MaxJD() - 365 * 1; - $max[] = $tmp->MinJD() + 365 * 30; + if ($tmp->isOK()) { + $min[] = $tmp->maximumJulianDay() - 365 * 1; + $max[] = $tmp->minimumJulianDay() + 365 * 30; } if ($parent = $family->getHusband()) { $tmp = $parent->getBirthDate(); - if (is_object($tmp) && $tmp->MinJD()) { - $min[] = $tmp->MaxJD() + 365 * 15; - $max[] = $tmp->MinJD() + 365 * 65; + if ($tmp->isOK()) { + $min[] = $tmp->maximumJulianDay() + 365 * 15; + $max[] = $tmp->minimumJulianDay() + 365 * 65; } } if ($parent = $family->getWife()) { $tmp = $parent->getBirthDate(); - if (is_object($tmp) && $tmp->MinJD()) { - $min[] = $tmp->MaxJD() + 365 * 15; - $max[] = $tmp->MinJD() + 365 * 45; + if ($tmp->isOK()) { + $min[] = $tmp->maximumJulianDay() + 365 * 15; + $max[] = $tmp->minimumJulianDay() + 365 * 45; } } foreach ($family->getChildren() as $child) { $tmp = $child->getBirthDate(); - if ($tmp->MinJD()) { - $min[] = $tmp->MaxJD() - 365 * 30; - $max[] = $tmp->MinJD() + 365 * 30; + if ($tmp->isOK()) { + $min[] = $tmp->maximumJulianDay() - 365 * 30; + $max[] = $tmp->minimumJulianDay() + 365 * 30; } } } 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 ($tmp->isOK()) { + $min[] = $tmp->maximumJulianDay() - 365 * 45; + $max[] = $tmp->minimumJulianDay() - 365 * 15; } $spouse = $family->getSpouse($this); if ($spouse) { $tmp = $spouse->getBirthDate(); - if ($tmp->MinJD()) { - $min[] = $tmp->MaxJD() - 365 * 25; - $max[] = $tmp->MinJD() + 365 * 25; + if ($tmp->isOK()) { + $min[] = $tmp->maximumJulianDay() - 365 * 25; + $max[] = $tmp->minimumJulianDay() + 365 * 25; } } 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; + if ($tmp->isOK()) { + $min[] = $tmp->maximumJulianDay() - 365 * ($this->getSex() == 'F' ? 45 : 65); + $max[] = $tmp->minimumJulianDay() - 365 * 15; } } } @@ -677,8 +677,8 @@ class Individual extends GedcomRecord { } } if ($this->_getEstimatedDeathDate === null) { - if ($this->getEstimatedBirthDate()->MinJD()) { - $this->_getEstimatedDeathDate = $this->getEstimatedBirthDate()->AddYears($this->tree->getPreference('MAX_ALIVE_AGE'), 'BEF'); + if ($this->getEstimatedBirthDate()->minimumJulianDay()) { + $this->_getEstimatedDeathDate = $this->getEstimatedBirthDate()->addYears($this->tree->getPreference('MAX_ALIVE_AGE'), 'BEF'); } else { $this->_getEstimatedDeathDate = new Date(''); // always return a date object } diff --git a/app/Report/ReportBase.php b/app/Report/ReportBase.php index 201094099e..36877f0667 100644 --- a/app/Report/ReportBase.php +++ b/app/Report/ReportBase.php @@ -1939,7 +1939,7 @@ function ageAtDeathStartHandler() { $death_date = new Date(''); } $value = ''; - if (Date::Compare($birth_date, $death_date) <= 0 || !$person->isDead()) { + if (Date::compare($birth_date, $death_date) <= 0 || !$person->isDead()) { $age = Date::GetAgeGedcom($birth_date, $death_date); // Only show calculated age if it differs from recorded age if ($age != '' && $age != "0d") { @@ -2310,9 +2310,9 @@ function listStartHandler($attrs) { $sql_where .= " AND {$attr}.d_fact='{$match[1]}'"; $date = new Date($match[3]); if ($match[2] == "LTE") { - $sql_where .= " AND {$attr}.d_julianday2<=" . $date->minJD(); + $sql_where .= " AND {$attr}.d_julianday2<=" . $date->minimumJulianDay(); } else { - $sql_where[] = " AND {$attr}.d_julianday1>=" . $date->minJD(); + $sql_where[] = " AND {$attr}.d_julianday1>=" . $date->minimumJulianDay(); } if ($sortby == $match[1]) { $sortby = ""; @@ -2396,9 +2396,9 @@ function listStartHandler($attrs) { $sql_where .= " AND {$attr}.d_fact='{$match[1]}'"; $date = new Date($match[3]); if ($match[2] == "LTE") { - $sql_where .= " AND {$attr}.d_julianday2<=" . $date->minJD(); + $sql_where .= " AND {$attr}.d_julianday2<=" . $date->minimumJulianDay(); } else { - $sql_where .= " AND {$attr}.d_julianday1>=" . $date->minJD(); + $sql_where .= " AND {$attr}.d_julianday1>=" . $date->minimumJulianDay(); } if ($sortby == $match[1]) { $sortby = ""; @@ -2573,7 +2573,7 @@ function listStartHandler($attrs) { if ($t == "DATE") { $date1 = new Date($v); $date2 = new Date($val); - $keep = (Date::Compare($date1, $date2) >= 0); + $keep = (Date::compare($date1, $date2) >= 0); } elseif ($val >= $v) { $keep = true; } @@ -2582,7 +2582,7 @@ function listStartHandler($attrs) { if ($t == "DATE") { $date1 = new Date($v); $date2 = new Date($val); - $keep = (Date::Compare($date1, $date2) <= 0); + $keep = (Date::compare($date1, $date2) <= 0); } elseif ($val >= $v) { $keep = true; } diff --git a/autocomplete.php b/autocomplete.php index 4c73580806..75b43d9181 100644 --- a/autocomplete.php +++ b/autocomplete.php @@ -53,18 +53,18 @@ case 'ASSO': // Associates of an individuals, whose name contains the search ter // Filter for privacy and whether they could be alive at the right time $event_date = Filter::get('extra'); $date = new Date($event_date); - $event_jd = $date->JD(); + $event_jd = $date->julianDay(); foreach ($rows as $row) { $person = Individual::getInstance($row->xref, $row->gedcom_id, $row->gedcom); if ($person->canShow()) { if ($event_jd) { // Exclude individuals who were born after the event. - $person_birth_jd = $person->getEstimatedBirthDate()->minJD(); + $person_birth_jd = $person->getEstimatedBirthDate()->minimumJulianDay(); if ($person_birth_jd && $person_birth_jd > $event_jd) { continue; } // Exclude individuals who died before the event. - $person_death_jd = $person->getEstimatedDeathDate()->MaxJD(); + $person_death_jd = $person->getEstimatedDeathDate()->maximumJulianDay(); if ($person_death_jd && $person_death_jd < $event_jd) { continue; } @@ -72,7 +72,7 @@ case 'ASSO': // Associates of an individuals, whose name contains the search ter // Add the age (if we have it) or the lifespan (if we do not). $label = $person->getFullName(); if ($event_jd && $person->getBirthDate()->isOK()) { - $label .= ', <span class="age">(' . I18N::translate('Age') . ' ' . $person->getBirthDate()->MinDate()->getAge(false, $event_jd) . ')</span>'; + $label .= ', <span class="age">(' . I18N::translate('Age') . ' ' . $person->getBirthDate()->minimumDate()->getAge(false, $event_jd) . ')</span>'; } else { $label .= ', <i>' . $person->getLifeSpan() . '</i>'; } diff --git a/calendar.php b/calendar.php index 0b07baab2a..681e25b409 100644 --- a/calendar.php +++ b/calendar.php @@ -86,10 +86,10 @@ if (preg_match('/^(\d+)-(\d+)$/', $year, $match)) { $year = (-$year) . ' B.C.'; } // need BC to parse date $ged_date = new Date("{$cal} {$day} {$month} {$year}"); - $year = $ged_date->date1->y; // need negative year for year entry field. + $year = $ged_date->minimumDate()->y; // need negative year for year entry field. } } -$cal_date = &$ged_date->date1; +$cal_date = $ged_date->minimumDate(); // Fill in any missing bits with todays date $today = $cal_date->today(); @@ -156,7 +156,7 @@ echo I18N::translate('Day'), '</td><td colspan="3" class="optionbox">'; for ($d = 1; $d <= $days_in_month; $d++) { // Format the day number using the calendar $tmp = new Date($cal_date->format("%@ {$d} %O %E")); - $d_fmt = $tmp->date1->format('%j'); + $d_fmt = $tmp->minimumDate()->format('%j'); if ($d === $cal_date->d) { echo '<span class="error">', $d_fmt, '</span>'; } else { @@ -403,7 +403,7 @@ case 'month': // Fetch events for each day for ($jd = $cal_date->minJD; $jd <= $cal_date->maxJD; ++$jd) { foreach (apply_filter(get_anniversary_events($jd, $events), $filterof, $filtersx) as $fact) { - $tmp = $fact->getDate()->minDate(); + $tmp = $fact->getDate()->minimumDate(); if ($tmp->d >= 1 && $tmp->d <= $tmp->daysInMonth()) { // If the day is valid (for its own calendar), display it in the // anniversary day (for the display calendar). @@ -418,7 +418,7 @@ case 'month': case 'year': $cal_date->m = 0; $cal_date->setJdFromYmd(); - $found_facts = apply_filter(get_calendar_events($ged_date->MinJD(), $ged_date->MaxJD(), $events), $filterof, $filtersx); + $found_facts = apply_filter(get_calendar_events($ged_date->minimumJulianDay(), $ged_date->maximumJulianDay(), $events), $filterof, $filtersx); // Eliminate duplicates (e.g. BET JUL 1900 AND SEP 1900 will appear twice in 1900) $found_facts = array_unique($found_facts); break; @@ -549,7 +549,7 @@ case 'month': } else { // Format the day number using the calendar $tmp = new Date($cal_date->format("%@ {$d} %O %E")); - $d_fmt = $tmp->date1->format('%j'); + $d_fmt = $tmp->minimumDate()->format('%j'); if ($d === $today->d && $cal_date->m === $today->m) { echo '<span class="cal_day current_day">', $d_fmt, '</span>'; } else { diff --git a/edit_interface.php b/edit_interface.php index 5a4550d160..ca8f7346f8 100644 --- a/edit_interface.php +++ b/edit_interface.php @@ -565,7 +565,7 @@ case 'add_child_to_family_action': $done = false; foreach ($family->getFacts('CHIL') as $fact) { $old_child = $fact->getTarget(); - if ($old_child && Date::Compare($new_child->getEstimatedBirthDate(), $old_child->getEstimatedBirthDate()) < 0) { + if ($old_child && Date::compare($new_child->getEstimatedBirthDate(), $old_child->getEstimatedBirthDate()) < 0) { // Insert before this child $family->updateFact($fact->getFactId(), '1 CHIL @' . $new_child->getXref() . "@\n" . $fact->getGedcom(), !$keep_chan); $done = true; @@ -1853,7 +1853,7 @@ case 'reorder_children': foreach ($family->getChildren() as $k=>$child) { $bdate = $child->getEstimatedBirthDate(); if ($bdate->isOK()) { - $sortkey = $bdate->JD(); + $sortkey = $bdate->julianDay(); } else { $sortkey = 1e8; // birth date missing => sort last } diff --git a/includes/functions/functions.php b/includes/functions/functions.php index 2671a7b89a..98a4b541ab 100644 --- a/includes/functions/functions.php +++ b/includes/functions/functions.php @@ -754,12 +754,12 @@ function get_relationship_name_from_path($path, Individual $person1 = null, Indi $dob1 = $person1->getBirthDate(); $dob2 = $person2->getBirthDate(); if ($dob1->isOK() && $dob2->isOK()) { - if (abs($dob1->JD() - $dob2->JD()) < 2 && !$dob1->qual1 && !$dob2->qual1) { + if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->qual1 && !$dob2->qual1) { // Exclude BEF, AFT, etc. return I18N::translate('twin brother'); - } elseif ($dob1->MaxJD() < $dob2->MinJD()) { + } elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) { return I18N::translate('younger brother'); - } elseif ($dob1->MinJD() > $dob2->MaxJD()) { + } elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) { return I18N::translate('elder brother'); } } @@ -771,12 +771,12 @@ function get_relationship_name_from_path($path, Individual $person1 = null, Indi $dob1 = $person1->getBirthDate(); $dob2 = $person2->getBirthDate(); if ($dob1->isOK() && $dob2->isOK()) { - if (abs($dob1->JD() - $dob2->JD()) < 2 && !$dob1->qual1 && !$dob2->qual1) { + if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->qual1 && !$dob2->qual1) { // Exclude BEF, AFT, etc. return I18N::translate('twin sister'); - } elseif ($dob1->MaxJD() < $dob2->MinJD()) { + } elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) { return I18N::translate('younger sister'); - } elseif ($dob1->MinJD() > $dob2->MaxJD()) { + } elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) { return I18N::translate('elder sister'); } } @@ -788,12 +788,12 @@ function get_relationship_name_from_path($path, Individual $person1 = null, Indi $dob1 = $person1->getBirthDate(); $dob2 = $person2->getBirthDate(); if ($dob1->isOK() && $dob2->isOK()) { - if (abs($dob1->JD() - $dob2->JD()) < 2 && !$dob1->qual1 && !$dob2->qual1) { + if (abs($dob1->julianDay() - $dob2->julianDay()) < 2 && !$dob1->qual1 && !$dob2->qual1) { // Exclude BEF, AFT, etc. return I18N::translate('twin sibling'); - } elseif ($dob1->MaxJD() < $dob2->MinJD()) { + } elseif ($dob1->maximumJulianDay() < $dob2->minimumJulianDay()) { return I18N::translate('younger sibling'); - } elseif ($dob1->MinJD() > $dob2->MaxJD()) { + } elseif ($dob1->minimumJulianDay() > $dob2->maximumJulianDay()) { return I18N::translate('elder sibling'); } } diff --git a/includes/functions/functions_charts.php b/includes/functions/functions_charts.php index 1c5611dc6a..68f17415f4 100644 --- a/includes/functions/functions_charts.php +++ b/includes/functions/functions_charts.php @@ -375,10 +375,10 @@ function print_family_children(Family $family, $childid = '', $sosa = 0, $label $div = $famids[$f]->getFirstFact('DIV'); if ($marr) { // marriage date - echo $marr->getDate()->minDate()->format('%Y'); + echo $marr->getDate()->minimumDate()->format('%Y'); // divorce date if ($div) { - echo '–', $div->getDate()->minDate()->format('%Y'); + echo '–', $div->getDate()->minimumDate()->format('%Y'); } } echo "<br><img width=\"100%\" class=\"line5\" height=\"3\" src=\"" . Theme::theme()->parameter('image-hline') . "\" alt=\"\">"; diff --git a/includes/functions/functions_db.php b/includes/functions/functions_db.php index 68a5530493..36d9fe5eb9 100644 --- a/includes/functions/functions_db.php +++ b/includes/functions/functions_db.php @@ -909,7 +909,7 @@ function get_anniversary_events($jd, $facts = '', $ged_id = WT_GED_ID) { } $anniv_date = new Date($row->d_type . ' ' . $row->d_day . ' ' . $row->d_month . ' ' . $row->d_year); foreach ($record->getFacts() as $fact) { - if (($fact->getDate()->MinDate() == $anniv_date->MinDate() || $fact->getDate()->MaxDate() == $anniv_date->MinDate()) && $fact->getTag() === $row->d_fact) { + if (($fact->getDate()->minimumDate() == $anniv_date->minimumDate() || $fact->getDate()->maximumDate() == $anniv_date->minimumDate()) && $fact->getTag() === $row->d_fact) { $fact->anniv = $row->d_year === 0 ? 0 : $anniv->y - $row->d_year; $found_facts[] = $fact; } diff --git a/includes/functions/functions_import.php b/includes/functions/functions_import.php index 0f704e2cf7..4e49f9eee8 100644 --- a/includes/functions/functions_import.php +++ b/includes/functions/functions_import.php @@ -873,9 +873,31 @@ function update_dates($xref, $ged_id, $gedrec) { $fact = $tmatch[1]; } $date = new Date($match[2]); - $sql_insert_date->execute(array($date->date1->d, $date->date1->format('%O'), $date->date1->m, $date->date1->y, $date->date1->minJD, $date->date1->maxJD, $fact, $xref, $ged_id, $date->date1->format('%@'))); - if ($date->date2) { - $sql_insert_date->execute(array($date->date2->d, $date->date2->format('%O'), $date->date2->m, $date->date2->y, $date->date2->minJD, $date->date2->maxJD, $fact, $xref, $ged_id, $date->date2->format('%@'))); + $sql_insert_date->execute(array( + $date->minimumDate()->d, + $date->minimumDate()->format('%O'), + $date->minimumDate()->m, + $date->minimumDate()->y, + $date->minimumDate()->minJD, + $date->minimumDate()->maxJD, + $fact, + $xref, + $ged_id, + $date->minimumDate()->format('%@'), + )); + if ($date->minimumDate() !== $date->maximumDate()) { + $sql_insert_date->execute(array( + $date->maximumDate()->d, + $date->maximumDate()->format('%O'), + $date->maximumDate()->m, + $date->maximumDate()->y, + $date->maximumDate()->minJD, + $date->maximumDate()->maxJD, + $fact, + $xref, + $ged_id, + $date->maximumDate()->format('%@'), + )); } } } diff --git a/includes/functions/functions_print.php b/includes/functions/functions_print.php index 3d27fbe1f6..de9be39775 100644 --- a/includes/functions/functions_print.php +++ b/includes/functions/functions_print.php @@ -308,7 +308,7 @@ function format_parents_age(Individual $person, Date $birth_date) { switch ($parent->getSex()) { case 'F': // Highlight mothers who die in childbirth or shortly afterwards - if ($deatdate->isOK() && $deatdate->MinJD() < $birth_date->MinJD() + 90) { + if ($deatdate->isOK() && $deatdate->MinJD() < $birth_date->minimumJulianDay() + 90) { $html .= ' <span title="' . WT_Gedcom_Tag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>'; } else { $html .= ' <span title="' . I18N::translate('Mother’s age') . '">' . $sex . $age . '</span>'; @@ -316,7 +316,7 @@ function format_parents_age(Individual $person, Date $birth_date) { break; case 'M': // Highlight fathers who die before the birth - if ($deatdate->isOK() && $deatdate->MinJD() < $birth_date->MinJD()) { + if ($deatdate->isOK() && $deatdate->MinJD() < $birth_date->minimumJulianDay()) { $html .= ' <span title="' . WT_Gedcom_Tag::getLabel('_DEAT_PARE', $parent) . '" class="parentdeath">' . $sex . $age . '</span>'; } else { $html .= ' <span title="' . I18N::translate('Father’s age') . '">' . $sex . $age . '</span>'; @@ -393,7 +393,7 @@ function format_fact_date(Fact $event, GedcomRecord $record, $anchor, $time) { $death_date = new Date(''); } $ageText = ''; - if ((Date::Compare($date, $death_date) <= 0 || !$record->isDead()) || $fact == 'DEAT') { + if ((Date::compare($date, $death_date) <= 0 || !$record->isDead()) || $fact == 'DEAT') { // Before death, print age $age = Date::GetAgeGedcom($birth_date, $date); // Only show calculated age if it differs from recorded age @@ -410,7 +410,7 @@ function format_fact_date(Fact $event, GedcomRecord $record, $anchor, $time) { } } } - if ($fact != 'DEAT' && Date::Compare($date, $death_date) >= 0) { + if ($fact != 'DEAT' && Date::compare($date, $death_date) >= 0) { // After death, print time since death $age = get_age_at_event(Date::GetAgeGedcom($death_date, $date), true); if ($age != '') { @@ -435,7 +435,7 @@ function format_fact_date(Fact $event, GedcomRecord $record, $anchor, $time) { $birth_date = $indi->getBirthDate(); $death_date = $indi->getDeathDate(); $ageText = ''; - if (Date::Compare($date, $death_date) <= 0) { + if (Date::compare($date, $death_date) <= 0) { $age = Date::GetAgeGedcom($birth_date, $date); // Only show calculated age if it differs from recorded age if ($age != '' && $age > 0) { @@ -605,7 +605,7 @@ function print_add_new_fact($id, $usedfacts, $type) { // TODO use the event class to store/parse the clipboard events if (preg_match('/^2 DATE (.+)/m', $fact['factrec'], $match)) { $tmp = new Date($match[1]); - echo '; ', $tmp->minDate()->format('%Y'); + echo '; ', $tmp->minimumDate()->format('%Y'); } if (preg_match('/^2 PLAC ([^,\n]+)/m', $fact['factrec'], $match)) { echo '; ', $match[1]; diff --git a/includes/functions/functions_print_lists.php b/includes/functions/functions_print_lists.php index 27c47b048e..f73e5e010e 100644 --- a/includes/functions/functions_print_lists.php +++ b/includes/functions/functions_print_lists.php @@ -360,7 +360,7 @@ function format_indi_table($datalist, $option = '') { } $html .= '</td>'; //-- Event date (sortable)hidden by datatables code - $html .= '<td>' . $birth_date->JD() . '</td>'; + $html .= '<td>' . $birth_date->julianDay() . '</td>'; //-- Birth anniversary $html .= '<td>' . Date::getAge($birth_dates[0], null, 2) . '</td>'; //-- Birth place @@ -393,7 +393,7 @@ function format_indi_table($datalist, $option = '') { $death_date = $person->getEstimatedDeathDate(); // Estimated death dates are a fixed number of years after the birth date. // Don't show estimates in the future. - if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES') && $death_date->MinJD() < WT_CLIENT_JD) { + if ($person->getTree()->getPreference('SHOW_EST_LIST_DATES') && $death_date->minimumJulianDay() < WT_CLIENT_JD) { $html .= $death_date->display(true); } elseif ($person->isDead()) { $html .= I18N::translate('yes'); @@ -404,7 +404,7 @@ function format_indi_table($datalist, $option = '') { } $html .= '</td>'; //-- Event date (sortable)hidden by datatables code - $html .= '<td>' . $death_date->JD() . '</td>'; + $html .= '<td>' . $death_date->julianDay() . '</td>'; //-- Death anniversary $html .= '<td>' . Date::getAge($death_dates[0], null, 2) . '</td>'; //-- Age at death @@ -432,7 +432,7 @@ function format_indi_table($datalist, $option = '') { $html .= '<td>' . $person->getSex() . '</td>'; //-- Filtering by birth date $html .= '<td>'; - if (!$person->canShow() || Date::Compare($birth_date, $d100y) > 0) { + if (!$person->canShow() || Date::compare($birth_date, $d100y) > 0) { $html .= 'Y100'; } else { $html .= 'YES'; @@ -441,9 +441,9 @@ function format_indi_table($datalist, $option = '') { //-- Filtering by death date $html .= '<td>'; // Died in last 100 years? Died? Not dead? - if (Date::Compare($death_dates[0], $d100y) > 0) { + if (Date::compare($death_dates[0], $d100y) > 0) { $html .= 'Y100'; - } elseif ($death_dates[0]->minJD() || $person->isDead()) { + } elseif ($death_dates[0]->minimumJulianDay() || $person->isDead()) { $html .= 'YES'; } else { $html .= 'N'; @@ -885,7 +885,7 @@ function format_fam_table($datalist) { //-- Event date (sortable)hidden by datatables code $html .= '<td>'; if ($marriage_dates) { - $html .= $marriage_date->JD(); + $html .= $marriage_date->julianDay(); } else { $html .= 0; } @@ -914,7 +914,7 @@ function format_fam_table($datalist) { if (!$family->canShow() || !$mdate->isOK()) { $html .= 'U'; } else { - if (Date::Compare($mdate, $d100y) > 0) { + if (Date::compare($mdate, $d100y) > 0) { $html .= 'Y100'; } else { $html .= 'YES'; diff --git a/modules_v3/GEDFact_assistant/_CENS/census_3_find.php b/modules_v3/GEDFact_assistant/_CENS/census_3_find.php index 3fb9c6169e..d1a5a3546b 100644 --- a/modules_v3/GEDFact_assistant/_CENS/census_3_find.php +++ b/modules_v3/GEDFact_assistant/_CENS/census_3_find.php @@ -109,7 +109,7 @@ if ($action == "filter") { //-- Build Indi Spouse Family to get marriage Date ---------- foreach ($indi->getSpouseFamilies() as $family) { $marrdate = $family->getMarriageDate(); - $marrdate = ($marrdate->minJD() + $marrdate->maxJD()) / 2; // Julian + $marrdate = ($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2; // Julian $children = $family->getChildren(); } if (!isset($marrdate)) { $marrdate = ""; } @@ -123,9 +123,9 @@ if ($action == "filter") { $chfulln = str_replace('"', "", $chfulln); // Must remove quotes completely here $chfulln = str_replace("@N.N.", "(" . I18N::translate('unknown') . ")", $chfulln); $chfulln = str_replace("@P.N.", "(" . I18N::translate('unknown') . ")", $chfulln); // Child’s Full Name - $chdob = ($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2; // Child’s Date of Birth (Julian) + $chdob = ($child->getBirthDate()->minimumJulianDay() + $child->getBirthDate()->maximumJulianDay()) / 2; // Child’s Date of Birth (Julian) if (!isset($chdob)) { $chdob = ""; } - $chdod = ($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2; // Child’s Date of Death (Julian) + $chdod = ($child->getDeathDate()->minimumJulianDay() + $child->getDeathDate()->maximumJulianDay()) / 2; // Child’s Date of Death (Julian) if (!isset($chdod)) { $chdod = ""; } $chBLD = ($chfulln . ", " . $chdob . ", " . $chdod); array_push($chBLDarray, $chBLD); @@ -149,9 +149,9 @@ if ($action == "filter") { echo "'" . $indi->getSex() . "', "; // gend - Sex echo "'S', "; // cond - Marital Condition echo "'" . $marrdate . "', "; // dom - Date of Marriage - echo "'" . (($indi->getBirthDate()->minJD() + $indi->getBirthDate()->maxJD()) / 2) . "' ,"; // dob - Date of Birth + echo "'" . (($indi->getBirthDate()->minimumJulianDay() + $indi->getBirthDate()->maximumJulianDay()) / 2) . "' ,"; // dob - Date of Birth echo "'" . (1901 - $indi->getbirthyear()) . "' ,"; // ~age~ - Census Date minus YOB (Preliminary) - echo "'" . (($indi->getDeathDate()->minJD() + $indi->getDeathDate()->maxJD()) / 2) . "' ,"; // dod - Date of Death + echo "'" . (($indi->getDeathDate()->minimumJulianDay() + $indi->getDeathDate()->maximumJulianDay()) / 2) . "' ,"; // dod - Date of Death echo "'', "; // occu - Occupation echo "'" . Filter::escapeHtml($indi->getbirthplace()) . "', "; // birthpl - Birthplace echo "'" . $FBP . "', "; // fbirthpl - Father’s Birthplace diff --git a/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php b/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php index c6fed4af6d..5ce9eb4741 100644 --- a/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php +++ b/modules_v3/GEDFact_assistant/_CENS/census_3_search_add.php @@ -105,7 +105,7 @@ namespace Fisharebest\Webtrees; } //-- Parents Husbands Details -------------------------------------- - $married = Date::Compare($censdate, $marrdate); + $married = Date::compare($censdate, $marrdate); $nam = $gparent->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; @@ -184,7 +184,7 @@ namespace Fisharebest\Webtrees; } //-- Wifes Details -------------------------------------- - $married = Date::Compare($censdate, $marrdate); + $married = Date::compare($censdate, $marrdate); $nam = $gparent->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; @@ -268,7 +268,7 @@ namespace Fisharebest\Webtrees; $marrdate = ''; foreach ($child->getSpouseFamilies() as $childfamily) { $marrdate = $childfamily->getMarriageDate(); - $married = Date::Compare($censdate, $marrdate); + $married = Date::compare($censdate, $marrdate); } $nam = $child->getAllNames(); $fulln = strip_tags($nam[0]['full']); @@ -365,7 +365,7 @@ namespace Fisharebest\Webtrees; } //-- Step Husbands Details -------------------------------------- - $married = Date::Compare($censdate, $marrdate); + $married = Date::compare($censdate, $marrdate); $nam = $gparent->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; @@ -451,7 +451,7 @@ namespace Fisharebest\Webtrees; } //-- Step Wifes Details -------------------------------------- - $married = Date::Compare($censdate, $marrdate); + $married = Date::compare($censdate, $marrdate); $nam = $gparent->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; @@ -641,7 +641,7 @@ namespace Fisharebest\Webtrees; } //-- Spouse Husbands Details -------------------------------------- - $married = Date::Compare($censdate, $marrdate); + $married = Date::compare($censdate, $marrdate); $nam = $gparent->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; @@ -731,7 +731,7 @@ namespace Fisharebest\Webtrees; } //-- Spouse Wifes Details -------------------------------------- - $married = Date::Compare($censdate, $marrdate); + $married = Date::compare($censdate, $marrdate); $nam = $gparent->getAllNames(); $fulln = strip_tags($nam[0]['full']); $fulmn = $fulln; @@ -810,7 +810,7 @@ namespace Fisharebest\Webtrees; $marrdate = ''; foreach ($child->getSpouseFamilies() as $childfamily) { $marrdate = $childfamily->getMarriageDate(); - $married = Date::Compare($censdate, $marrdate); + $married = Date::compare($censdate, $marrdate); } // Get Child’s Children @@ -963,8 +963,8 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { foreach ($children as $child) { $chnam = $child->getAllNames(); $chfulln = strip_tags($chnam[0]['full']); - $chdob = $child->getBirthDate()->JD(); - $chdod = $child->getDeathDate()->JD(); + $chdob = $child->getBirthDate()->julianDay(); + $chdod = $child->getDeathDate()->julianDay(); $chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod; array_push($chBLDarray, $chBLD); } @@ -1004,14 +1004,14 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { } $parentlinks .= "'" . $husb->getSex() . "',"; $parentlinks .= "'',"; - $parentlinks .= "'" . $marrdate->JD() . "',"; - $parentlinks .= "'" . $husb->getBirthDate()->JD() . "',"; + $parentlinks .= "'" . $marrdate->julianDay() . "',"; + $parentlinks .= "'" . $husb->getBirthDate()->julianDay() . "',"; if ($husb->getbirthyear() >= 1) { $parentlinks .= "'" . ($censyear - $husb->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $parentlinks .= "''" . ","; // age = Undefined } - $parentlinks .= "'" . $husb->getDeathDate()->JD() . "',"; + $parentlinks .= "'" . $husb->getDeathDate()->julianDay() . "',"; $parentlinks .= "'',"; // occu = Occupation $parentlinks .= "'" . Filter::escapeHtml($husb->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pHusbFBP)) { @@ -1072,15 +1072,15 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $parentlinks .= "'" . $wife->getSex() . "',"; // sex = Gender $parentlinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian) + $parentlinks .= "'" . (($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2) . "',"; // dom = Date of Marriage (Julian) } - $parentlinks .= "'" . (($wife->getBirthDate()->minJD() + $wife->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth + $parentlinks .= "'" . (($wife->getBirthDate()->minimumJulianDay() + $wife->getBirthDate()->maximumJulianDay()) / 2) . "',"; // dob = Date of Birth if ($wife->getbirthyear() >= 1) { $parentlinks .= "'" . ($censyear - $wife->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $parentlinks .= "''" . ","; // age = Undefined } - $parentlinks .= "'" . (($wife->getDeathDate()->minJD() + $wife->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $parentlinks .= "'" . (($wife->getDeathDate()->minimumJulianDay() + $wife->getDeathDate()->maximumJulianDay()) / 2) . "',"; // dod = Date of Death $parentlinks .= "''" . ","; // occu = Occupation $parentlinks .= "'" . Filter::escapeHtml($wife->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pWifeFBP)) { @@ -1120,8 +1120,8 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { foreach ($children as $child) { $chnam = $child->getAllNames(); $chfulln = strip_tags($chnam[0]['full']); - $chdob = $child->getBirthDate()->JD(); - $chdod = $child->getDeathDate()->JD(); + $chdob = $child->getBirthDate()->julianDay(); + $chdod = $child->getDeathDate()->julianDay(); $chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod; array_push($chBLDarray, $chBLD); } @@ -1163,15 +1163,15 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $parentlinks .= "'" . $husb->getSex() . "',"; // sex = Gender $parentlinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian) + $parentlinks .= "'" . (($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2) . "',"; // dom = Date of Marriage (Julian) } - $parentlinks .= "'" . (($husb->getBirthDate()->minJD() + $husb->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth + $parentlinks .= "'" . (($husb->getBirthDate()->minimumJulianDay() + $husb->getBirthDate()->maximumJulianDay()) / 2) . "',"; // dob = Date of Birth if ($husb->getbirthyear() >= 1) { $parentlinks .= "'" . ($censyear - $husb->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $parentlinks .= "''" . ","; // age = Undefined } - $parentlinks .= "'" . (($husb->getDeathDate()->minJD() + $husb->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $parentlinks .= "'" . (($husb->getDeathDate()->minimumJulianDay() + $husb->getDeathDate()->maximumJulianDay()) / 2) . "',"; // dod = Date of Death $parentlinks .= "''" . ","; // occu = Occupation $parentlinks .= "'" . Filter::escapeHtml($husb->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pHusbFBP)) { @@ -1234,15 +1234,15 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $parentlinks .= "'" . $wife->getSex() . "',"; // sex = Gender $parentlinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $parentlinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian) + $parentlinks .= "'" . (($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2) . "',"; // dom = Date of Marriage (Julian) } - $parentlinks .= "'" . (($wife->getBirthDate()->minJD() + $wife->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth + $parentlinks .= "'" . (($wife->getBirthDate()->minimumJulianDay() + $wife->getBirthDate()->maximumJulianDay()) / 2) . "',"; // dob = Date of Birth if ($wife->getbirthyear() >= 1) { $parentlinks .= "'" . ($censyear - $wife->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $parentlinks .= "''" . ","; // age = Undefined } - $parentlinks .= "'" . (($wife->getDeathDate()->minJD() + $wife->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $parentlinks .= "'" . (($wife->getDeathDate()->minimumJulianDay() + $wife->getDeathDate()->maximumJulianDay()) / 2) . "',"; // dod = Date of Death $parentlinks .= "''" . ","; // occu = Occupation $parentlinks .= "'" . Filter::escapeHtml($wife->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pWifeFBP)) { @@ -1281,8 +1281,8 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { foreach ($children as $child) { $chnam = $child->getAllNames(); $chfulln = strip_tags($chnam[0]['full']); // Child’s Full Name - $chdob = $child->getBirthDate()->JD(); // Child’s Date of Birth (Julian) - $chdod = $child->getDeathDate()->JD(); // Child’s Date of Death (Julian) + $chdob = $child->getBirthDate()->julianDay(); // Child’s Date of Birth (Julian) + $chdod = $child->getDeathDate()->julianDay(); // Child’s Date of Death (Julian) $chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod; array_push($chBLDarray, $chBLD); } @@ -1331,15 +1331,15 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $spouselinks .= "'" . $spouse->getSex() . "',"; // sex = Gender $spouselinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $spouselinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; + $spouselinks .= "'" . (($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2) . "',"; } - $spouselinks .= "'" . (($spouse->getBirthDate()->minJD() + $spouse->getBirthDate()->maxJD()) / 2) . "',"; + $spouselinks .= "'" . (($spouse->getBirthDate()->minimumJulianDay() + $spouse->getBirthDate()->maximumJulianDay()) / 2) . "',"; if ($spouse->getbirthyear() >= 1) { $spouselinks .= "'" . ($censyear - $spouse->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $spouselinks .= "''" . ","; // age = Undefined } - $spouselinks .= "'" . (($spouse->getDeathDate()->minJD() + $spouse->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $spouselinks .= "'" . (($spouse->getDeathDate()->minimumJulianDay() + $spouse->getDeathDate()->maximumJulianDay()) / 2) . "',"; // dod = Date of Death $spouselinks .= "''" . ","; // occu = Occupation $spouselinks .= "'" . Filter::escapeHtml($spouse->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($pSpouseFBP)) { @@ -1388,8 +1388,8 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { foreach ($chchildren as $chchild) { $chnam = $chchild->getAllNames(); $chfulln = strip_tags($chnam[0]['full']); // Child’s Full Name - $chdob = $chchild->getBirthDate()->JD(); // Child’s Date of Birth (Julian) - $chdod = $chchild->getDeathDate()->JD(); // Child’s Date of Death (Julian) + $chdob = $chchild->getBirthDate()->julianDay(); // Child’s Date of Birth (Julian) + $chdod = $chchild->getDeathDate()->julianDay(); // Child’s Date of Death (Julian) $chBLD = $chfulln . ', ' . $chdob . ', ' . $chdod; array_push($chBLDarray, $chBLD); } @@ -1431,17 +1431,17 @@ function print_pedigree_person_nav_cens($pid, $currpid, $censyear) { $spouselinks .= "'" . $child->getSex() . "',"; // sex = Gender $spouselinks .= "''" . ","; // cond = Condition (Married etc) if ($marrdate) { - $spouselinks .= "'" . (($marrdate->minJD() + $marrdate->maxJD()) / 2) . "',"; // dom = Date of Marriage (Julian) + $spouselinks .= "'" . (($marrdate->minimumJulianDay() + $marrdate->maximumJulianDay()) / 2) . "',"; // dom = Date of Marriage (Julian) } else { $spouselinks .= "'nm'" . ","; } - $spouselinks .= "'" . (($child->getBirthDate()->minJD() + $child->getBirthDate()->maxJD()) / 2) . "',"; // dob = Date of Birth + $spouselinks .= "'" . (($child->getBirthDate()->minimumJulianDay() + $child->getBirthDate()->maximumJulianDay()) / 2) . "',"; // dob = Date of Birth if ($child->getbirthyear() >= 1) { $spouselinks .= "'" . ($censyear - $child->getbirthyear()) . "',"; // age = Census Year - Year of Birth } else { $spouselinks .= "''" . ","; // age = Undefined } - $spouselinks .= "'" . (($child->getDeathDate()->minJD() + $child->getDeathDate()->maxJD()) / 2) . "',"; // dod = Date of Death + $spouselinks .= "'" . (($child->getDeathDate()->minimumJulianDay() + $child->getDeathDate()->maximumJulianDay()) / 2) . "',"; // dod = Date of Death $spouselinks .= "''" . ","; // occu = Occupation $spouselinks .= "'" . Filter::escapeHtml($child->getBirthPlace()) . "'" . ","; // birthpl = Individuals Birthplace if (isset($ChildFBP)) { diff --git a/modules_v3/personal_facts/module.php b/modules_v3/personal_facts/module.php index a1380ca881..1bd8396b09 100644 --- a/modules_v3/personal_facts/module.php +++ b/modules_v3/personal_facts/module.php @@ -182,7 +182,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { foreach ($spouse->getFacts(WT_EVENTS_DEAT) as $fact) { $fact_date = $fact->getDate(); - if ($fact_date->isOK() && Date::Compare($birt_date, $fact_date) <= 0 && Date::Compare($fact_date, $deat_date) <= 0) { + if ($fact_date->isOK() && Date::compare($birt_date, $fact_date) <= 0 && Date::compare($fact_date, $deat_date) <= 0) { // Convert the event to a close relatives event. $rela_fact = clone($fact); $rela_fact->setTag('_' . $fact->getTag() . '_SPOU'); @@ -254,7 +254,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { foreach ($child->getFacts(WT_EVENTS_BIRT) as $fact) { $sgdate = $fact->getDate(); // Always show _BIRT_CHIL, even if the dates are not known - if ($option == '_CHIL' || $sgdate->isOK() && Date::Compare($birt_date, $sgdate) <= 0 && Date::Compare($sgdate, $deat_date) <= 0) { + if ($option == '_CHIL' || $sgdate->isOK() && Date::compare($birt_date, $sgdate) <= 0 && Date::compare($sgdate, $deat_date) <= 0) { if ($option == '_GCHI' && $relation == 'dau') { // Convert the event to a close relatives event. $rela_fact = clone($fact); @@ -278,7 +278,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { if (strpos($SHOW_RELATIVES_EVENTS, '_DEAT' . str_replace('_HSIB', '_SIBL', $option)) !== false) { foreach ($child->getFacts(WT_EVENTS_DEAT) as $fact) { $sgdate = $fact->getDate(); - if ($sgdate->isOK() && Date::Compare($birt_date, $sgdate) <= 0 && Date::Compare($sgdate, $deat_date) <= 0) { + if ($sgdate->isOK() && Date::compare($birt_date, $sgdate) <= 0 && Date::compare($sgdate, $deat_date) <= 0) { if ($option == '_GCHI' && $relation == 'dau') { // Convert the event to a close relatives event. $rela_fact = clone($fact); @@ -303,7 +303,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { foreach ($child->getSpouseFamilies() as $sfamily) { foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) { $sgdate = $fact->getDate(); - if ($sgdate->isOK() && Date::Compare($birt_date, $sgdate) <= 0 && Date::Compare($sgdate, $deat_date) <= 0) { + if ($sgdate->isOK() && Date::compare($birt_date, $sgdate) <= 0 && Date::compare($sgdate, $deat_date) <= 0) { if ($option == '_GCHI' && $relation == 'dau') { // Convert the event to a close relatives event. $rela_fact = clone($fact); @@ -374,7 +374,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { // add father/mother marriages foreach ($person->getChildFamilies() as $sfamily) { foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) { - if ($fact->getDate()->isOK() && Date::Compare($birt_date, $fact->getDate()) <= 0 && Date::Compare($fact->getDate(), $deat_date) <= 0) { + if ($fact->getDate()->isOK() && Date::compare($birt_date, $fact->getDate()) <= 0 && Date::compare($fact->getDate(), $deat_date) <= 0) { // marriage of parents (to each other) $rela_fact = clone($fact); $rela_fact->setTag('_' . $fact->getTag() . '_FAMC'); @@ -384,7 +384,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { } foreach ($person->getChildStepFamilies() as $sfamily) { foreach ($sfamily->getFacts(WT_EVENTS_MARR) as $fact) { - if ($fact->getDate()->isOK() && Date::Compare($birt_date, $fact->getDate()) <= 0 && Date::Compare($fact->getDate(), $deat_date) <= 0) { + if ($fact->getDate()->isOK() && Date::compare($birt_date, $fact->getDate()) <= 0 && Date::compare($fact->getDate(), $deat_date) <= 0) { // marriage of a parent (to another spouse) // Convert the event to a close relatives event $rela_fact = clone($fact); @@ -400,7 +400,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { foreach ($family->getSpouses() as $parent) { if (strstr($SHOW_RELATIVES_EVENTS, '_DEAT' . ($sosa == 1 ? '_PARE' : '_GPAR'))) { foreach ($parent->getFacts(WT_EVENTS_DEAT) as $fact) { - if ($fact->getDate()->isOK() && Date::Compare($birt_date, $fact->getDate()) <= 0 && Date::Compare($fact->getDate(), $deat_date) <= 0) { + if ($fact->getDate()->isOK() && Date::compare($birt_date, $fact->getDate()) <= 0 && Date::compare($fact->getDate(), $deat_date) <= 0) { switch ($sosa) { case 1: // Convert the event to a close relatives event. @@ -457,7 +457,7 @@ class personal_facts_WT_Module extends Module implements ModuleTabInterface { $fact = new Fact($hist, $person, 'histo'); $sdate = $fact->getDate(); - if ($sdate->isOK() && Date::Compare($birt_date, $sdate) <= 0 && Date::Compare($sdate, $deat_date) <= 0) { + if ($sdate->isOK() && Date::compare($birt_date, $sdate) <= 0 && Date::compare($sdate, $deat_date) <= 0) { $facts[] = $fact; } } diff --git a/modules_v3/relatives/module.php b/modules_v3/relatives/module.php index 9bab72f4f2..7ec1fdf36e 100644 --- a/modules_v3/relatives/module.php +++ b/modules_v3/relatives/module.php @@ -44,7 +44,7 @@ class relatives_WT_Module extends Module implements ModuleTabInterface { */ static function ageDifference(Date $prev, Date $next, $child_number = 0) { if ($prev->isOK() && $next->isOK()) { - $days = $next->MaxJD() - $prev->MinJD(); + $days = $next->maximumJulianDay() - $prev->minimumJulianDay(); if ($days < 0) { // Show warning triangle if dates in reverse order $diff = '<i class="icon-warning"></i> '; diff --git a/modules_v3/todo/module.php b/modules_v3/todo/module.php index 0268612247..d31f93da62 100644 --- a/modules_v3/todo/module.php +++ b/modules_v3/todo/module.php @@ -106,7 +106,7 @@ class todo_WT_Module extends Module implements ModuleBlockInterface { $content .= '<tr>'; //-- Event date (sortable) $content .= '<td>'; //hidden by datables code - $content .= $fact->getDate()->JD(); + $content .= $fact->getDate()->julianDay(); $content .= '</td>'; $content .= '<td class="wrap">' . $fact->getDate()->display() . '</td>'; $content .= '<td class="wrap"><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>'; diff --git a/modules_v3/yahrzeit/module.php b/modules_v3/yahrzeit/module.php index ba4ecea6a4..9c11b10eb9 100644 --- a/modules_v3/yahrzeit/module.php +++ b/modules_v3/yahrzeit/module.php @@ -71,7 +71,7 @@ class yahrzeit_WT_Module extends Module implements ModuleBlockInterface { foreach (get_anniversary_events($jd, 'DEAT _YART') as $fact) { // Exact hebrew dates only $date = $fact->getDate(); - if ($date->MinDate() instanceof JewishDate && $date->MinJD() == $date->MaxJD()) { + if ($date->minimumDate() instanceof JewishDate && $date->minimumJulianDay() == $date->maximumJulianDay()) { $fact->jd = $jd; $yahrzeits[] = $fact; } @@ -177,7 +177,7 @@ class yahrzeit_WT_Module extends Module implements ModuleBlockInterface { // death/yahrzeit event date $content .= '<td>' . $yahrzeit->getDate()->display() . '</td>'; - $content .= '<td>' . $yahrzeit->getDate()->minJD() . '</td>'; // sortable date + $content .= '<td>' . $yahrzeit->getDate()->julianDay() . '</td>'; // sortable date // Anniversary $content .= '<td>' . $yahrzeit->anniv . '</td>'; @@ -194,7 +194,7 @@ class yahrzeit_WT_Module extends Module implements ModuleBlockInterface { } $td = new Date($today->format('%@ %A %O %E')); $content .= '<td>' . $td->display() . '</td>'; - $content .= '<td>' . $td->minJD() . '</td>'; // sortable date + $content .= '<td>' . $td->julianDay() . '</td>'; // sortable date $content .= '</tr>'; } @@ -202,7 +202,7 @@ class yahrzeit_WT_Module extends Module implements ModuleBlockInterface { $content .= '</tbody></table>'; break; - } + } if ($template) { if ($block) { |
