当前位置: 首页>>代码示例>>PHP>>正文


PHP Date::GetAgeGedcom方法代码示例

本文整理汇总了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;
 }
开发者ID:bxbroze,项目名称:webtrees,代码行数:58,代码来源:FancyTreeviewClass.php

示例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;
 }
开发者ID:bxbroze,项目名称:fancy_treeview,代码行数:21,代码来源:FancyTreeviewClass.php


注:本文中的Fisharebest\Webtrees\Date::GetAgeGedcom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。