• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_sect.php
  • Класс: CCalendarSect
  • Вызов: CCalendarSect::prepareSectionListResponse
static function prepareSectionListResponse(string $type, string $ownerId): array
{
	$userId = CCalendar::GetCurUserId();
	$followedSectionList = UserSettings::getFollowedSectionIdList($userId);

	$isNotInternalUser =
		Loader::includeModule('extranet')
		&& !CExtranet::IsIntranetUser(SITE_ID, $userId)
	;
	if ($isNotInternalUser)
	{
		// Check permissions for group
		if ($type === 'group')
		{
			$perm = CCalendar::GetPermissions([
				'type' => $type,
				'ownerId' => $ownerId,
				'userId' => $userId,
				'setProperties' => false
			]);
			// For all members of the group it will be true so we want to skip everybody else
			if (!$perm['edit'])
			{
				return [];
			}
		}
		else // user's and company calendars are not available for external users
		{
			return [];
		}
	}

	$sectionList = CCalendar::getSectionList([
		'CAL_TYPE' => $type,
		'OWNER_ID' => $ownerId,
		'ACTIVE' => 'Y',
		'ADDITIONAL_IDS' => $followedSectionList,
		'checkPermissions' => true,
		'getPermissions' => true,
		'getImages' => true
	]);

	$sectionList = array_merge($sectionList, CCalendar::getSectionListAvailableForUser($userId));
	$sections = [];
	$sectionIdList = [];

	foreach ($sectionList as $section)
	{
		if (!in_array((int)$section['ID'], $sectionIdList))
		{
			// if ($isNotInternalUser)


			if (in_array($section['ID'], $followedSectionList))
			{
				$section['SUPERPOSED'] = true;
			}

			if (!empty($section['NAME']))
			{
				$section['NAME'] = Emoji::decode($section['NAME']);
			}
			$sections[] = $section;
			$sectionIdList[] = (int) $section['ID'];
		}
	}

	return $sections;
}