• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/file.php
  • Класс: CWebDavFile
  • Вызов: CWebDavFile::GetSectionsTree
function GetSectionsTree($options = array()) // DEPRECATED FROM 11.5.0
{
	$io = self::GetIo();
	if (!function_exists("__get_folder_tree"))
	{
		function __get_folder_tree($path, $path_chunc, $deep, &$arSection)
		{
			static $io = false;

			if ($io === false)
				$io = CBXVirtualIo::GetInstance();

			if (!is_array($arSection))
				$arSection = array();

			if($path === false)
			{
				return false;
			}

			if ($io->DirectoryExists($path))
			{
				$oDir = $io->GetDirectory($path);
				$arChildren = $oDir->GetChildren();
				foreach($arChildren as $node)
				{
					$deep++;
					$filename = $node->GetName();
					$tmp_path = $node->GetPathWithName();

					if ($io->DirectoryExists($tmp_path))
					{
						$filename = $this->MetaNamesReverse($filename);
						$arSection[] = array(
							"ID" => str_replace($path_chunc, "", $tmp_path),
							"DEPTH_LEVEL" => $deep,
							"NAME" => $filename);
						__get_folder_tree($tmp_path, $path_chunc, $deep, $arSection);
					}
				}
			}
		}
	}

	static $sections = array();

	$this->IsDir($options, $this->replace_symbols);

	if ($this->arParams["not_found"] || !$this->arParams["is_dir"])
		return array();

	$id = md5($this->arParams["item_id"]);

	if (!is_set($sections, $id))
	{
		//$path = $io->CombinePath($this->real_path_full, $this->arParams["item_id"]);
		$path = CWebDavBase::CleanRelativePathString($this->arParams["item_id"], $this->real_path_full);
		$arResult = null;
		__get_folder_tree($path, $this->real_path_full, 0, $arResult);
		$sections[$id] = $arResult;
	}

	return $sections[$id];
}