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 /includes/functions | |
| parent | 841014f17832a30761bc213858413d11cbeca0b7 (diff) | |
| download | webtrees-f5b60dec5b2008942bb21825ea56f175562be22a.tar.gz webtrees-f5b60dec5b2008942bb21825ea56f175562be22a.tar.bz2 webtrees-f5b60dec5b2008942bb21825ea56f175562be22a.zip | |
PSR-1
Diffstat (limited to 'includes/functions')
| -rw-r--r-- | includes/functions/functions.php | 18 | ||||
| -rw-r--r-- | includes/functions/functions_charts.php | 4 | ||||
| -rw-r--r-- | includes/functions/functions_db.php | 2 | ||||
| -rw-r--r-- | includes/functions/functions_import.php | 28 | ||||
| -rw-r--r-- | includes/functions/functions_print.php | 12 | ||||
| -rw-r--r-- | includes/functions/functions_print_lists.php | 16 |
6 files changed, 51 insertions, 29 deletions
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'; |
