• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_event.php
  • Класс: CCalendarEvent
  • Вызов: CCalendarEvent::ShowEventSection
static function ShowEventSection(int $parentId, int $userId): void
{
	$eventEO = InternalsEventTable::query()
		->setSelect(['*'])
		->where('PARENT_ID', $parentId)
		->where('OWNER_ID', $userId)
		->exec()->fetchObject();

	if (is_null($eventEO))
	{
		return;
	}

	/** @var Event $acceptedEvent */
	$acceptedEvent = (new MappersEvent())->getByEntityObject($eventEO);

	if (is_null($acceptedEvent))
	{
		return;
	}

	$acceptedSectionId = $acceptedEvent->getSection()->getId();
	$hiddenSectionIds = UserSettings::getHiddenSections($userId, [ 'isPersonalCalendarContext' => true ]);
	$newHiddenSectionIds = array_filter($hiddenSectionIds, static function($hiddenSectionId) use ($acceptedSectionId) {
		return !is_numeric($hiddenSectionId) || (int)$hiddenSectionId !== $acceptedSectionId;
	});

	if (count($hiddenSectionIds) === count($newHiddenSectionIds))
	{
		return;
	}

	UserSettings::saveHiddenSections($userId, $newHiddenSectionIds);
	Util::addPullEvent(
		'hidden_sections_updated',
		$userId,
		[
			'hiddenSections' => $newHiddenSectionIds,
		]
	);
}