• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/controller/calendarajax.php
  • Класс: BitrixCalendarControllerCalendarAjax
  • Вызов: CalendarAjax::deleteCalendarSectionAction
public function deleteCalendarSectionAction($id)
{
	$response = [];
	if (Loader::includeModule('intranet') && !BitrixIntranetUtil::isIntranetUser())
	{
		return $response;
	}

	$sectionList = SectionTable::getList([
			'filter' => [
				'=ACTIVE' => 'Y',
				'=ID' => (int)$id
			],
		]
	);

	if (!($section = $sectionList->fetch()))
	{
		$this->addError(new Error(Loc::getMessage('EC_SECTION_NOT_FOUND'), 'section_not_found'));
	}

	$accessController = new SectionAccessController(CCalendar::GetUserId());
	$sectionModel = SectionModel::createFromArray($section);

	if (!$accessController->check(ActionDictionary::ACTION_SECTION_EDIT, $sectionModel))
	{
		$this->addError(new Error(Loc::getMessage('EC_ACCESS_DENIED'), 'access_denied'));
	}

	if (empty($this->getErrors()))
	{
		CCalendar::DeleteSection($id);
	}

	return $response;
}