Manager::reserveRoom

  1. Bitrix24 API (v. 23.675.0)
  2. calendar
  3. Manager
  4. reserveRoom
  • Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/rooms/manager.php
  • Класс: BitrixCalendarRoomsManager
  • Вызов: Manager::reserveRoom
static function reserveRoom(array $params = []): ?int
{
	$params['checkPermission'] = $params['checkPermission'] ?? null;
	$params['room_id'] = $params['room_id'] ?? null;
	$roomList = self::getRoomById((int)$params['room_id'], ['checkPermission' => $params['checkPermission']]);

	if (
		!$roomList || empty($roomList[0])
		|| empty($roomList[0]['NAME'])
		|| (
			empty($roomList[0]['PERM']['view_full'])
			&& $params['checkPermission'] !== false
		)
	)
	{
		return null;
	}

	$createdBy = $params['parentParams']['arFields']['CREATED_BY']
		?? $params['parentParams']['arFields']['MEETING_HOST']
		?? null
	;
	$userId = $params['parentParams']['userId']
		?? $params['parentParams']['arFields']['userId']
		?? null
	;

	$arFields = [
		'ID' => $params['room_event_id'] ?? null,
		'SECTIONS' => $params['room_id'] ?? null,
		'DATE_FROM' => $params['parentParams']['arFields']['DATE_FROM'] ?? null,
		'DATE_TO' => $params['parentParams']['arFields']['DATE_TO'] ?? null,
		'TZ_FROM' => $params['parentParams']['arFields']['TZ_FROM'] ?? null,
		'TZ_TO' => $params['parentParams']['arFields']['TZ_TO'] ?? null,
		'SKIP_TIME' => $params['parentParams']['arFields']['SKIP_TIME'] ?? null,
		'RRULE' => $params['parentParams']['arFields']['RRULE'] ?? null,
		'EXDATE' => $params['parentParams']['arFields']['EXDATE'] ?? null,
	];

	if (!$params['room_event_id'])
	{
		$arFields['CREATED_BY'] = $createdBy;
		$arFields['NAME'] = CCalendar::GetUserName($userId);
		$arFields['CAL_TYPE'] = self::TYPE;
	}

	return CCalendarEvent::Edit([
		'arFields' => $arFields,
	]);
}

Добавить комментарий