• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/iblocksocnet.php
  • Класс: CIBlockWebdavSocnet
  • Вызов: CIBlockWebdavSocnet::OnSocNetFeaturesAdd
static function OnSocNetFeaturesAdd($id, $fields)
{
	static $addGroupFilesFeatures = false;

	if(!$addGroupFilesFeatures && isset($fields['ACTIVE']) && $fields['ACTIVE'] == 'Y')
	{
		if($fields
			&& isset($fields['FEATURE'])
			&& $fields['FEATURE'] == 'files'
			&& $fields['ENTITY_TYPE'] == 'G'
			&& $fields['ENTITY_ID']
		)
		{
			$addGroupFilesFeatures = true;
			$groupId = $fields['ENTITY_ID'];

			//add section to files in this group!
			$groupSectionCreateSuccess = (bool)self::groupSectionCreate($groupId);
			if(!empty($groupId) && $groupSectionCreateSuccess && self::$lastGroupIdAddedOnHit == $groupId && self::$lastGroupOwnerIdAddedOnHit)
			{
				$dispatcher = new BitrixWebdavInviteDispatcher;
				$attachObjectType = CWebDavSymlinkHelper::ENTITY_TYPE_GROUP;
				$attachObjectId = (int)$groupId;

				$inviteComponentParams = array(
					'attachObject' => array(
						'id' => $attachObjectId,
						'type' => $attachObjectType,
					),
					'attachToUserId' => self::$lastGroupOwnerIdAddedOnHit,
					'inviteFromUserId' => self::$lastGroupOwnerIdAddedOnHit,
					'canEdit' => true,
				);
				$response =
					CWebDavTools::allowAutoconnectShareGroupFolder()?
						$dispatcher->processActionConnect($inviteComponentParams) :
						$dispatcher->processActionInvite($inviteComponentParams);
				if($response['status'] == $dispatcher::STATUS_SUCCESS)
				{

				}
			}
		}
	}
	CIBlockWebdavSocnet::ClearTagCache('wd_socnet');
}