35 $select = empty($select)? [
'*']:$select;
36 $order = empty($order)? [
'ID'=>
'ASC']:$order;
38 if (isset($filter[
'IBLOCK_SECTION_ID']))
40 $filter[
'SECTION_ID'] = $filter[
'IBLOCK_SECTION_ID'];
41 unset($filter[
'IBLOCK_SECTION_ID']);
44 $r = \CIBlockSection::GetList($order, $filter,
false, $select, self::getNavData($pageNavigation->
getOffset()));
45 while ($l = $r->fetch())
48 return new Page(
'SECTIONS', $result,
function() use ($filter)
50 return \CIBlockSection::GetCount($filter);
55 $this->addErrors($r->getErrors());
69 return [
'SECTION'=>$this->
get($id)];
73 $this->addErrors($r->getErrors());
79 $this->addErrors($r->getErrors());
89 if (isset($fields[
'IBLOCK_SECTION_ID']) && (
int)$fields[
'IBLOCK_SECTION_ID'] > 0)
98 $section = new \CIBlockSection();
103 $id = $section->Add($fields);
104 if($section->LAST_ERROR<>
'')
106 $r->addError(
new Error($section->LAST_ERROR));
113 $this->addErrors($r->getErrors());
118 return [
'SECTION'=>$this->
get($id)];
127 if (isset($fields[
'IBLOCK_SECTION_ID']) && (
int)$fields[
'IBLOCK_SECTION_ID'] > 0)
135 $section = new \CIBlockSection();
143 $section->Update($id, $fields);
144 if($section->LAST_ERROR<>
'')
146 $r->addError(
new Error($section->LAST_ERROR));
154 return [
'SECTION'=>$this->
get($id)];
158 $this->addErrors($r->getErrors());
171 if (!\CIBlockSection::Delete($id))
173 if ($ex = self::getApplication()->GetException())
174 $r->addError(
new Error($ex->GetString(), $ex->GetId()));
176 $r->addError(
new Error(
'delete section error'));
187 $this->addErrors($r->getErrors());
196 if(isset($this->
get($id)[
'ID']) ==
false)
197 $r->addError(
new Error(
'Section is not exists'));
202 protected function get($id)
204 return \CIBlockSection::GetByID($id)->Fetch();
228 !$this->accessController->check(ActionDictionary::ACTION_CATALOG_READ)
229 && !$this->accessController->check(ActionDictionary::ACTION_CATALOG_VIEW)
232 $r->addError(
new Error(
'Access Denied', 200040300010));
254 $arIBlock = \CIBlock::GetArrayByID($iblockId);
256 $bBadBlock = !\CIBlockSectionRights::UserHasRightTo($iblockId, $sectionId, self::IBLOCK_EDIT);
262 $r->addError(
new Error(
'Access Denied', 200040300040));
271 $arIBlock = \CIBlock::GetArrayByID($iblockId);
273 $bBadBlock = !\CIBlockSectionRights::UserHasRightTo($iblockId, $iblockSectionId, self::IBLOCK_SECTION_SECTION_BIND);
279 $r->addError(
new Error(
'Access Denied', 200040300050));
293 $iblockId = \CIBlockElement::GetIBlockByID($sectionId);
294 $bBadBlock = !\CIBlockElementRights::UserHasRightTo($iblockId, $sectionId, self::IBLOCK_SECTION_DELETE);
298 $r->addError(
new Error(
'Access Denied', 200040300050));
309 $arIBlock = \CIBlock::GetArrayByID($iblockId);
312 $bBadBlock = !\CIBlockSectionRights::UserHasRightTo($iblockId, $sectionId, self::IBLOCK_SECTION_READ);
318 $r->addError(
new Error(
'Access Denied', 200040300040));
327 $arIBlock = \CIBlock::GetArrayByID($iblockId);
329 $bBadBlock = !\CIBlockRights::UserHasRightTo($iblockId, $iblockId, self::IBLOCK_READ);
335 $r->addError(
new Error(
'Access Denied', 200040300030));
344 $section = \CIBlockSection::GetByID($id);
345 if ($res = $section->GetNext())
347 $iblockId = $res[
"IBLOCK_ID"];
checkModifyPermissionEntity()
checkPermissionIBlockSectionSectionBindUpdate($iblockSectionId)
checkReadPermissionEntity()
getIBlockBySectionId($id)
checkPermissionIBlockSectionGet($sectionId)
checkPermissionIBlockSectionUpdate($sectionId)
updateAction($id, array $fields)
checkPermissionIBlockSectionList($iblockId)
checkPermissionIBlockSectionDelete($sectionId)
checkPermissionIBlockSectionAdd($iblockId)
listAction(PageNavigation $pageNavigation, array $select=[], array $filter=[], array $order=[])
checkPermissionIBlockSectionSectionBindModify($iblockId, $iblockSectionId)
checkPermissionIBlockSectionModify($iblockId, $sectionId)