本文整理汇总了PHP中Fisharebest\Webtrees\Date::GetAgeGedcom方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::GetAgeGedcom方法的具体用法?PHP Date::GetAgeGedcom怎么用?PHP Date::GetAgeGedcom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\Date
的用法示例。
在下文中一共展示了Date::GetAgeGedcom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printLifespan
/**
* Print the lifespan of this person
*
* @param type $person
* @param type $is_spouse
* @return string
*/
private function printLifespan($person, $is_spouse = false)
{
$html = '';
$birthdate = $person->getBirthDate();
$deathdate = $person->getDeathdate();
$ageOfdeath = FunctionsDate::getAgeAtEvent(Date::GetAgeGedcom($birthdate, $deathdate), false);
$birthdata = false;
if ($birthdate->isOK() || $person->getBirthPlace() != '') {
$birthdata = true;
$bapm = $person->getFirstFact('BAPM');
$chr = $person->getFirstFact('CHR');
$birt = $person->getFirstFact('BIRT');
if ($birt) {
$html .= $this->printBirthText($person, 'BIRT', $is_spouse);
$html .= $this->printDate($birt);
} else {
if ($bapm || $chr) {
$html .= $this->printBirthText($person, 'BAPM', $is_spouse);
$html .= $bapm ? $this->printDate($bapm) : $this->printDate($chr);
}
}
if ($person->getBirthPlace() != '') {
$html .= $this->printPlace($person->getBirthPlace(), $person->getTree());
}
}
$deathdata = false;
if ($deathdate->isOK() || $person->getDeathPlace() != '') {
$deathdata = true;
if ($birthdata) {
$html .= ' ' . I18N::translate('and ');
$person->getSex() == 'F' ? $html .= I18N::translateContext('FEMALE', 'died') : ($html .= I18N::translateContext('MALE', 'died'));
} else {
$person->getSex() == 'F' ? $html .= '. ' . I18N::translate('She died') : ($html .= '. ' . I18N::translate('He died'));
}
$deat = $person->getFirstFact('DEAT');
if ($deat) {
$html .= $this->printDate($deat);
}
if ($person->getDeathPlace() != '') {
$html .= $this->printPlace($person->getDeathPlace(), $person->getTree());
}
if ($birthdate->isOK() && $deathdate->isOK() && $this->isDateDMY($birt) && $this->isDateDMY($deat)) {
if (Date::getAge($birthdate, $deathdate, 0) < 2) {
$html .= ' ' . I18N::translateContext('age in days/months', 'at the age of %s', $ageOfdeath);
} else {
$html .= ' ' . I18N::translateContext('age in years', 'at the age of %s', $ageOfdeath);
}
}
}
return $html;
}
示例2: printAgeOfDeath
/**
* Print the age at death/bury
* @param type $bfact
* @param type $dfact
* @return string
*/
private function printAgeOfDeath($bfact, $dfact)
{
$bdate = $bfact->getDate();
$ddate = $dfact->getDate();
$html = '';
if ($bdate->isOK() && $ddate->isOK() && $this->isDateDMY($bfact) && $this->isDateDMY($dfact)) {
$ageOfdeath = FunctionsDate::getAgeAtEvent(Date::GetAgeGedcom($bdate, $ddate), false);
if (Date::getAge($bdate, $ddate, 0) < 2) {
$html .= ' ' . I18N::translateContext('age in days/months', 'at the age of %s', $ageOfdeath);
} else {
$html .= ' ' . I18N::translateContext('age in years', 'at the age of %s', $ageOfdeath);
}
}
return $html;
}