本文整理汇总了PHP中PhabricatorUser::getTimezoneIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorUser::getTimezoneIdentifier方法的具体用法?PHP PhabricatorUser::getTimezoneIdentifier怎么用?PHP PhabricatorUser::getTimezoneIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorUser
的用法示例。
在下文中一共展示了PhabricatorUser::getTimezoneIdentifier方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseLocalTime
public static function parseLocalTime($time, PhabricatorUser $user)
{
$old_zone = date_default_timezone_get();
date_default_timezone_set($user->getTimezoneIdentifier());
$timestamp = (int) strtotime($time, self::getNow());
if ($timestamp <= 0) {
$timestamp = null;
}
date_default_timezone_set($old_zone);
return $timestamp;
}
示例2: getStartDateTimeObjects
private static function getStartDateTimeObjects(PhabricatorUser $user, $start_day_str)
{
$timezone = new DateTimeZone($user->getTimezoneIdentifier());
$today_epoch = PhabricatorTime::parseLocalTime('today', $user);
$today = new DateTime('@' . $today_epoch);
$today->setTimeZone($timezone);
if (strtolower($start_day_str) == 'today' || $today->format('l') == $start_day_str) {
$start_day = clone $today;
} else {
$start_epoch = PhabricatorTime::parseLocalTime('last ' . $start_day_str, $user);
$start_day = new DateTime('@' . $start_epoch);
$start_day->setTimeZone($timezone);
}
return array('today' => $today, 'start_day' => $start_day);
}
示例3: applyViewerTimezone
public function applyViewerTimezone(PhabricatorUser $viewer)
{
$this->viewerTimezone = $viewer->getTimezoneIdentifier();
return $this;
}
示例4: updateEventFromNode
private function updateEventFromNode(PhabricatorUser $actor, PhabricatorCalendarEvent $event, PhutilCalendarEventNode $node)
{
$instance_epoch = $this->getNodeInstanceEpoch($node);
$event->setUTCInstanceEpoch($instance_epoch);
$timezone = $actor->getTimezoneIdentifier();
// TODO: These should be transactional, but the transaction only accepts
// epoch timestamps right now.
$start_datetime = $node->getStartDateTime()->setViewerTimezone($timezone);
$end_datetime = $node->getEndDateTime()->setViewerTimezone($timezone);
$event->setStartDateTime($start_datetime)->setEndDateTime($end_datetime);
$event->setIsAllDay((int) $start_datetime->getIsAllDay());
// TODO: This should be transactional, but the transaction only accepts
// simple frequency rules right now.
$rrule = $node->getRecurrenceRule();
if ($rrule) {
$event->setRecurrenceRule($rrule);
$until_datetime = $rrule->getUntil();
if ($until_datetime) {
$until_datetime->setViewerTimezone($timezone);
$event->setUntilDateTime($until_datetime);
}
$count = $rrule->getCount();
$event->setParameter('recurrenceCount', $count);
}
return $event;
}