本文整理汇总了PHP中Fisharebest\Webtrees\I18N::defaultCalendar方法的典型用法代码示例。如果您正苦于以下问题:PHP I18N::defaultCalendar方法的具体用法?PHP I18N::defaultCalendar怎么用?PHP I18N::defaultCalendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fisharebest\Webtrees\I18N
的用法示例。
在下文中一共展示了I18N::defaultCalendar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: substr
use Fisharebest\Webtrees\Functions\FunctionsDb;
use Fisharebest\Webtrees\Functions\FunctionsPrint;
define('WT_SCRIPT_NAME', 'calendar.php');
require './includes/session.php';
$CALENDAR_FORMAT = $WT_TREE->getPreference('CALENDAR_FORMAT');
$cal = Filter::get('cal', '@#D[A-Z ]+@');
$day = Filter::get('day', '\\d\\d?');
$month = Filter::get('month', '[A-Z]{3,5}');
$year = Filter::get('year', '\\d{1,4}(?: B\\.C\\.)?|\\d\\d\\d\\d\\/\\d\\d|\\d+(-\\d+|[?]+)?');
$view = Filter::get('view', 'day|month|year', 'day');
$filterev = Filter::get('filterev', '[_A-Z-]+', 'BIRT-MARR-DEAT');
$filterof = Filter::get('filterof', 'all|living|recent', 'all');
$filtersx = Filter::get('filtersx', '[MF]', '');
if ($cal . $day . $month . $year === '') {
// No date specified? Use the most likely calendar
$cal = I18N::defaultCalendar()->gedcomCalendarEscape();
}
// Create a CalendarDate from the parameters
// We cannot display new-style/old-style years, so convert to new style
if (preg_match('/^(\\d\\d)\\d\\d\\/(\\d\\d)$/', $year, $match)) {
$year = $match[1] . $match[2];
}
// advanced-year "year range"
if (preg_match('/^(\\d+)-(\\d+)$/', $year, $match)) {
if (strlen($match[1]) > strlen($match[2])) {
$match[2] = substr($match[1], 0, strlen($match[1]) - strlen($match[2])) . $match[2];
}
$ged_date = new Date("FROM {$cal} {$match[1]} TO {$cal} {$match[2]}");
$view = 'year';
} else {
// advanced-year "decade/century wildcard"
示例2: __construct
/**
* Startup activity
*/
public function __construct()
{
global $WT_TREE;
parent::__construct();
$this->setPageTitle(I18N::translate('Lifespans'));
$this->facts = explode('|', WT_EVENTS_BIRT . '|' . WT_EVENTS_DEAT . '|' . WT_EVENTS_MARR . '|' . WT_EVENTS_DIV);
$tmp = explode('\\', get_class(I18N::defaultCalendar()));
$cal = strtolower(array_pop($tmp));
$this->defaultCalendar = str_replace('calendar', '', $cal);
$filterPids = false;
// Request parameters
$clear = Filter::getBool('clear');
$newpid = Filter::get('newpid', WT_REGEX_XREF);
$addfam = Filter::getBool('addFamily');
$this->place = Filter::get('place');
$this->beginYear = Filter::getInteger('beginYear', 0, PHP_INT_MAX, null);
$this->endYear = Filter::getInteger('endYear', 0, PHP_INT_MAX, null);
$this->calendar = Filter::get('calendar', null, $this->defaultCalendar);
$this->strictDate = Filter::getBool('strictDate');
// Set up base color parameters
$this->colors['M'] = new ColorGenerator(240, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE * -1);
$this->colors['F'] = new ColorGenerator(00, self::SATURATION, self::LIGHTNESS, self::ALPHA, self::RANGE);
// Build a list of people based on the input parameters
if ($clear) {
// Empty list & reset form
$xrefs = array();
$this->place = null;
$this->beginYear = null;
$this->endYear = null;
$this->calendar = $this->defaultCalendar;
} elseif ($this->place) {
// Get all individual & family records found for a place
$this->place_obj = new Place($this->place, $WT_TREE);
$xrefs = Database::prepare("SELECT DISTINCT `i_id` FROM `##placelinks`" . " JOIN `##individuals` ON `pl_gid`=`i_id` AND `pl_file`=`i_file`" . " WHERE `i_file`=:tree_id" . " AND `pl_p_id`=:place_id" . " UNION" . " SELECT DISTINCT `f_id` FROM `##placelinks`" . " JOIN `##families` ON `pl_gid`=`f_id` AND `pl_file`=`f_file`" . " WHERE `f_file`=:tree_id" . " AND `pl_p_id`=:place_id")->execute(array('tree_id' => $WT_TREE->getTreeId(), 'place_id' => $this->place_obj->getPlaceId()))->fetchOneColumn();
} else {
// Modify an existing list of records
$xrefs = Session::get(self::SESSION_DATA, array());
if ($newpid) {
$xrefs = array_merge($xrefs, $this->addFamily(Individual::getInstance($newpid, $WT_TREE), $addfam));
$xrefs = array_unique($xrefs);
} elseif (!$xrefs) {
$xrefs = $this->addFamily($this->getSignificantIndividual(), false);
}
}
$tmp = $this->getCalendarDate(unixtojd());
$this->currentYear = $tmp->today()->y;
$tmp = strtoupper(strtr($this->calendar, array('jewish' => 'hebrew', 'french' => 'french r')));
$this->calendarEscape = sprintf('@#D%s@', $tmp);
if ($xrefs) {
// ensure date ranges are valid in preparation for filtering list
if ($this->beginYear || $this->endYear) {
$filterPids = true;
if (!$this->beginYear) {
$tmp = new Date($this->calendarEscape . ' 1');
$this->beginYear = $tmp->minimumDate()->y;
}
if (!$this->endYear) {
$this->endYear = $this->currentYear;
}
$this->startDate = new Date($this->calendarEscape . $this->beginYear);
$this->endDate = new Date($this->calendarEscape . $this->endYear);
}
// Test each xref to see if the search criteria are met
foreach ($xrefs as $key => $xref) {
$valid = false;
$person = Individual::getInstance($xref, $WT_TREE);
if ($person) {
if ($person->canShow()) {
foreach ($person->getFacts() as $fact) {
if ($this->checkFact($fact)) {
$this->people[] = $person;
$valid = true;
break;
}
}
}
} else {
$family = Family::getInstance($xref, $WT_TREE);
if ($family && $family->canShow() && $this->checkFact($family->getMarriage())) {
$valid = true;
$this->people[] = $family->getHusband();
$this->people[] = $family->getWife();
}
}
if (!$valid) {
unset($xrefs[$key]);
// no point in storing a xref if we can't use it
}
}
Session::put(self::SESSION_DATA, $xrefs);
} else {
Session::forget(self::SESSION_DATA);
}
$this->people = array_filter(array_unique($this->people));
$count = count($this->people);
if ($count) {
// Build the subtitle
//.........这里部分代码省略.........