• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/log_destination.php
  • Класс: CSocNetLogDestination
  • Вызов: CSocNetLogDestination::GetTreeList
static function GetTreeList($id, $relation, $compat = false)
{
	if ($compat)
	{
		$tmp = array();
		foreach($relation as $iid => $rel)
		{
			$p = $rel["parent"];
			if (!isset($tmp[$p]))
			{
				$tmp[$p] = array();
			}
			$tmp[$p][] = $iid;
		}
		$relation = $tmp;
	}

	$arRelations = Array();
	if (is_array($relation[$id] ?? null))
	{
		foreach ($relation[$id] as $relId)
		{
			$arItems = Array();
			if (
				isset($relation[$relId])
				&& !empty($relation[$relId])
			)
			{
				$arItems = self::GetTreeList($relId, $relation);
			}

			$arRelations[$relId] = Array('id'=>$relId, 'type' => 'category', 'items' => $arItems);
		}
	}

	return $arRelations;
}