• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/componenthelper.php
  • Класс: BitrixSocialnetworkComponentHelper
  • Вызов: ComponentHelper::getSonetBlogGroupIdList
static function getSonetBlogGroupIdList($params): array
{
	$result = [];

	if (!Loader::includeModule('blog'))
	{
		throw new MainSystemException("Could not load 'blog' module.");
	}

	$cacheTtl = 3153600;
	$cacheId = 'blog_group_list_'.md5(serialize($params));
	$cacheDir = '/blog/group/';
	$cache = new CPHPCache;

	if($cache->initCache($cacheTtl, $cacheId, $cacheDir))
	{
		$result = $cache->getVars();
	}
	else
	{
		$cache->startDataCache();

		$ideaBlogGroupIdList = array();
		if (ModuleManager::isModuleInstalled("idea"))
		{
			$res = CSite::getList("sort", "desc", Array("ACTIVE" => "Y"));
			while ($site = $res->fetch())
			{
				$val = Option::get("idea", "blog_group_id", false, $site["LID"]);
				if ($val)
				{
					$ideaBlogGroupIdList[] = $val;
				}
			}
		}

		$filter = array();
		if (!empty($params["SITE_ID"]))
		{
			$filter['SITE_ID'] = $params["SITE_ID"];
		}
		if (!empty($ideaBlogGroupIdList))
		{
			$filter['!@ID'] = $ideaBlogGroupIdList;
		}

		$res = CBlogGroup::getList(array(), $filter, false, false, array("ID"));
		while($blogGroup = $res->fetch())
		{
			$result[] = $blogGroup["ID"];
		}

		$cache->endDataCache($result);
	}

	return $result;
}