- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_sect.php
- Класс: CCalendarSect
- Вызов: CCalendarSect::getAllSectionsForVendor
static function getAllSectionsForVendor(int $connectionId, array $type)
{
if (!Loader::includeModule('dav'))
{
return [
'status' => 'error',
'message' => Loc::getMessage('EC_SYNCAJAX_DAV_REQUIRED'),
];
}
/** @var BitrixCalendarCoreMappersFactory $eventMapper */
$mapperFactory = BitrixMainDIServiceLocator::getInstance()->get('calendar.service.mappers.factory');
if ($connection = $mapperFactory->getConnection()->getById($connectionId))
{
$userId = CCalendar::GetUserId();
if ($connection->getOwner()->getId() !== $userId)
{
return [];
}
return SectionTable::query()
->setSelect(['*', 'CONNECTION_ID' => 'LINK.CONNECTION_ID'])
->where('CAL_TYPE', 'user')
->where('OWNER_ID', $userId)
->whereIn('EXTERNAL_TYPE', $type)
->where('CONNECTION_ID', $connectionId)
->registerRuntimeField(
new BitrixMainEntityReferenceField(
'LINK',
BitrixCalendarInternalsSectionConnectionTable::class,
['=this.ID' => 'ref.SECTION_ID'],
['join_type' => 'INNER']
),
)->exec()->fetchAll()
;
}
return [];
}