• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/iblock.php
  • Класс: CWebDavIblock
  • Вызов: CWebDavIblock::InTrash
function InTrash($arElement)
{
	static $trashID = false;
	if($trashID === false)
	{
		$trashID = $this->GetMetaID("TRASH");
	}

	$id = (
		isset($arElement['ID'])
			? intval($arElement['ID'])
			: (isset($arElement['item_id'])
				? intval($arElement['item_id'])
				: null
			)
		);

	$parentID = (
		isset($arElement['parent_id'])
			? intval($arElement['parent_id'])
			: (isset($arElement['IBLOCK_SECTION_ID'])
				? intval($arElement['IBLOCK_SECTION_ID'])
				: null
			)
		);

	if($id === null)
	{
		return false;
	}

	$isDir = isset($arElement['is_dir']) ? $arElement['is_dir'] : false;

	if (($id === $trashID && $isDir === true) || $parentID === $trashID)
	{
		return true;
	}

	if($parentID === null)
	{
		return false;
	}

	if(array_key_exists($parentID, self::$trashCache))
	{
		return self::$trashCache[$parentID];
	}

	$result = false;
	foreach (CWebDavSymlinkHelper::getNavChain($this->IBLOCK_ID, $parentID) as $res)
	{
		if($res["ID"] == $trashID)
		{
			$result = true;
			break;
		}
	}
	self::$trashCache[$parentID] = $result;
	return $result;
}