2namespace Bitrix\Iblock\Copy\Implement;
4use Bitrix\Iblock\Copy\Implement\Children\Child;
5use Bitrix\Iblock\Copy\Implement\Children\Element as ElementChild;
6use Bitrix\Iblock\Copy\Implement\Children\Field as FieldChild;
7use Bitrix\Iblock\Copy\Implement\Children\Section as SectionChild;
8use Bitrix\Main\Copy\Container;
9use Bitrix\Main\Copy\CopyImplementer;
11use Bitrix\Main\Result;
17 private $targetIblockTypeId =
"";
18 private $targetSocnetGroupId = 0;
34 $this->child[] = $child;
45 $this->targetIblockTypeId = $targetIblockTypeId;
56 $this->targetSocnetGroupId = $targetSocnetGroupId;
79 $iblockObject = new \CIBlock;
95 $this->result->addError(
new Error(
'Unknown error', self::IBLOCK_COPY_ERROR));
111 $query = \CIBlock::getList(
115 'CHECK_PERMISSIONS' =>
'N',
121 $iblockMessage = \CIBlock::getMessages(
$entityId);
125 if ($this->targetIblockTypeId)
127 $iblock[
"IBLOCK_TYPE_ID"] = $this->targetIblockTypeId;
130 if ($this->targetSocnetGroupId)
132 $iblock[
"SOCNET_GROUP_ID"] = $this->targetSocnetGroupId;
135 if (!empty(
$iblock[
"PICTURE"]))
140 $iblock[
"RIGHTS"] = $this->getRights(
177 foreach ($this->child as $child)
179 if ($child instanceof ElementChild)
181 $child->setEnumRatio($enumRatio);
182 $child->setSectionsRatio($sectionsRatio);
183 $child->setFieldRatio($fieldRatio);
186 $results[] = $child->copy(
$entityId, $copiedEntityId);
188 if ($child instanceof FieldChild)
190 $enumRatio = $child->getEnumRatio();
191 $fieldRatio = $child->getFieldRatio();
193 if ($child instanceof SectionChild)
195 $sectionsRatio = $child->getSectionsRatio();
204 if ($this->cacheManager)
206 $this->cacheManager->cleanDir(
"menu");
215 private function getRights(
$iblockId, $rightMode, $socnetGroupId = 0)
224 if ($rightMode ==
"E")
226 $rightObject = new \CIBlockRights(
$iblockId);
227 foreach ($rightObject->getRights() as
$right)
229 if (mb_strpos(
$right[
"GROUP_CODE"],
"SG") !== 0)
232 "GROUP_CODE" =>
$right[
"GROUP_CODE"],
234 "TASK_ID" =>
$right[
"TASK_ID"],
241 $groupPermissions = \CIBlock::getGroupPermissions(
$iblockId);
242 foreach ($groupPermissions as $groupId => $permission)
244 if ($permission >
"W")
247 "GROUP_CODE" =>
"G".$groupId,
248 "IS_INHERITED" =>
"N",
249 "TASK_ID" => \CIBlockRights::letterToTask($permission),
cleanCache(int $iblockId)
getSocnetPermission($iblockId, $socnetGroupId)
getFields(Container $container, $entityId)
setTargetSocnetGroupId($targetSocnetGroupId)
setCacheManager(\CCacheManager $cacheManager)
add(Container $container, array $fields)
setTargetIblockTypeId($targetIblockTypeId)
copyChildren(Container $container, $entityId, $copiedEntityId)
prepareFieldsToCopy(Container $container, array $fields)
getResult(array $results=[])
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(! $catalogEdit->isSuccess()) $iblock
while($arParentIBlockProperty=$dbParentIBlockProperty->Fetch()) $errorMessage