• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/core/managers/accessibility.php
  • Класс: BitrixCalendarCoreManagersAccessibility
  • Вызов: Accessibility::getEvents
public function getEvents(array $userIds, int $timestampFromUTC, int $timestampToUTC): array
{
	[$from, $to] = $this->formatLimitFromTimestamps($timestampFromUTC, $timestampToUTC);
	$events = CCalendarEvent::GetList([
		'arFilter' => [
			'FROM_LIMIT' => $from,
			'TO_LIMIT' => $to,
			'CAL_TYPE' => 'user',
			'OWNER_ID' => $userIds,
			'ACTIVE_SECTION' => 'Y'
		],
		'arSelect' => [
			'ID',
			'PARENT_ID',
			'OWNER_ID',
			'EVENT_TYPE',
			'NAME',
			'DATE_FROM',
			'DATE_TO',
			'TZ_FROM',
			'TZ_TO',
			'TZ_OFFSET_FROM',
			'TZ_OFFSET_TO',
			'DATE_FROM_TS_UTC',
			'DATE_TO_TS_UTC',
			'DT_SKIP_TIME',
			'ACCESSIBILITY',
			'IMPORTANCE',
			'RRULE',
			'EXDATE',
			'SECTION_ID',
			'CAL_TYPE',
			'MEETING_STATUS',
			'IS_MEETING',
			'DT_LENGTH',
			'PRIVATE_EVENT'
		],
		'parseRecursion' => true,
		'fetchAttendees' => false,
		'fetchSection' => true,
		'parseDescription' => false,
		'setDefaultLimit' => false,
		'checkPermissions' => $this->checkPermissions
	]);

	$accessibility = $this->initAccessibility($userIds);
	foreach ($events as $event)
	{
		if ((int)$event['ID'] === $this->skipEventId || (int)$event['PARENT_ID'] === $this->skipEventId)
		{
			continue;
		}
		if ($event['ACCESSIBILITY'] === 'free')
		{
			continue;
		}
		if ($event['IS_MEETING'] && $event['MEETING_STATUS'] === 'N')
		{
			continue;
		}
		if (CCalendarSect::CheckGoogleVirtualSection($event['SECTION_DAV_XML_ID']))
		{
			continue;
		}

		$isFullDay = $event['DT_SKIP_TIME'] === 'Y';
		if ($isFullDay)
		{
			$from = Util::formatDateTimestampUTC(CCalendar::TimestampUTC($event['DATE_FROM']));
			$to = Util::formatDateTimestampUTC(CCalendar::TimestampUTC($event['DATE_TO']) + CCalendar::GetDayLen());
		}
		else
		{
			$eventTsFromUTC = Helper::getEventTimestampUTC(new DateTime($event['DATE_FROM']), $event['TZ_FROM']);
			$eventTsToUTC = Helper::getEventTimestampUTC(new DateTime($event['DATE_TO']), $event['TZ_TO']);
			$from = Util::formatDateTimeTimestampUTC($eventTsFromUTC);
			$to = Util::formatDateTimeTimestampUTC($eventTsToUTC);
		}
		$accessibility[$event['OWNER_ID']][] = [
			'id' => $event['ID'],
			'name' => $this->getEventName($event),
			'from' => $from,
			'to' => $to,
			'isFullDay' => $isFullDay,
		];
	}

	return $accessibility;
}