本文整理汇总了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;
}
示例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;
}