本文整理汇总了PHP中CCalendar::GetUserTimezoneName方法的典型用法代码示例。如果您正苦于以下问题:PHP CCalendar::GetUserTimezoneName方法的具体用法?PHP CCalendar::GetUserTimezoneName怎么用?PHP CCalendar::GetUserTimezoneName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCalendar
的用法示例。
在下文中一共展示了CCalendar::GetUserTimezoneName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFields
public static function CheckFields(&$arFields, $currentEvent = array(), $userId = false)
{
if (!isset($arFields['TIMESTAMP_X'])) {
$arFields['TIMESTAMP_X'] = CCalendar::Date(mktime(), true, false);
}
if (!$userId) {
$userId = CCalendar::GetCurUserId();
}
$bNew = !isset($arFields['ID']) || $arFields['ID'] <= 0;
if (!isset($arFields['DATE_CREATE']) && $bNew) {
$arFields['DATE_CREATE'] = $arFields['TIMESTAMP_X'];
}
// Skip time
if (isset($arFields['SKIP_TIME'])) {
$arFields['DT_SKIP_TIME'] = $arFields['SKIP_TIME'] ? 'Y' : 'N';
unset($arFields['SKIP_TIME']);
} elseif (isset($arFields['DT_SKIP_TIME']) && $arFields['DT_SKIP_TIME'] != 'Y' && $arFields['DT_SKIP_TIME'] != 'N') {
unset($arFields['DT_SKIP_TIME']);
}
unset($arFields['DT_FROM']);
unset($arFields['DT_TO']);
$arFields['DT_SKIP_TIME'] = $arFields['DT_SKIP_TIME'] !== 'Y' ? 'N' : 'Y';
$fromTs = CCalendar::Timestamp($arFields['DATE_FROM'], false, $arFields['DT_SKIP_TIME'] !== 'Y');
$toTs = CCalendar::Timestamp($arFields['DATE_TO'], false, $arFields['DT_SKIP_TIME'] !== 'Y');
if ($fromTs > $toTs) {
$toTs = $fromTs;
}
$arFields['DATE_FROM'] = CCalendar::Date($fromTs);
$arFields['DATE_TO'] = CCalendar::Date($toTs);
if (!$fromTs) {
$arFields['DATE_FROM'] = FormatDate("SHORT", time());
$fromTs = CCalendar::Timestamp($arFields['DATE_FROM'], false, false);
if (!$toTs) {
$arFields['DATE_TO'] = $arFields['DATE_FROM'];
$toTs = $fromTs;
$arFields['DT_SKIP_TIME'] = 'Y';
}
} elseif (!$toTs) {
$arFields['DATE_TO'] = $arFields['DATE_FROM'];
$toTs = $fromTs;
}
if ($arFields['DT_SKIP_TIME'] !== 'Y') {
$arFields['DT_SKIP_TIME'] = 'N';
if (!isset($arFields['TZ_FROM']) && isset($currentEvent['TZ_FROM'])) {
$arFields['TZ_FROM'] = $currentEvent['TZ_FROM'];
}
if (!isset($arFields['TZ_TO']) && isset($currentEvent['TZ_TO'])) {
$arFields['TZ_TO'] = $currentEvent['TZ_TO'];
}
if (!isset($arFields['TZ_FROM']) && !isset($arFields['TZ_TO'])) {
$userTimezoneOffsetUTC = CCalendar::GetCurrentOffsetUTC($userId);
$userTimezoneName = CCalendar::GetUserTimezoneName($userId);
if (!$userTimezoneName) {
$userTimezoneName = CCalendar::GetGoodTimezoneForOffset($userTimezoneOffsetUTC);
}
$arFields['TZ_FROM'] = $userTimezoneName;
$arFields['TZ_TO'] = $userTimezoneName;
}
if (!isset($arFields['TZ_OFFSET_FROM'])) {
$arFields['TZ_OFFSET_FROM'] = CCalendar::GetTimezoneOffset($arFields['TZ_FROM'], $fromTs);
}
if (!isset($arFields['TZ_OFFSET_TO'])) {
$arFields['TZ_OFFSET_TO'] = CCalendar::GetTimezoneOffset($arFields['TZ_TO'], $toTs);
}
}
if (!isset($arFields['TZ_OFFSET_FROM'])) {
$arFields['TZ_OFFSET_FROM'] = 0;
}
if (!isset($arFields['TZ_OFFSET_TO'])) {
$arFields['TZ_OFFSET_TO'] = 0;
}
if (!isset($arFields['DATE_FROM_TS_UTC'])) {
$arFields['DATE_FROM_TS_UTC'] = $fromTs - $arFields['TZ_OFFSET_FROM'];
}
if (!isset($arFields['DATE_TO_TS_UTC'])) {
$arFields['DATE_TO_TS_UTC'] = $toTs - $arFields['TZ_OFFSET_TO'];
}
$h24 = 60 * 60 * 24;
// 24 hours
if ($arFields['DT_SKIP_TIME'] == 'Y') {
unset($arFields['TZ_FROM']);
unset($arFields['TZ_TO']);
unset($arFields['TZ_OFFSET_FROM']);
unset($arFields['TZ_OFFSET_TO']);
}
// Event length in seconds
if (!isset($arFields['DT_LENGTH']) || $arFields['DT_LENGTH'] == 0) {
if ($fromTs == $toTs && date('H:i', $fromTs) == '00:00' && $arFields['DT_SKIP_TIME'] == 'Y') {
$arFields['DT_LENGTH'] = $h24;
} else {
$arFields['DT_LENGTH'] = intVal($toTs - $fromTs);
if ($arFields['DT_SKIP_TIME'] == "Y") {
// We have dates without times
$arFields['DT_LENGTH'] += $h24;
}
}
}
if (!$arFields['VERSION']) {
$arFields['VERSION'] = 1;
}
//.........这里部分代码省略.........
示例2: htmlspecialcharsEx
echo htmlspecialcharsEx($event['NAME']);
?>
</span></td>
</tr>
<tr>
<td class="bx-cal-view-text-cell-l"><?php
echo GetMessage('EC_DATE');
?>
:</td>
<td class="bx-cal-view-text-cell-r bx-cal-view-from-to">
<span><?php
echo CCalendar::GetFromToHtml($fromTs, $toTs, $event['DT_SKIP_TIME'] == 'Y', $event['DT_LENGTH']);
?>
</span>
<?php
if ($event['DT_SKIP_TIME'] != 'Y' && (intVal($event['~USER_OFFSET_FROM']) !== 0 || intVal($event['~USER_OFFSET_TO']) !== 0 || $event['TZ_FROM'] != $event['TZ_TO'] || $event['TZ_FROM'] !== CCalendar::GetUserTimezoneName($userId))) {
if ($event['TZ_FROM'] == $event['TZ_TO']) {
$timezoneHint = CCalendar::GetFromToHtml(CCalendar::Timestamp($event['DATE_FROM']), CCalendar::Timestamp($event['DATE_TO']), $event['DT_SKIP_TIME'] == 'Y', $event['DT_LENGTH']);
$timezoneHint .= ' (' . $event['TZ_FROM'] . ')';
} else {
$timezoneHint = GetMessage('EC_VIEW_DATE_FROM_TO', array('#DATE_FROM#' => $event['DATE_FROM'] . ' (' . $event['TZ_FROM'] . ')', '#DATE_TO#' => $event['DATE_TO'] . ' (' . $event['TZ_TO'] . ')'));
}
?>
<span id="bxec-view-tz-hint<?php
echo $id;
?>
" data-bx-hint="<?php
echo $timezoneHint;
?>
" class="bx-cal-view-timezon-icon"></span>
<?php
示例3: is_array
}
$arParams['EVENT'] = CCalendarEvent::GetById($arParams['EVENT_ID']);
$arParams["DESTINATION"] = is_array($arParams["DESTINATION"]) && IsModuleInstalled("socialnetwork") ? $arParams["DESTINATION"] : array();
$arParams["DESTINATION"] = array_key_exists("VALUE", $arParams["DESTINATION"]) ? $arParams["DESTINATION"]["VALUE"] : $arParams["DESTINATION"];
if (is_array($arParams["DESTINATION"]['USERS'])) {
$users = array();
foreach ($arParams["DESTINATION"]['USERS'] as $key => $entry) {
if ($entry['isExtranet'] == 'N') {
$users[$key] = $entry;
}
}
$arParams["DESTINATION"]['USERS'] = $users;
}
// Empty destination for new events
if (!$arParams['EVENT_ID']) {
$arParams["DESTINATION"]["SELECTED"] = array();
}
$arResult['TIMEZONE_LIST'] = CCalendar::GetTimezoneList();
$userTimezoneOffsetUTC = CCalendar::GetCurrentOffsetUTC($arParams['CUR_USER']);
$arParams["USER_TIMEZONE_NAME"] = CCalendar::GetUserTimezoneName($arParams['CUR_USER']);
$arParams["USER_TIMEZONE_DEFAULT"] = '';
// We don't have default timezone for this offset for this user
// We will ask him but we should suggest some suitable for his offset
if (!$arParams["USER_TIMEZONE_NAME"]) {
$arParams["USER_TIMEZONE_DEFAULT"] = CCalendar::GetGoodTimezoneForOffset($userTimezoneOffsetUTC);
}
$arParams["MEETING_ROOMS"] = CCalendar::GetMeetingRoomList();
if (count($arParams["MEETING_ROOMS"]) == 0) {
$arParams["MEETING_ROOMS"] = false;
}
$this->IncludeComponentTemplate();