21 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="ID" ColName="tp_ID" RowOrdinal="0" ReadOnly="TRUE" Type="Counter" Name="ID" PrimaryKey="TRUE" DisplayName="ID" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ID" FromBaseType="TRUE"'));
22 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="OWSHIDDENVERSION" ColName="tp_Version" RowOrdinal="0" Hidden="TRUE" ReadOnly="TRUE" Type="Integer" SetAs="owshiddenversion" Name="owshiddenversion" DisplayName="owshiddenversion" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="owshiddenversion" FromBaseType="TRUE"'));
23 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="FSOBJTYPE" Name="FSObjType" DisplaceOnUpgrade="TRUE" ReadOnly="TRUE" Hidden="TRUE" ShowInFileDlg="FALSE" Type="Lookup" DisplayName="Item Type" List="Docs" FieldRef="ID" ShowField="FSType" JoinColName="DoclibRowId" JoinRowOrdinal="0" JoinType="INNER" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="FSObjType" FromBaseType="TRUE"'));
24 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="UNIQUEID" Name="UniqueId" DisplaceOnUpgrade="TRUE" ReadOnly="TRUE" Hidden="TRUE" ShowInFileDlg="FALSE" Type="Lookup" DisplayName="Unique Id" List="Docs" FieldRef="ID" ShowField="UniqueId" JoinColName="DoclibRowId" JoinRowOrdinal="0" JoinType="INNER" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="UniqueId" FromBaseType="TRUE"'));
25 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="CONTENTTYPEID" ColName="tp_ContentTypeId" Sealed="TRUE" Hidden="TRUE" RowOrdinal="0" ReadOnly="TRUE" Type="ContentTypeId" Name="ContentTypeId" DisplaceOnUpgrade="TRUE" DisplayName="Content Type ID" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="ContentTypeId" FromBaseType="TRUE"'));
27 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="METAINFO" Name="MetaInfo" DisplaceOnUpgrade="TRUE" Hidden="TRUE" ShowInFileDlg="FALSE" Type="Lookup" DisplayName="Property Bag" List="Docs" FieldRef="ID" ShowField="MetaInfo" JoinColName="DoclibRowId" JoinType="INNER" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="MetaInfo" FromBaseType="TRUE"'));
29 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="PERMMASK" Name="PermMask" DisplaceOnUpgrade="TRUE" ReadOnly="TRUE" Hidden="TRUE" RenderXMLUsingPattern="TRUE" ShowInFileDlg="FALSE" Type="Computed" DisplayName="Effective Permissions Mask" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="PermMask" FromBaseType="TRUE"'));
31 $obField->addChild($obFieldRefs =
new CXMLCreator(
'FieldRefs'));
34 $obField->addChild($obDisplayPattern =
new CXMLCreator(
'DisplayPattern'));
35 $obDisplayPattern->addChild(
new CXMLCreator(
'CurrentRights'));
38 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" DisplayName="Title" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" FromBaseType="TRUE" ColName="nvarchar1"'));
40 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="LOCATION" Type="Text" Name="Location" DisplayName="Location" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Location" ColName="nvarchar3"'));
42 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field Type="Note" ID="DESCRIPTION" Name="Description" RichText="TRUE" DisplayName="Description" Sortable="FALSE" Sealed="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Description" ColName="ntext2"'));
43 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="MODIFIED" ColName="tp_Modified" RowOrdinal="0" ReadOnly="TRUE" Type="DateTime" Name="Modified" DisplayName="Modified" StorageTZ="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Modified" FromBaseType="TRUE"'));
44 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="AUTHOR" ColName="tp_Author" RowOrdinal="0" ReadOnly="TRUE" Type="User" List="UserInfo" Name="Author" DisplayName="Created By" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Author" FromBaseType="TRUE"'));
46 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="EDITOR" ColName="tp_Editor" RowOrdinal="0" ReadOnly="TRUE" Type="User" List="UserInfo" Name="Editor" DisplayName="Modified By" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Editor" FromBaseType="TRUE" '));
48 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field Type="DateTime" ID="DATE_FROM" Name="EventDate" DisplayName="Start Time" Format="DateTime" Sealed="TRUE" Required="TRUE" FromBaseType="TRUE" Filterable="FALSE" FilterableNoRecurrence="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="EventDate" ColName="datetime1"'));
50 $obField->addChild($obFieldRefs =
new CXMLCreator(
'FieldRefs'));
54 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="DATE_TO" Type="DateTime" Name="EndDate" DisplayName="End Time" Format="DateTime" Sealed="TRUE" Required="TRUE" Filterable="FALSE" FilterableNoRecurrence="FALSE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="EndDate" ColName="datetime2"'));
56 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="DURATION" Type="Integer" Name="Duration" DisplayName="Duration" Hidden="TRUE" Sealed="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Duration" ColName="int2"'));
58 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="ALLDAYEVENT" Type="AllDayEvent" Name="fAllDayEvent" DisplaceOnUpgrade="TRUE" DisplayName="All Day Event" Sealed="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="fAllDayEvent" ColName="bit1"'));
60 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="EVENTTYPE" Type="Integer" Name="EventType" DisplayName="Event Type" Sealed="TRUE" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="EventType" ColName="int1"'));
62 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="UID" Type="Guid" Name="UID" DisplayName="UID" Sealed="TRUE" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="UID" ColName="uniqueidentifier1"'));
64 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="RECURENCE_DATA" Type="Note" Name="RecurrenceData" DisplayName="RecurrenceData" Hidden="TRUE" Sealed="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="RecurrenceData" ColName="ntext3"'));
66 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="TIMEZONE" Type="Integer" Name="TimeZone" DisplayName="TimeZone" Sealed="TRUE" Hidden="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="TimeZone" ColName="int3"'));
68 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="XMLTZONE" Type="Note" Name="XMLTZone" DisplayName="XMLTZone" Hidden="TRUE" Sealed="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="XMLTZone" ColName="ntext4"'));
70 $obFields->addChild($obField =
CXMLCreator::createTagAttributed(
'Field ID="RECURRENCE" Type="Recurrence" Name="fRecurrence" DisplayName="Recurrence" Title="Recurrence" Sealed="TRUE" NoEditFormBreak="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="fRecurrence" ColName="bit2"'));
72 $obField->addChild($obFieldRefs =
new CXMLCreator(
'FieldRefs'));
178 $first_week_day = COption::GetOptionString(
'calendar',
'week_start',
'MO');
179 $first_week_day = mb_strtolower($first_week_day);
182 if ($last_change < $change)
184 $last_change = $change;
187 $bRecurrent = (isset(
$event[
'RRULE']) &&
$event[
'RRULE'] !=
"") ? 1 : 0;
188 $rrule = CCalendarEvent::ParseRRULE(
$event[
'RRULE']);
190 $bAllDay =
$event[
'DT_SKIP_TIME'] !==
'N' ? 1 : 0;
191 $ts_start = CCalendar::Timestamp(
$event[
'DATE_FROM'],
false, !$bAllDay);
192 $ts_finish = CCalendar::Timestamp(
$event[
'DATE_TO'],
false, !$bAllDay);
195 $ts_start -=
$event[
'~USER_OFFSET_FROM'];
196 $ts_finish -=
$event[
'~USER_OFFSET_FROM'];
199 $TZBias = (int)date(
'Z');
200 $duration =
$event[
'DT_LENGTH'];
206 if (!$bAllDay || defined(
'OLD_OUTLOOK_VERSION'))
208 $ts_start =
$event[
'DATE_FROM_TS_UTC'];
209 $ts_finish =
$event[
'DATE_TO_TS_UTC'];
213 $obRow->setAttribute(
'ows_ID',
$event[
'ID']);
215 $version =
$event[
'VERSION'] ?: 1;
216 $obRow->setAttribute(
'ows_Attachments', 0);
217 $obRow->setAttribute(
'ows_owshiddenversion', $version);
218 $obRow->setAttribute(
'ows_MetaInfo_vti_versionhistory', md5(
$event[
'ID']).
':'.$version);
233 $obRow->setAttribute(
'ows_MetaInfo_BusyStatus',
$status ?? -1);
236 $obRow->setAttribute(
'ows_Modified', $this->
__makeDateTime($change - $TZBias));
237 $obRow->setAttribute(
'ows_EventType', $bRecurrent ? 1 : 0);
238 $obRow->setAttribute(
'ows_Location', CCalendar::GetTextLocation(
$event[
'LOCATION']));
239 $obRow->setAttribute(
'ows_Description',
$event[
'~DESCRIPTION']);
240 $obRow->setAttribute(
'ows_EventDate', $this->
__makeDateTime($ts_start));
243 $obRow->setAttribute(
'ows_fAllDayEvent', $bAllDay);
246 $obRow->setAttribute(
'ows_fRecurrence', $bRecurrent);
251 $obRow->setAttribute(
'ows_UID', CIntranetUtils::makeGUID(md5(
$event[
'ID'].
'_'.$change)));
252 $tz_data =
'<timeZoneRule>';
253 $tz_data .=
'<standardBias>'.(-(int)(($TZBias - (date(
'I') ? 3600 : 0)) / 60)).
'</standardBias>';
255 if ($isDaylightSavingTime)
257 $tz_data .=
'<additionalDaylightBias>-60</additionalDaylightBias>';
260 $bUseTransition = COption::GetOptionString(
'intranet',
'tz_transition',
'Y') ===
'Y';
262 if ($bUseTransition && !$isDaylightSavingTime)
264 $transition_standard = COption::GetOptionString(
'intranet',
'tz_transition_standard',
'');
265 if (!$transition_standard)
267 $transition_standard =
'<transitionRule month="10" day="su" weekdayOfMonth="last" /><transitionTime>3:0:0</transitionTime>';
269 $tz_data .=
'<standardDate>'.$transition_standard.
'</standardDate>';
271 $transition_daylight = COption::GetOptionString(
'intranet',
'tz_transition_daylight',
'');
272 if (!$transition_daylight)
274 $transition_daylight =
'<transitionRule month="3" day="su" weekdayOfMonth="last" /><transitionTime>2:0:0</transitionTime>';
276 $tz_data .=
'<daylightDate>'.$transition_daylight.
'</daylightDate>';
279 $tz_data .=
'</timeZoneRule>';
280 $obRow->setAttribute(
'ows_XMLTZone', $tz_data);
282 $recurence_data =
'<recurrence>';
283 $recurence_data .=
'<rule>';
284 $recurence_data .=
'<firstDayOfWeek>'.$first_week_day.
'</firstDayOfWeek>';
286 $recurence_data .=
'<repeat>';
287 switch($rrule[
'FREQ'])
290 $recurence_data .=
'<daily dayFrequency="'.$rrule[
'INTERVAL'].
'" />';
295 foreach ($rrule[
'BYDAY'] as $day)
297 $days .= mb_strtolower($day) .
'="TRUE" ';
299 $recurence_data .=
'<weekly '.$days.
'weekFrequency="'.$rrule[
'INTERVAL'].
'" />';
303 $recurence_data .=
'<monthly monthFrequency="'.$rrule[
'INTERVAL'].
'" day="'.date(
'd', $ts_start).
'" />';
307 $recurence_data .=
'<yearly yearFrequency="'.$rrule[
'INTERVAL'].
'" month="'.date(
'm', $ts_start).
'" day="'.date(
'd', $ts_start).
'" />';
310 $recurence_data .=
'</repeat>';
314 $recurence_data .=
'<repeatInstances>'.intval($rrule[
'COUNT']).
'</repeatInstances>';
318 $recurence_data .=
'<windowEnd>'.$this->__makeDateTime(CCalendar::Timestamp($rrule[
'UNTIL'])).
'</windowEnd>';
322 $recurence_data .=
'<repeatForever>FALSE</repeatForever>';
324 $recurence_data .=
'</rule>';
325 $recurence_data .=
'</recurrence>';
327 $obRow->setAttribute(
'ows_RecurrenceData', $recurence_data);
329 $obRow->setAttribute(
'ows_Duration', $duration);
331 $obRow->setAttribute(
'ows_UniqueId',
$event[
'ID'].
';#'.$listName);
332 $obRow->setAttribute(
'ows_FSObjType',
$event[
'ID'].
';#0');
333 $obRow->setAttribute(
'ows_Editor',
$event[
'CREATED_BY'].
';#'.CCalendar::GetUserName(
$event[
'CREATED_BY']));
334 $obRow->setAttribute(
'ows_PermMask',
'0x7fffffffffffffff');
335 $obRow->setAttribute(
'ows_ContentTypeId',
'0x01020005CE290982A58C439E00342702139D1A');
360 if (!$listName_original = CIntranetUtils::checkGUID($listName))
362 return new CSoapFault(
'Data error',
'Wrong GUID - '.$listName);
365 $listName = mb_strtoupper(CIntranetUtils::makeGUID($listName_original));
370 return new CSoapFault(
'List not found',
'List with ' . $listName .
' GUID not found!');
377 $fetchMeetings = $arSection[
'CAL_TYPE'] ===
'user' && CCalendar::GetMeetingSection($arSection[
'OWNER_ID']) == $arSection[
'ID'];
378 $arEvents = CCalendarEvent::GetList(
381 'CAL_TYPE' => $arSection[
'CAL_TYPE'],
382 'OWNER_ID' => $arSection[
'OWNER_ID'],
383 'SECTION' => $arSection[
'ID'],
386 'getUserfields' =>
false,
387 'parseRecursion' =>
false,
388 'fetchAttendees' =>
false,
389 'fetchMeetings' => $fetchMeetings,
396 $data->setAttribute(
'MinTimeBetweenSyncs', 0);
397 $data->setAttribute(
'RecommendedTimeBetweenSyncs', 180);
399 $data->setAttribute(
'EffectivePermMask',
'FullMask');
403 if (!$changeToken && !defined(
'OLD_OUTLOOK_VERSION'))
411 foreach ($arEvents as
$event)
413 if (
$event[
'DELETED'] !==
'N' || (
$event[
'IS_MEETING'] &&
$event[
'MEETING_STATUS'] ===
'N'))
416 $obId->setAttribute(
'ChangeType',
'Delete');
417 $obId->setData(
$event[
'ID']);
418 $obChanges->addChild($obId);
420 elseif (!$changeToken || $changeToken < CCalendar::Timestamp(
$event[
'TIMESTAMP_X'],
false))
422 $obData->addChild($this->
__getRow($event, $listName, $last_change));
427 $last_change = time();
428 $obData->setAttribute(
'ItemCount',
$count);
430 $data->setAttribute(
'xmlns:rs',
'urn:schemas-microsoft-com:rowset');
431 $data->setAttribute(
'xmlns:z',
'#RowsetSchema');
433 if ($last_change > 0)
435 $obChanges->setAttribute(
'LastChangeToken', $last_change);
438 CCalendar::SaveMultipleSyncDate(
$userId,
'outlook', $arSection[
'ID']);
440 return array(
'GetListItemChangesSinceTokenResult' =>
$data);
450 if (!$listName_original = CIntranetUtils::checkGUID($listName))
452 return new CSoapFault(
'Data error',
'Wrong GUID - ' . $listName);
457 $listName = mb_strtoupper(CIntranetUtils::makeGUID($listName_original));
461 return new CSoapFault(
463 'List with ' . $listName .
' GUID not found'
469 $bGroup = $arSection[
'CAL_TYPE'] ===
'group';
470 $calType = $arSection[
'CAL_TYPE'];
471 $ownerId = $arSection[
'OWNER_ID'];
475 if (\
Bitrix\Main\Loader::includeModule(
'socialnetwork'))
477 $arGroupTmp = CSocNetGroup::GetByID($arSection[
'SOCNET_GROUP_ID']);
480 ($arGroupTmp[
"CLOSED"] ===
"Y")
481 && COption::GetOptionString(
"socialnetwork",
"work_with_closed_groups",
"N") !==
"Y"
484 return new CSoapFault(
485 'Cannot modify archive group calendar',
486 'Cannot modify archive group calendar'
492 $obBatch = $updates->children[0];
497 $arChanges = $obBatch->children;
501 $responseRows =
array();
502 $replicationId =
array();
504 foreach ($arChanges as $obMethod)
506 $arData =
array(
'_command' => $obMethod->getAttribute(
'Cmd'));
508 foreach ($obMethod->children as $obField)
510 $name = $obField->getAttribute(
'Name');
511 if (
$name ===
'MetaInfo')
513 $name .=
'_' . $obField->getAttribute(
'Property');
516 $arData[
$name] = $obField->content;
519 if ($arData[
'_command'] ===
'Delete')
522 $obRes->setAttribute(
'ID', $obMethod->getAttribute(
'ID').
','.$arData[
'_command']);
523 $obRes->setAttribute(
'List', $listName);
524 $obRes->addChild($obNode =
new CXMLCreator(
'ErrorCode'));
526 $res = CCalendar::DeleteEvent($arData[
'ID']);
529 $obNode->setData(
'0x00000000');
533 $obNode->setData(
'0x81020014');
542 $obResponse->addChild($obRes);
544 elseif ($arData[
'_command'] ===
'New' || $arData[
'_command'] ===
'Update')
546 $arData[
'Location'] = trim($arData[
'Location']);
547 $arData[
'EventType'] = (int)$arData[
'EventType'];
549 if ((
int)$arData[
'EventType'] === 2)
551 $arData[
'EventType'] = 0;
554 if ($arData[
'EventType'] > 2 )
556 return new CSoapFault(
557 'Unsupported event type',
558 'Event type unsupported'
562 $id = $arData[
'_command'] ===
'New' ? 0 : (int)$arData[
'ID'];
564 $arData[
'fRecurrence'] = (int)$arData[
'fRecurrence'];
565 $arData[
'RRULE'] =
'';
567 if (isset($arData[
'EventDate']))
569 $fromTsUTC = $this->
__makeTS($arData[
'EventDate']);
570 if ($arData[
'RecurrenceData'] && $arData[
'fAllDayEvent'])
572 $toTsUTC = $fromTsUTC;
574 elseif (!$arData[
'RecurrenceData'] && $arData[
'fAllDayEvent'])
576 $toTsUTC = $this->
__makeTS($arData[
'EndDate']) - 86340;
580 $toTsUTC = $this->
__makeTS($arData[
'EndDate']);
583 $skipTime = $arData[
'fAllDayEvent'] ?
'Y' :
'N';
584 $fromTs = $fromTsUTC;
589 $fromTs = $toTs = $fromTsUTC = $toTsUTC =
false;
593 if ($arData[
'RecurrenceData'] && isset($arData[
'EventDate']))
595 $xmlstr = $arData[
'RecurrenceData'];
597 $obRecurData->LoadString($xmlstr);
599 $obRecurRule = $obRecurData->tree->children[0]->children[0];
600 $obRecurRepeat = $obRecurRule->children[1];
601 $obNode = $obRecurRepeat->children[0];
603 $arData[
'RRULE'] = [];
604 switch($obNode->name)
608 if ($obNode->getAttribute(
'weekday') ===
'TRUE')
610 $arData[
'RRULE'][
'FREQ'] =
'WEEKLY';
611 $arData[
'RRULE'][
'BYDAY'] =
'MO,TU,WE,TH,FR';
612 $arData[
'RRULE'][
'INTERVAL'] = 1;
616 $arData[
'RRULE'][
'FREQ'] =
'DAILY';
617 $arData[
'RRULE'][
'INTERVAL'] = $obNode->getAttribute(
'dayFrequency');
620 $time_end = strtotime(
621 date(date(
'Y-m-d', $fromTsUTC).
' H:i:s', $toTsUTC)
624 $arData[
'DT_LENGTH'] = $time_end - $fromTsUTC;
628 $arData[
'RRULE'][
'FREQ'] =
'WEEKLY';
629 $arData[
'RRULE'][
'BYDAY'] = [];
631 $arWeekDays = [
'mo',
'tu',
'we',
'th',
'fr',
'sa',
'su'];
632 foreach ($arWeekDays as $day => $value)
634 if ($obNode->getAttribute($value))
636 $arData[
'RRULE'][
'BYDAY'][] = mb_strtoupper($value);
640 $arData[
'RRULE'][
'BYDAY'] = implode(
',', $arData[
'RRULE'][
'BYDAY']);
641 $arData[
'RRULE'][
'INTERVAL'] = $obNode->getAttribute(
'weekFrequency');
643 $time_end = strtotime(date(date(
'Y-m-d', $fromTsUTC).
' H:i:s', $toTsUTC));
645 $arData[
'DT_LENGTH'] = $time_end - $fromTsUTC;
649 $arData[
'RRULE'][
'FREQ'] =
'MONTHLY';
650 $arData[
'RRULE'][
'INTERVAL'] = $obNode->getAttribute(
'monthFrequency');
651 $time_end = strtotime(date(date(
'Y-m', $fromTsUTC).
'-d H:i:s', $toTsUTC));
653 $arData[
'DT_LENGTH'] = $time_end - $fromTsUTC;
657 $arData[
'RRULE'][
'FREQ'] =
'YEARLY';
658 $arData[
'RRULE'][
'INTERVAL'] = $obNode->getAttribute(
'yearFrequency');
660 $time_end = strtotime(date(date(
'Y', $fromTsUTC).
'-m-d H:i:s', $toTsUTC));
662 $arData[
'DT_LENGTH'] = $time_end - $fromTsUTC;
666 if ((
int)$arData[
'DT_LENGTH'] === 0 && isset($arData[
'RRULE'][
'FREQ']))
668 $arData[
'DT_LENGTH'] = 86400;
671 $obWhile = $obRecurRule->children[2];
672 if ($obWhile->name ===
'repeatForever')
676 elseif ($obWhile->name ===
'windowEnd')
678 $toTsUTC = $this->
__makeTS($obWhile->textContent());
679 $arData[
'RRULE'][
'UNTIL'] = ConvertTimeStamp($toTsUTC,
'FULL');
681 elseif ($obWhile->name ===
'repeatInstances')
683 $arData[
'RRULE'][
'COUNT'] = (int)$obWhile->textContent();
686 elseif(($arData[
'fRecurrence'] === -1) && ($id > 0))
688 $arData[
'RRULE'] = -1;
693 'CAL_TYPE' => $calType,
694 'OWNER_ID' => $ownerId,
695 'CREATED_BY' => $ownerId,
696 'NAME' => $arData[
'Title'],
698 'SECTIONS' => [$arSection[
'ID']],
701 'RRULE' => $arData[
'RRULE'],
702 'LOCATION' => Bitrix\Calendar\Rooms\Util::unParseTextLocation($arData[
'Location'])
705 if ($fromTs && $toTs)
707 $arFields[
'DATE_FROM'] = CCalendar::Date($fromTs, $skipTime ===
'N');
708 $arFields[
'DATE_TO'] = CCalendar::Date($toTs, $skipTime ===
'N');
714 if (isset($arData[
'DT_LENGTH']) && $arData[
'DT_LENGTH'] > 0)
716 $arFields[
'DT_LENGTH'] = $arData[
'DT_LENGTH'];
719 $eventId = CCalendar::SaveEvent([
721 'fromWebservice' =>
true
724 if ($eventId && ((
int)$eventId) > 0)
726 $eventId = (int)$eventId;
727 $replicationId[$eventId] = $arData[
'MetaInfo_ReplicationID'];
729 $responseRows[$eventId] =
new CXMLCreator(
'Result');
730 $responseRows[$eventId]->setAttribute(
'ID', $obMethod->getAttribute(
'ID').
','.$arData[
'_command']);
731 $responseRows[$eventId]->setAttribute(
'List', $listName);
733 $responseRows[$eventId]->addChild($obNode =
new CXMLCreator(
'ErrorCode'));
734 $obNode->setData(
'0x00000000');
741 $fetchMeetings = (int)CCalendar::GetMeetingSection(
$userId) === (int)$arSection[
'ID'];
742 $arEvents = CCalendarEvent::GetList([
744 'CAL_TYPE' => $calType,
745 'OWNER_ID' => $ownerId,
746 'SECTION' => $arSection[
'ID']
748 'getUserfields' =>
false,
749 'parseRecursion' =>
false,
750 'fetchAttendees' =>
false,
751 'fetchMeetings' => $fetchMeetings,
755 foreach ($arEvents as
$event)
757 if ($responseRows[
$event[
'ID']])
760 $obRow = $this->
__getRow($event, $listName, $last_change);
761 $obRow->setAttribute(
'xmlns:z',
"#RowsetSchema");
763 if ($replicationId[
$event[
'ID']])
765 $obRow->setAttribute(
'MetaInfo_ReplicationID', $replicationId[
$event[
'ID']]);
768 $responseRows[
$event[
'ID']]->addChild($obRow);
771 $obResponse->addChild($responseRows[
$event[
'ID']]);
774 return [
'UpdateListItemsResult' => $obResponse];