• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/webdavstorage.php
  • Класс: CWebDavStorageCore
  • Вызов: CWebDavStorageCore::formatSectionToResponse
protected function formatSectionToResponse(array $section, $markAsSymlink = null)
{
	if(empty($section))
	{
		return array();
	}
	$storageId = $this->getStorageId();
	$rootSection = isset($storageId['IBLOCK_SECTION_ID'])? $storageId['IBLOCK_SECTION_ID'] : null;
	$result = array(
		'id' => $this->generateId($section),
		'isDirectory' => true,
		'isShared' => !empty($section['IS_SHARED']),
		'isSymlinkDirectory' => !empty($section[CWebDavIblock::UF_LINK_SECTION_ID]) || !empty($section['symlink']),
		'isDeleted' => false,
		'storageId' => $this->getStringStorageId(),
		'path' => isset($section['PATH']) ? '/' . trim($section['PATH'], '/') : null,
		'name' => $section['NAME'],
		'version' => (string)$this->generateTimestamp($section['TIMESTAMP_X']),
		'extra' => array(
			'id' => (string)$section['ID'],
			'iblockId' => (string)$section['IBLOCK_ID'],
			'sectionId' => (string)$section['IBLOCK_SECTION_ID'],
			'rootSectionId' => (string)$rootSection,
			'name' => $section['NAME'],
		),
		'permission' => $this->getRightSection($section),
		'createdBy' => (string)$section['CREATED_BY'],
		'modifiedBy' => (string)$section['MODIFIED_BY'],
	);
	if($rootSection != $section['IBLOCK_SECTION_ID'])
	{
		$result['parentId'] = $this->generateId(array('FILE' => false, 'ID' => $section['IBLOCK_SECTION_ID']));
	}
	if($markAsSymlink === null)
	{
		global $USER;
		if(CWebDavSymlinkHelper::isLink(CWebDavSymlinkHelper::ENTITY_TYPE_USER, $USER->getId(), array(
			'ID' => $section['ID'],
			'IBLOCK_ID' => $section['IBLOCK_ID'],
		)))
		{
			$markAsSymlink = true;

			$result['path'] =
				'/' .
				trim(implode('/', $this->getPathArrayForSection($section['ID'])), '/') .
				'/'
			;
		}
	}
	if($markAsSymlink)
	{
		$result['extra']['inSymlink'] = '1';
	}
	return $result;
}