- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_sect.php
- Класс: CCalendarSect
- Вызов: CCalendarSect::GetSectionForOwner
static function GetSectionForOwner($type, $ownerId, $autoCreate = true)
{
$sectionId = false;
$autoCreated = false;
$section = false;
$res = self::GetList([
'arFilter' => [
'CAL_TYPE' => $type,
'OWNER_ID' => $ownerId,
'DELETED' => 'N',
'ACTIVE' => 'Y',
],
'checkPermissions' => false,
]);
foreach($res as $sect)
{
$ownerId = $sect['OWNER_ID'];
if (self::CheckGoogleVirtualSection($sect['GAPI_CALENDAR_ID']))
{
continue;
}
$section = $sect;
$sectionId = $sect['ID'];
break;
}
if (!$section && $autoCreate)
{
$section = self::CreateDefault([
'type' => $type,
'ownerId' => $ownerId,
]);
$autoCreated = true;
$sectionId = $section['ID'];
}
return array('sectionId' => $sectionId, 'autoCreated' => $autoCreated, 'section' => $section);
}