• Модуль: photogallery
  • Путь к файлу: ~/bitrix/modules/photogallery/lib/copy/integration/groupstepper.php
  • Класс: BitrixPhotogalleryCopyIntegrationGroupStepper
  • Вызов: GroupStepper::execute
public function execute(array &$option)
{
	if (!Loader::includeModule("iblock") || !Loader::includeModule("photogallery"))
	{
		return false;
	}

	try
	{
		$queue = $this->getQueue();
		$this->setQueue($queue);
		$queueOption = $this->getOptionData($this->baseName);

		$copiedGroupId = ($queueOption["copiedGroupId"] ?: 0);
		$parentSectionId = ($queueOption["parentSectionId"] ?: 0);
		$newSectionName = ($queueOption["newSectionName"] ?: "");

		if ($parentSectionId && $newSectionName)
		{
			$containerCollection = new ContainerCollection();
			$containerCollection[] = new Container($parentSectionId);

			$elementImplementer = new ElementImplementer(ElementImplementer::SECTION_COPY_MODE);
			$sectionImplementer = new SectionImplementer();
			$sectionImplementer->setChangedFields([
				"NAME" => $newSectionName,
				"CODE" => "group_".$copiedGroupId,
				"SOCNET_GROUP_ID" => $copiedGroupId,
			]);
			$sectionImplementer->setChangedFieldsForChildSections(["CODE" => "group_".$copiedGroupId]);
			$sectionImplementer->setChild($elementImplementer);

			$sectionCopier = new SectionCopier($sectionImplementer);
			$sectionCopier->copy($containerCollection);

			$this->deleteQueueOption();
			return !$this->isQueueEmpty();
		}
		else
		{
			$this->deleteQueueOption();
			return !$this->isQueueEmpty();
		}
	}
	catch (Exception $exception)
	{
		$this->writeToLog($exception);
		$this->deleteQueueOption();
		return false;
	}
}