本文整理汇总了PHP中CCalendar::GetCurrentOffsetUTC方法的典型用法代码示例。如果您正苦于以下问题:PHP CCalendar::GetCurrentOffsetUTC方法的具体用法?PHP CCalendar::GetCurrentOffsetUTC怎么用?PHP CCalendar::GetCurrentOffsetUTC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCalendar
的用法示例。
在下文中一共展示了CCalendar::GetCurrentOffsetUTC方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UpdateListItems
//.........这里部分代码省略.........
*/
$obRecurRule = $obRecurData->tree->children[0]->children[0];
$obRecurRepeat = $obRecurRule->children[1];
$obNode = $obRecurRepeat->children[0];
$arData['RRULE'] = array();
switch ($obNode->name) {
case 'daily':
// hack. we have no "work days" daily recurence
if ($obNode->getAttribute('weekday') == 'TRUE') {
$arData['RRULE']['FREQ'] = 'WEEKLY';
$arData['RRULE']['BYDAY'] = 'MO,TU,WE,TH,FR';
$arData['RRULE']['INTERVAL'] = 1;
} else {
$arData['RRULE']['FREQ'] = 'DAILY';
$arData['RRULE']['INTERVAL'] = $obNode->getAttribute('dayFrequency');
}
$time_end = strtotime(date(date('Y-m-d', $fromTsUTC) . ' H:i:s', $toTsUTC));
$arData['DT_LENGTH'] = $time_end - $fromTsUTC;
break;
case 'weekly':
$arData['RRULE']['FREQ'] = 'WEEKLY';
$arData['RRULE']['BYDAY'] = '';
$arWeekDays = array('mo', 'tu', 'we', 'th', 'fr', 'sa', 'su');
foreach ($arWeekDays as $day => $value) {
if ($obNode->getAttribute($value)) {
$arData['RRULE']['BYDAY'][] = strtoupper($value);
}
}
$arData['RRULE']['BYDAY'] = implode(',', $arData['RRULE']['BYDAY']);
$arData['RRULE']['INTERVAL'] = $obNode->getAttribute('weekFrequency');
$time_end = strtotime(date(date('Y-m-d', $fromTsUTC) . ' H:i:s', $toTsUTC));
$arData['DT_LENGTH'] = $time_end - $fromTsUTC;
break;
case 'monthly':
$arData['RRULE']['FREQ'] = 'MONTHLY';
$arData['RRULE']['INTERVAL'] = $obNode->getAttribute('monthFrequency');
$time_end = strtotime(date(date('Y-m', $fromTsUTC) . '-d H:i:s', $toTsUTC));
$arData['DT_LENGTH'] = $time_end - $fromTsUTC;
break;
case 'yearly':
$arData['RRULE']['FREQ'] = 'YEARLY';
$arData['RRULE']['INTERVAL'] = $obNode->getAttribute('yearFrequency');
$time_end = strtotime(date(date('Y', $fromTsUTC) . '-m-d H:i:s', $toTsUTC));
$arData['DT_LENGTH'] = $time_end - $fromTsUTC;
break;
}
if ($arData['DT_LENGTH'] == 0 && isset($arData['RRULE']['FREQ'])) {
$arData['DT_LENGTH'] = 86400;
}
$obWhile = $obRecurRule->children[2];
if ($obWhile->name == 'repeatForever') {
$arData['RRULE']['UNTIL'] = MakeTimeStamp('');
} elseif ($obWhile->name == 'windowEnd') {
$toTsUTC = $this->__makeTS($obWhile->textContent());
$arData['RRULE']['UNTIL'] = ConvertTimeStamp($toTsUTC, 'FULL');
}
} elseif ($arData['fRecurrence'] == -1 && $id > 0) {
$arData['RRULE'] = -1;
}
$skipTime = $arData['fAllDayEvent'] ? 'Y' : 'N';
$fromTs = $fromTsUTC;
$toTs = $toTsUTC;
if (!$arData['fAllDayEvent']) {
$fromTs += CCalendar::GetCurrentOffsetUTC($userId);
$toTs += CCalendar::GetCurrentOffsetUTC($userId);
}
// fields
$arFields = array("ID" => $id, 'CAL_TYPE' => $calType, 'OWNER_ID' => $ownerId, 'CREATED_BY' => $userId, 'DATE_FROM' => CCalendar::Date($fromTs, $skipTime == 'N'), 'DATE_TO' => CCalendar::Date($toTs, $skipTime == 'N'), 'DT_SKIP_TIME' => $skipTime, 'NAME' => $arData['Title'], 'DESCRIPTION' => CCalendar::ParseHTMLToBB($arData['Description']), 'SECTIONS' => array($arSection['ID']), 'ACCESSIBILITY' => $arStatusValues[$arData['MetaInfo_BusyStatus']], 'IMPORTANCE' => $arPriorityValues[$arData['MetaInfo_Priority']], 'RRULE' => $arData['RRULE'], 'LOCATION' => CCalendar::UnParseTextLocation($arData['Location']));
if (isset($arData['DT_LENGTH']) && $arData['DT_LENGTH'] > 0) {
$arFields['DT_LENGTH'] = $arData['DT_LENGTH'];
}
$EventID = CCalendar::SaveEvent(array('arFields' => $arFields, 'fromWebservice' => true));
if ($EventID) {
// dirty hack
$arReplicationIDs[$EventID] = $arData['MetaInfo_ReplicationID'];
$arResponseRows[$EventID] = new CXMLCreator('Result');
$arResponseRows[$EventID]->setAttribute('ID', $obMethod->getAttribute('ID') . ',' . $arData['_command']);
$arResponseRows[$EventID]->setAttribute('List', $listName);
$arResponseRows[$EventID]->addChild($obNode = new CXMLCreator('ErrorCode'));
$obNode->setData('0x00000000');
//$arResponseRows[$EventID]->setAttribute('Version', 3);
}
}
}
$userId = is_object($USER) && $USER->GetID() ? $USER->GetID() : 1;
$fetchMeetings = CCalendar::GetMeetingSection($userId) == $arSection['ID'];
$arEvents = CCalendarEvent::GetList(array('arFilter' => array('CAL_TYPE' => $calType, 'OWNER_ID' => $ownerId, 'SECTION' => $arSection['ID']), 'getUserfields' => false, 'parseRecursion' => false, 'fetchAttendees' => false, 'fetchMeetings' => $fetchMeetings, 'userId' => $userId));
foreach ($arEvents as $key => $event) {
if ($arResponseRows[$event['ID']]) {
$obRow = $this->__getRow($event, $listName, $last_change = 0);
$obRow->setAttribute('xmlns:z', "#RowsetSchema");
if ($arReplicationIDs[$event['ID']]) {
$obRow->setAttribute('MetaInfo_ReplicationID', $arReplicationIDs[$event['ID']]);
}
$arResponseRows[$event['ID']]->addChild($obRow);
}
$obResponse->addChild($arResponseRows[$event['ID']]);
}
return array('UpdateListItemsResult' => $obResponse);
}
示例2: GetEventFromToForUser
public static function GetEventFromToForUser($params, $userId)
{
$skipTime = $params['DT_SKIP_TIME'] !== 'N';
$fromTs = CCalendar::Timestamp($params['DATE_FROM'], false, !$skipTime);
$toTs = CCalendar::Timestamp($params['DATE_TO'], false, !$skipTime);
if (!$skipTime) {
$fromTs = $fromTs - (CCalendar::GetTimezoneOffset($params['TZ_FROM']) - CCalendar::GetCurrentOffsetUTC($userId));
$toTs = $toTs - (CCalendar::GetTimezoneOffset($params['TZ_TO']) - CCalendar::GetCurrentOffsetUTC($userId));
}
$dateFrom = CCalendar::Date($fromTs, !$skipTime);
$dateTo = CCalendar::Date($toTs, !$skipTime);
return array("DATE_FROM" => $dateFrom, "DATE_TO" => $dateTo, "TS_FROM" => $fromTs, "TS_TO" => $toTs);
}
示例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();