• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/iblockbizproc.php
  • Класс: CIBlockDocumentWebdav
  • Вызов: CIBlockDocumentWebdav::GetDocumentFields
static function GetDocumentFields($documentType)
{
	if($storage = self::needProxyToDiskByDocType($documentType))
	{
		return self::proxyToDisk(__FUNCTION__, array(BitrixDiskBizProcDocumentCompatible::generateDocumentType($storage->getId())));
	}

	$iblockId = intval(mb_substr($documentType, mb_strlen("iblock_")));
	if ($iblockId <= 0)
		throw new CBPArgumentOutOfRangeException("documentType", $documentType);

	$arResult = array(
		"ID" => array(
			"Name" => GetMessage("IBLOCK_FIELD_ID"),
			"Type" => "int",
			"Filterable" => true,
			"Editable" => false,
			"Required" => false,
		),
		"TIMESTAMP_X" => array(
			"Name" => GetMessage("IBLOCK_FIELD_TIMESTAMP_X"),
			"Type" => "datetime",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
		),
		"MODIFIED_BY" => array(
			"Name" => GetMessage("IBD_FIELD_MODYFIED").GetMessage("IBD_FIELD_IDENTIFICATOR"),
			"Type" => "user",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
		),
		"MODIFIED_BY_PRINTABLE" => array(
			"Name" => GetMessage("IBD_FIELD_MODYFIED").GetMessage("IBD_FIELD_NAME_LASTNAME"),
			"Type" => "string",
			"Filterable" => true,
			"Editable" => false,
			"Required" => false,
		),
		"DATE_CREATE" => array(
			"Name" => GetMessage("IBLOCK_FIELD_DATE_CREATE"),
			"Type" => "datetime",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
		),
		"CREATED_BY" => array(
			"Name" => GetMessage("IBD_FIELD_CREATED").GetMessage("IBD_FIELD_IDENTIFICATOR"),
			"Type" => "user",
			"Filterable" => true,
			"Editable" => false,
			"Required" => false,
		),
		"CREATED_BY_PRINTABLE" => array(
			"Name" => GetMessage("IBD_FIELD_CREATED").GetMessage("IBD_FIELD_NAME_LASTNAME"),
			"Type" => "string",
			"Filterable" => true,
			"Editable" => false,
			"Required" => false,
		),
		"IBLOCK_ID" => array(
			"Name" => GetMessage("IBLOCK_FIELD_IBLOCK_ID"),
			"Type" => "int",
			"Filterable" => true,
			"Editable" => false,
			"Required" => false,
		),
		"ACTIVE" => array(
			"Name" => GetMessage("IBLOCK_FIELD_ACTIVE"),
			"Type" => "bool",
			"Filterable" => true,
			"Editable" => true,
			"Required" => false,
		),
		"BP_PUBLISHED" => array(
			"Name" => GetMessage("IBLOCK_FIELD_BP_PUBLISHED"),
			"Type" => "bool",
			"Filterable" => false,
			"Editable" => true,
			"Required" => false,
		),
		"NAME" => array(
			"Name" => GetMessage("IBLOCK_FIELD_FILE_NAME"),
			"Type" => "string",
			"Filterable" => true,
			"Editable" => true,
			"Required" => true,
		),
		"FILE_SIZE" => array(
			"Name" => GetMessage("IBLOCK_FIELD_FILE_SIZE"),
			"Type" => "int",
			"Filterable" => true,
			"Editable" => false,
			"Required" => false,
		),
		"PREVIEW_TEXT" => array(
			"Name" => GetMessage("IBLOCK_FIELD_FILE_DESCRIPTION"),
			"Type" => "text",
			"Filterable" => false,
			"Editable" => true,
			"Required" => false,
		)
	);

	$arKeys = array_keys($arResult);
	foreach ($arKeys as $key)
		$arResult[$key]["Multiple"] = false;

	$dbProperties = CIBlockProperty::GetList(
		array("sort" => "asc", "name" => "asc"),
		array("IBLOCK_ID" => $iblockId)
	);
	while ($arProperty = $dbProperties->Fetch())
	{
		if (trim($arProperty["CODE"]) <> '')
			$key = "PROPERTY_".$arProperty["CODE"];
		else
			$key = "PROPERTY_".$arProperty["ID"];

		$arResult[$key] = array(
			"Name" => $arProperty["NAME"],
			"Filterable" => ($arProperty["FILTRABLE"] == "Y"),
			"Editable" => true,
			"Required" => ($arProperty["IS_REQUIRED"] == "Y"),
			"Multiple" => ($arProperty["MULTIPLE"] == "Y"),
		);

		if ($arProperty["USER_TYPE"] <> '')
		{
			if ($arProperty["USER_TYPE"] == "UserID")
			{
				$arResult[$key]["Name"] .= GetMessage("IBD_FIELD_IDENTIFICATOR");
				$arResult[$key]["Type"] = "user";
				$arResult[$key."_PRINTABLE"] = array(
					"Name" => $arProperty["NAME"].GetMessage("IBD_FIELD_NAME_LASTNAME"),
					"Type" => "string",
					"Filterable" => ($arProperty["FILTRABLE"] == "Y"),
					"Editable" => false,
					"Required" => ($arProperty["IS_REQUIRED"] == "Y"),
					"Multiple" => ($arProperty["MULTIPLE"] == "Y"),
				);
			}
			elseif ($arProperty["USER_TYPE"] == "DateTime")
				$arResult[$key]["Type"] = "datetime";
			else
				$arResult[$key]["Type"] = "string";
		}
		elseif ($arProperty["PROPERTY_TYPE"] == "L")
		{
			$arResult[$key]["Type"] = "select";

			$arResult[$key]["Options"] = array();
			$dbPropertyEnums = CIBlockProperty::GetPropertyEnum($arProperty["ID"]);
			while ($arPropertyEnum = $dbPropertyEnums->GetNext())
				$arResult[$key]["Options"][$arPropertyEnum["ID"]] = $arPropertyEnum["VALUE"];
		}
		elseif ($arProperty["PROPERTY_TYPE"] == "N")
		{
			$arResult[$key]["Type"] = "int";
		}
		elseif ($arProperty["PROPERTY_TYPE"] == "F")
		{
			$arResult[$key]["Type"] = "file";
		}
		elseif ($arProperty["PROPERTY_TYPE"] == "S")
		{
			$arResult[$key]["Type"] = "string";
		}
		else
		{
			$arResult[$key]["Type"] = "string";
		}
	}

	return $arResult;
}