CBPVirtualDocument::getFieldInputControl

  1. Bitrix24 API (v. 23.675.0)
  2. bizproc
  3. CBPVirtualDocument
  4. getFieldInputControl
  • Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/classes/general/virtualdocument.php
  • Класс: CBPVirtualDocument
  • Вызов: CBPVirtualDocument::getFieldInputControl
static function getFieldInputControl($documentType, $arFieldType, $arFieldName, $fieldValue, $bAllowSelection = false, $publicMode = false)
{
	$v = mb_substr($documentType, mb_strlen("type_"));
	if (intval($v)."!" != $v."!")
		return "";
	$iblockId = intval($v);

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

	$arFieldType["BaseType"] = "string";
	$arFieldType["Complex"] = false;
	if (array_key_exists($arFieldType["Type"], $arDocumentFieldTypes[$documentType]))
	{
		$arFieldType["BaseType"] = $arDocumentFieldTypes[$documentType][$arFieldType["Type"]]["BaseType"];
		$arFieldType["Complex"] = $arDocumentFieldTypes[$documentType][$arFieldType["Type"]]["Complex"];
	}

	if (!is_array($fieldValue) || is_array($fieldValue) && CBPHelper::IsAssociativeArray($fieldValue))
		$fieldValue = array($fieldValue);

	$customMethodName = "";
	$customMethodNameMulty = "";
	if (mb_strpos($arFieldType["Type"], ":") !== false)
	{
		$ar = CIBlockProperty::GetUserType(mb_substr($arFieldType["Type"], 2));
		if (array_key_exists("GetPublicEditHTML", $ar))
			$customMethodName = $ar["GetPublicEditHTML"];
		if (array_key_exists("GetPublicEditHTMLMulty", $ar))
			$customMethodNameMulty = $ar["GetPublicEditHTMLMulty"];
	}

	ob_start();

	if ($arFieldType["Type"] == "L")
	{
		$fieldValueTmp = $fieldValue;
		?>
		
		
			
_text" name="_text" value=" 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?>">" name="" value=""> 0 || !is_array($customMethodNameMulty) && $customMethodNameMulty <> '' ) ) { if (!is_array($fieldValue)) $fieldValue = array(); if ($bAllowSelection) { $fieldValueTmp1 = array(); $fieldValueTmp2 = array(); foreach ($fieldValue as $v) { $vTrim = trim($v); if (CBPActivity::isExpression($vTrim)) $fieldValueTmp1[] = $vTrim; else $fieldValueTmp2[] = $v; } } else { $fieldValueTmp1 = array(); $fieldValueTmp2 = $fieldValue; } if (($arFieldType["Type"] == "S:employee") && COption::GetOptionString("bizproc", "employee_compatible_mode", "N") != "Y") $fieldValueTmp2 = CBPHelper::StripUserPrefix($fieldValueTmp2); if ($arFieldType["Type"] == "E:EList") { static $fl = true; if ($fl) { $GLOBALS["APPLICATION"]->AddHeadScript('/bitrix/js/iblock/iblock_edit.js'); } $fl = false; } $fieldValueTmp21 = array(); foreach ($fieldValueTmp2 as $k => $fld) { if ($fld === null || $fld === "") continue; if (is_array($fld) && isset($fld["VALUE"])) $fieldValueTmp21[$k] = $fld; else $fieldValueTmp21[$k] = array("VALUE" => $fld); } $fieldValueTmp2 = $fieldValueTmp21; echo call_user_func_array( $customMethodNameMulty, array( array("LINK_IBLOCK_ID" => $arFieldType["Options"]), $fieldValueTmp2, array( "FORM_NAME" => $arFieldName["Form"], "VALUE" => htmlspecialcharsbx($arFieldName["Field"]) ), true ) ); if ($bAllowSelection) { ?>
_text" name="_text" value=" 0) { $a = array_values($fieldValueTmp1); echo htmlspecialcharsbx($a[0]); } ?>"> $arFieldType["Type"] == 'S:employee'? 'employee' : '') ); } } else { if (!array_key_exists("CBPVirtualDocumentCloneRowPrinted_".$documentType, $GLOBALS) && $arFieldType["Multiple"]) { $GLOBALS["CBPVirtualDocumentCloneRowPrinted_".$documentType] = 1; ?> '; $fieldValueTmp = $fieldValue; if (sizeof($fieldValue) == 0) $fieldValue[] = null; $ind = -1; foreach ($fieldValue as $key => $value) { $ind++; $fieldNameId = 'id_'.htmlspecialcharsbx($arFieldName["Field"]).'__n'.$ind.'_'; $fieldNameName = htmlspecialcharsbx($arFieldName["Field"]).($arFieldType["Multiple"] ? "[n".$ind."]" : ""); if ($arFieldType["Multiple"]) echo ''; if (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && $customMethodName <> '') { $value1 = $value; if ($bAllowSelection && CBPActivity::isExpression($value1)) $value1 = null; else unset($fieldValueTmp[$key]); if (($arFieldType["Type"] == "S:employee") && COption::GetOptionString("bizproc", "employee_compatible_mode", "N") != "Y") $value1 = CBPHelper::StripUserPrefix($value1); echo call_user_func_array( $customMethodName, array( array("LINK_IBLOCK_ID" => $arFieldType["Options"]), array("VALUE" => $value1), array( "FORM_NAME" => $arFieldName["Form"], "VALUE" => $fieldNameName ), true ) ); } else { switch ($arFieldType["Type"]) { case "N": unset($fieldValueTmp[$key]); ?> '; } if ($arFieldType["Multiple"]) echo ""; if ($arFieldType["Multiple"] && (($arFieldType["Type"] != "F") || $publicMode)) echo '
'; if ($bAllowSelection) { if (in_array($arFieldType["Type"], array("F", "B")) || (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && $customMethodName <> '')) { ?> _text" name="_text" value=" 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?>"> $arFieldType["Type"] == 'S:employee'? 'employee' : '') ); } } } $s = ob_get_contents(); ob_end_clean(); return $s; }

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