• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/controller/calendarajax.php
  • Класс: BitrixCalendarControllerCalendarAjax
  • Вызов: CalendarAjax::updateColorAction
public function updateColorAction()
{
	$request = $this->getRequest();
	$response = [];
	$entryId = intVal($request->getPost('entryId'));
	$userId = CCalendar::GetUserId();
	$entry = CCalendarEvent::GetById($entryId);

	if (empty($entry))
	{
		$this->addError(new Error('Event not found'));

		return $response;
	}

	$accessController = new EventAccessController($userId);
	$eventModel = CCalendarEvent::getEventModelForPermissionCheck($entryId, $entry, $userId);

	if ($accessController->check(ActionDictionary::ACTION_EVENT_EDIT, $eventModel, ['checkCurrentEvent' => 'Y']))
	{
		CCalendarEvent::updateColor($entryId, $request->getPost('color'));
		CCalendar::ClearCache('event_list');
	}
	else
	{
		$this->addError(new Error('Access denied'));
	}

	return $response;
}