Manager::getRoomById

  1. Bitrix24 API (v. 23.675.0)
  2. calendar
  3. Manager
  4. getRoomById
  • Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/rooms/manager.php
  • Класс: BitrixCalendarRoomsManager
  • Вызов: Manager::getRoomById
static function getRoomById(int $id, array $params = []): array
{
	$roomQuery = LocationTable::query()
		->setSelect([
			'LOCATION_ID' => 'ID',
			'NECESSITY',
			'CAPACITY',
			'SECTION_ID',
			'CATEGORY_ID',
			'NAME' => 'SECTION.NAME',
			'COLOR' => 'SECTION.COLOR',
			'OWNER_ID' => 'SECTION.OWNER_ID',
			'CAL_TYPE' => 'SECTION.CAL_TYPE',
		])
		->where('SECTION.ID', $id)
		->registerRuntimeField('SECTION',
			new ReferenceField(
				'SECTION',
				SectionTable::getEntity(),
				QueryJoin::on('ref.ID', 'this.SECTION_ID'),
				['join_type' => QueryJoin::TYPE_INNER]
			)
		)
		->cacheJoins(true)
		->setCacheTtl(86400)
		->exec()
	;

	[$roomsId, $result] = self::prepareRoomsQueryData($roomQuery);
	$result = self::getRoomsAccess($roomsId, $result);

	foreach ($result as $room)
	{
		CCalendarSect::HandlePermission($room);
	}

	$applyPermission = $params['checkPermission'] ?? true;
	if ($applyPermission !== false)
	{
		return CCalendarSect::GetSectionPermission($result);
	}

	return [...$result];
}

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