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\InheritedProperty\ElementValues;
10use Bitrix\Main\Filter\Filter;
11use Bitrix\Main\Grid\Panel\Actions;
12use Bitrix\Main\Grid\Panel\Snippet;
13use Bitrix\Main\Grid\Panel\Snippet\Onchange;
14use Bitrix\Main\HttpRequest;
15use Bitrix\Main\Localization\Loc;
16use Bitrix\Main\Result;
25 use SectionSelectControl;
28 public static function getId(): string
35 return Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_ACTIONS_ELEMENT_GROUP_MOVE_TO_SECTION_NAME');
42 $controls =
$request->getPost(
'controls');
43 if (!is_array($controls))
48 $destinationSectionId = (int)($controls[
'section_id'] ?? -1);
49 if ($destinationSectionId < 0)
54 [$elementIds, $sectionIds] = $this->prepareItemIds(
$request, $isSelectedAllRows,
$filter);
59 $this->moveElementsToSection($destinationSectionId, $elementIds)->
getErrors()
66 $this->moveSectionsToSection($destinationSectionId, $sectionIds)->
getErrors()
77 'ACTION' => Actions::RESET_CONTROLS,
80 'ACTION' => Actions::CREATE,
82 $this->getSectionSelectControl(
true),
83 (
new Snippet)->getSendSelectedButton(),
89 private function moveElementsToSection(
int $sectionId,
array $ids):
Result
96 $message = Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_MOVE_TO_SECTION_GROUP_CHILD_ACCESS_DENIED_BIND_ELEMENT', [
106 foreach ($ids as $id)
110 $message = Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_MOVE_TO_SECTION_GROUP_CHILD_ACCESS_DENIED_EDIT_ELEMENT', [
121 'IBLOCK_SECTION_ID' => $sectionId,
122 'IBLOCK_SECTION' => [
138 $ipropValues =
new ElementValues($this->
getIblockId(), $id);
139 $ipropValues->clearValues();
146 private function moveSectionsToSection(
int $sectionId,
array $ids): Result
153 $message = Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_MOVE_TO_SECTION_GROUP_CHILD_ACCESS_DENIED_BIND_ELEMENT', [
154 '#ID#' => $sectionId,
163 foreach ($ids as $id)
167 $message = Loc::getMessage(
'IBLOCK_GRID_PANEL_UI_MOVE_TO_SECTION_GROUP_CHILD_ACCESS_DENIED_EDIT_ELEMENT', [
192 $ipropValues =
new ElementValues($this->
getIblockId(), $id);
193 $ipropValues->clearValues();
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)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)