9 private $executiveUserId;
10 private $features = [];
19 public function __construct($executiveUserId = 0, array $features = [])
21 $this->executiveUserId = $executiveUserId;
22 $this->features = $features;
31 public function copy($groupId, $copiedGroupId)
33 $iblockTypeId =
"lists_socnet";
35 $iblockIds = $this->getIblockIdsToCopy($iblockTypeId, $groupId);
41 $this->addToQueue($copiedGroupId);
43 Option::set(self::MODULE_ID, self::CHECKER_OPTION.$copiedGroupId,
"Y");
46 "iblockTypeId" => $iblockTypeId,
47 "groupId" => $groupId,
48 "copiedGroupId" => $copiedGroupId,
49 "features" => $this->features
51 Option::set(self::MODULE_ID, self::STEPPER_OPTION.$copiedGroupId, serialize($queueOption));
53 $agent = \CAgent::getList([], [
54 "MODULE_ID" => self::MODULE_ID,
55 "NAME" => GroupStepper::class.
"::execAgent();"
59 GroupStepper::bind(1);
63 private function getIblockIdsToCopy($iblockTypeId, $groupId)
69 "TYPE" => $iblockTypeId,
70 "CHECK_PERMISSIONS" =>
"N",
71 "=SOCNET_GROUP_ID" => $groupId
74 $queryObject = \CIBlock::getList([], $filter);
75 while ($iblock = $queryObject->fetch())
77 $iblockIds[] = $iblock[
"ID"];
83 private function addToQueue(
int $copiedGroupId)
85 $option = Option::get(self::MODULE_ID, self::QUEUE_OPTION,
"");
86 $option = ($option !==
"" ? unserialize($option) : []);
87 $option = (is_array($option) ? $option : []);
89 $option[] = $copiedGroupId;
90 Option::set(self::MODULE_ID, self::QUEUE_OPTION, serialize($option));