當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。