27 $sectionId = $params[
'sectionId'];
30 if ($sectionId && self::$sectionIndex[$sectionId])
32 $sectionList[] = self::$sectionIndex[$sectionId];
36 if ($sectionId !== \CCalendar::TASK_SECTION_ID)
39 'CAL_TYPE' => $entityType,
40 'OWNER_ID' => $entityId
43 if (!is_array($params))
50 $filter[
'ID'] = $sectionId;
53 \CCalendar::SetSilentErrorMode(
true);
54 if (isset($params[
'active']))
56 $filter[
'ACTIVE'] = $params[
'active'] ?
'Y' :
'N';
59 $res = \CCalendarSect::GetList([
'arFilter' => $filter]);
60 \CCalendar::SetSilentErrorMode(
false);
62 foreach($res as $calendar)
64 if ($params[
'skipExchange'] ==
true && $calendar[
'DAV_EXCH_CAL'] <>
'')
70 'ID' => $calendar[
'ID'],
71 '~NAME' => $calendar[
'NAME'],
72 'NAME' => htmlspecialcharsbx($calendar[
'NAME']),
73 'COLOR' => htmlspecialcharsbx($calendar[
'COLOR'])
75 $sectionList[] = $section;
76 self::$sectionIndex[$section[
'ID']] = $section;
80 if (!$sectionId &&
false)
83 if (count($followedSectionIdList) > 0)
85 $followedSectionList = \CCalendarSect::GetList([
'arFilter' => [
86 'CAL_TYPE' => $entityType,
87 'OWNER_ID' => $entityId,
89 'ADDITIONAL_IDS' => $followedSectionIdList
92 foreach($followedSectionList as $calendar)
95 'ID' => $calendar[
'ID'],
96 '~NAME' => $calendar[
'NAME'],
97 'NAME' => htmlspecialcharsbx($calendar[
'NAME']),
98 'COLOR' => htmlspecialcharsbx($calendar[
'COLOR'])
100 $sectionList[] = $section;
101 self::$sectionIndex[$section[
'ID']] = $section;
107 if (\CCalendarSync::isTaskListSyncEnabled() && $entityType ==
'user' && ($sectionId === \CCalendar::TASK_SECTION_ID || !$sectionId))
110 $taskSectionTitle = (isset($sectionsUserData[
'tasks']) && !empty($sectionsUserData[
'tasks'][
'name']))
111 ? $sectionsUserData[
'tasks'][
'name']
112 : \Bitrix\Main\Localization\Loc::getMessage(
'EC_MY_TASKS');
115 'ID' => \CCalendar::TASK_SECTION_ID,
116 '~NAME' => $taskSectionTitle,
117 'NAME' => htmlspecialcharsbx($taskSectionTitle),
118 'COLOR' => (isset($sectionsUserData[
'tasks']) && !empty($sectionsUserData[
'tasks'][
'color'])) ?
119 htmlspecialcharsbx($sectionsUserData[
'tasks'][
'color']) : \CCalendar::DEFAULT_TASK_COLOR
121 $sectionList[] = $section;
122 self::$sectionIndex[$section[
'ID']] = $section;
141 if ($params[
'entityType'] ===
'user')
143 $userId = $params[
'entityId'];
144 if ($sectionId === \CCalendar::TASK_SECTION_ID)
150 \CCalendar::SetOffset(
false, 0);
155 if (isset($params[
'filter'][
'DAV_XML_ID']))
157 $filter[
'DAV_XML_ID'] = $params[
'filter'][
'DAV_XML_ID'];
161 if (isset($params[
'filter'][
'DATE_START']))
163 $filter[
'FROM_LIMIT'] = $params[
'filter'][
'DATE_START'];
165 if (isset($params[
'filter'][
'DATE_END']))
167 $filter[
'TO_LIMIT'] = $params[
'filter'][
'DATE_END'];
173 $filter[
'SECTION'] = $sectionId;
176 $events = \CCalendarEvent::GetList(
178 'arFilter' => $filter,
179 'getUserfields' =>
false,
180 'parseRecursion' =>
false,
181 'fetchAttendees' =>
false,
182 'fetchMeetings' => !$sectionId || \CCalendar::getMeetingSection($userId,
true) == $sectionId,
187 foreach ($events as $event)
191 if($event[
'IS_MEETING'] && ($event[
"MEETING_STATUS"] ==
'N' || ($event[
'MEETING_HOST'] == $userId && $event[
'SECTION_ID'] != $sectionId)))
196 $event[
'XML_ID'] = $event[
'DAV_XML_ID'];
197 $event[
'LOCATION'] = \CCalendar::GetTextLocation($event[
'LOCATION']);
198 $event[
'RRULE'] = \CCalendarEvent::ParseRRULE($event[
'RRULE']);
199 $entryList[] = $event;