3namespace Bitrix\Iblock\Grid\Panel\UI\Actions\Item\ElementGroup;
5use Bitrix\Iblock\Grid\ActionType;
6use Bitrix\Iblock\Grid\Panel\UI\Actions\Helpers\ItemFinder;
7use Bitrix\Iblock\Grid\Panel\UI\Actions\Item\ElementGroup\Helpers\SectionSelectControl;
8use Bitrix\Iblock\Grid\RowType;
9use Bitrix\Iblock\InheritedProperty\ElementValues;
11use Bitrix\Main\Filter\Filter;
12use Bitrix\Main\Grid\Panel\Actions;
13use Bitrix\Main\Grid\Panel\Snippet;
14use Bitrix\Main\Grid\Panel\Snippet\Onchange;
15use Bitrix\Main\HttpRequest;
16use Bitrix\Main\Localization\Loc;
17use Bitrix\Main\Result;
25 use SectionSelectControl;
28 public static function getId(): string
35 return Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_ACTIONS_ELEMENT_GROUP_ADD_TO_SECTION_NAME');
42 $controls =
$request->getPost(
'controls');
43 if (!is_array($controls))
48 $sectionId = (int)($controls[
'section_id'] ?? 0);
54 if ($isSelectedAllRows)
56 $elementIds = $this->getElementIdsByFilter(
$filter);
67 $elementIds = $this->validateElementIds($elementIds);
73 $this->addElementsToSection($sectionId, $elementIds)->
getErrors()
84 'ACTION' => Actions::RESET_CONTROLS,
87 'ACTION' => Actions::CREATE,
89 $this->getSectionSelectControl(
false),
90 (
new Snippet)->getSendSelectedButton(),
96 private function addElementsToSection(
int $sectionId,
array $ids):
Result
103 $message = Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_ADD_TO_SECTION_GROUP_CHILD_ACCESS_DENIED_BIND_ELEMENT', [
104 '#ID#' => $sectionId,
113 foreach ($ids as $id)
117 $message = Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_ADD_TO_SECTION_GROUP_CHILD_ACCESS_DENIED_EDIT_ELEMENT', [
118 '#ID#' => $sectionId,
128 'IBLOCK_SECTION' => [
130 ...$this->getElementSectionsIds($id),
145 $ipropValues =
new ElementValues($this->
getIblockId(), $id);
146 $ipropValues->clearValues();
153 private function getElementSectionsIds(
int $elementId):
array
157 $rows = CIBlockElement::GetElementGroups($elementId,
true, [
'ID']);
158 while ($row =
$rows->Fetch())
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
processRequest(HttpRequest $request, bool $isSelectedAllRows, ?Filter $filter=null)
static parseIndexList(array $ids)
getRequestRows(HttpRequest $request)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)