• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/copy/implement/group.php
  • Класс: BitrixSocialnetworkCopyImplementGroup
  • Вызов: Group::add
public function add(Container $container, array $fields)
{
	$groupId = CSocNetGroup::createGroup($this->executiveUserId, $fields, false);

	if (!$groupId)
	{
		global $APPLICATION;

		$this->result->addError(
			new Error(
				$APPLICATION->GetException()
					? $APPLICATION->GetException()->GetString()
					: 'System error'
				,
				self::GROUP_COPY_ERROR
			)
		);
	}
	else
	{
		CSocNetFeatures::setFeature(SONET_ENTITY_GROUP, $groupId, "files", true, false);

		if (isset($fields["OWNER_ID"]))
		{
			if (CSocNetUserToGroup::setOwner($fields["OWNER_ID"], $groupId))
			{
				$dictionary = $container->getDictionary();

				$dictionary["NEW_OWNER_ID"] = $fields["OWNER_ID"];

				$container->setDictionary($dictionary);
			}
		}

		if ($this->userGroupHelper)
		{
			$this->userGroupHelper->changeModerators($groupId);
		}
	}

	return $groupId;
}