當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Date::gregorianYear方法代碼示例

本文整理匯總了PHP中Fisharebest\Webtrees\Date::gregorianYear方法的典型用法代碼示例。如果您正苦於以下問題:PHP Date::gregorianYear方法的具體用法?PHP Date::gregorianYear怎麽用?PHP Date::gregorianYear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Fisharebest\Webtrees\Date的用法示例。


在下文中一共展示了Date::gregorianYear方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: canShowByType

 /**
  * Can this individual be shown?
  *
  * @param int $access_level
  *
  * @return bool
  */
 protected function canShowByType($access_level)
 {
     global $WT_TREE;
     // Dead people...
     if ($this->tree->getPreference('SHOW_DEAD_PEOPLE') >= $access_level && $this->isDead()) {
         $keep_alive = false;
         $KEEP_ALIVE_YEARS_BIRTH = $this->tree->getPreference('KEEP_ALIVE_YEARS_BIRTH');
         if ($KEEP_ALIVE_YEARS_BIRTH) {
             preg_match_all('/\\n1 (?:' . WT_EVENTS_BIRT . ').*(?:\\n[2-9].*)*(?:\\n2 DATE (.+))/', $this->gedcom, $matches, PREG_SET_ORDER);
             foreach ($matches as $match) {
                 $date = new Date($match[1]);
                 if ($date->isOK() && $date->gregorianYear() + $KEEP_ALIVE_YEARS_BIRTH > date('Y')) {
                     $keep_alive = true;
                     break;
                 }
             }
         }
         $KEEP_ALIVE_YEARS_DEATH = $this->tree->getPreference('KEEP_ALIVE_YEARS_DEATH');
         if ($KEEP_ALIVE_YEARS_DEATH) {
             preg_match_all('/\\n1 (?:' . WT_EVENTS_DEAT . ').*(?:\\n[2-9].*)*(?:\\n2 DATE (.+))/', $this->gedcom, $matches, PREG_SET_ORDER);
             foreach ($matches as $match) {
                 $date = new Date($match[1]);
                 if ($date->isOK() && $date->gregorianYear() + $KEEP_ALIVE_YEARS_DEATH > date('Y')) {
                     $keep_alive = true;
                     break;
                 }
             }
         }
         if (!$keep_alive) {
             return true;
         }
     }
     // Consider relationship privacy (unless an admin is applying download restrictions)
     $user_path_length = $this->tree->getUserPreference(Auth::user(), 'RELATIONSHIP_PATH_LENGTH');
     $gedcomid = $this->tree->getUserPreference(Auth::user(), 'gedcomid');
     if ($gedcomid && $user_path_length && $this->tree->getTreeId() == $WT_TREE->getTreeId() && ($access_level = Auth::accessLevel($this->tree))) {
         return self::isRelated($this, $user_path_length);
     }
     // No restriction found - show living people to members only:
     return Auth::PRIV_USER >= $access_level;
 }
開發者ID:bmhm,項目名稱:webtrees,代碼行數:48,代碼來源:Individual.php

示例2: isDateWithinChartsRange

 /**
  * Check whether the date is compatible with the Google Chart range (between 1550 and 2030).
  * 
  * @param Date $date
  * @return boolean
  */
 public static function isDateWithinChartsRange(Date $date)
 {
     return $date->gregorianYear() >= 1550 && $date->gregorianYear() < 2030;
 }
開發者ID:jon48,項目名稱:webtrees-lib,代碼行數:10,代碼來源:FunctionsPrint.php


注:本文中的Fisharebest\Webtrees\Date::gregorianYear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。