• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar.php
  • Класс: CCalendar
  • Вызов: CCalendar::GetStartUpEvent
static function GetStartUpEvent($eventId = false, $isSharing = false)
{
	if ($eventId)
	{
		if ($isSharing)
		{
			$res = [self::getDeletedSharedEvent($eventId)];
		}
		else
		{
			$res = CCalendarEvent::GetList(
				array(
					'arFilter' => array(
						"PARENT_ID" => $eventId,
						"OWNER_ID" => self::$userId,
						"IS_MEETING" => 1,
						"DELETED" => "N",
					),
					'parseRecursion' => false,
					'fetchAttendees' => true,
					'fetchMeetings' => true,
					'checkPermissions' => true,
					'setDefaultLimit' => false,
				)
			);
		}

		if (!$res || !is_array($res[0]))
		{
			$res = CCalendarEvent::GetList(
				array(
					'arFilter' => array(
						"ID" => $eventId,
						"DELETED" => "N",
					),
					'parseRecursion' => false,
					'userId' => self::$userId,
					'fetchAttendees' => false,
					'fetchMeetings' => true,
				)
			);
		}

		if ($res && isset($res[0]) && ($event = $res[0]))
		{
			if (
				$event['MEETING_STATUS'] === 'Y'
				|| $event['MEETING_STATUS'] === 'N'
				|| $event['MEETING_STATUS'] === 'Q'
			)
			{
				$_GET['CONFIRM'] ??= null;
				if (
					$event['IS_MEETING']
					&& (int)self::$userId === (int)self::$ownerId
					&& self::$type === 'user'
					&& ($_GET['CONFIRM'] === 'Y' || $_GET['CONFIRM'] === 'N')
				)
				{
					CCalendarEvent::SetMeetingStatus(array(
						'userId' => self::$userId,
						'eventId' => $event['ID'],
						'status' => $_GET['CONFIRM'] === 'Y' ? 'Y' : 'N',
						'personalNotification' => true,
					));
				}
			}

			if ($event['RRULE'])
			{
				$event['RRULE'] = CCalendarEvent::ParseRRULE($event['RRULE']);
			}

			$event['~userIndex'] = CCalendarEvent::getUserIndex();

			return $event;
		}

		CCalendarNotify::ClearNotifications($eventId);
	}

	return false;
}