CBPVirtualDocument::getFieldInputControlOptions

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPVirtualDocument
  4. getFieldInputControlOptions
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/virtualdocument.php
  • Класс: CBPVirtualDocument
  • Вызов: CBPVirtualDocument::getFieldInputControlOptions
static function getFieldInputControlOptions($documentType, &$arFieldType, $jsFunctionName, &$value)
{
	$result = "";

	static $arDocumentFieldTypes = array();
	if (!array_key_exists($documentType, $arDocumentFieldTypes))
	{
		$arDocumentFieldTypes[$documentType] = self::GetDocumentFieldTypes($documentType);
	}

	if (!array_key_exists($arFieldType["Type"], $arDocumentFieldTypes[$documentType])
		|| !$arDocumentFieldTypes[$documentType][$arFieldType["Type"]]["Complex"])
	{
		return "";
	}

	if ($arFieldType["Type"] == "E:EList")
	{
		if (is_array($value))
		{
			reset($value);
			$valueTmp = intval(current($value));
		}
		else
		{
			$valueTmp = intval($value);
		}

		$iblockId = 0;
		if ($valueTmp > 0)
		{
			$dbResult = CIBlockElement::GetList(array(), array("ID" => $valueTmp), false, false, array("ID", "IBLOCK_ID"));
			if ($arResult = $dbResult->Fetch())
				$iblockId = $arResult["IBLOCK_ID"];
		}
		if ($iblockId <= 0 && intval($arFieldType["Options"]) > 0)
			$iblockId = intval($arFieldType["Options"]);

		$defaultIBlockId = 0;

		$result .= '';

		$arFieldType["Options"] = $defaultIBlockId;
	}
	elseif ($arFieldType["Type"] == "L")
	{
		$valueTmp = $arFieldType["Options"];
		if (!is_array($valueTmp))
			$valueTmp = array($valueTmp => $valueTmp);

		$str = '';
		foreach ($valueTmp as $k => $v)
		{
			if (is_array($v) && count($v) == 2)
			{
				$v1 = array_values($v);
				$k = $v1[0];
				$v = $v1[1];
			}

			if ($k != $v)
				$str .= '['.$k.']'.$v;
			else
				$str .= $v;

			$str .= "n";
		}
		$result .= '
'; $result .= GetMessage("IBD_DOCUMENT_XFORMOPTIONS1").'
'; $result .= GetMessage("IBD_DOCUMENT_XFORMOPTIONS2").'
'; $result .= ''; $result .= ''; } return $result; }

Добавить комментарий