- Модуль: calendar
- Путь к файлу: ~/bitrix/modules/calendar/classes/general/calendar_restservice.php
- Класс: used
- Вызов: used::SectionGet
static function SectionGet($params = [], $nav = null, $server = null)
{
$userId = CCalendar::GetCurUserId();
$methodName = "calendar.section.get";
if (isset($params['type']))
{
$type = $params['type'];
}
else
{
throw new RestException(Loc::getMessage('CAL_REST_PARAM_EXCEPTION', array('#REST_METHOD#' => $methodName, '#PARAM_NAME#' => 'type')));
}
if (isset($params['ownerId']))
{
$ownerId = (int)$params['ownerId'];
}
elseif($type === 'user')
{
$ownerId = $userId;
}
else
{
throw new RestException(Loc::getMessage('CAL_REST_PARAM_EXCEPTION', array('#REST_METHOD#' => $methodName, '#PARAM_NAME#' => 'ownerId')));
}
if (Loader::includeModule('intranet') && !BitrixIntranetUtil::isIntranetUser())
{
throw new RestException(Loc::getMessage('CAL_REST_ACCESS_DENIED'));
}
$arFilter = array(
'CAL_TYPE' => $type,
'OWNER_ID' => $ownerId,
'ACTIVE' => "Y"
);
$res = CCalendarSect::GetList(array('arFilter' => $arFilter));
foreach($res as $i => $section)
{
unset(
$res[$i]['OUTLOOK_JS'],
$res[$i]['DAV_EXCH_CAL'],
$res[$i]['DAV_EXCH_MOD'],
$res[$i]['SORT'],
$res[$i]['PARENT_ID'],
$res[$i]['IS_EXCHANGE'],
$res[$i]['EXTERNAL_ID'],
$res[$i]['ACTIVE'],
$res[$i]['CAL_DAV_MOD'],
$res[$i]['CAL_DAV_CAL'],
$res[$i]['XML_ID']
);
if (!empty($res[$i]['DATE_CREATE']) && is_string($res[$i]['DATE_CREATE']))
{
$res[$i]['DATE_CREATE'] = self::formatOld($res[$i]['DATE_CREATE']);
}
if (!empty($res[$i]['TIMESTAMP_X']) && is_string($res[$i]['TIMESTAMP_X']))
{
$res[$i]['TIMESTAMP_X'] = self::formatOld($res[$i]['TIMESTAMP_X']);
}
}
return $res;
}