• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/iblockdocument.php
  • Класс: CIBlockDocument
  • Вызов: CIBlockDocument::GetFieldInputControl
static function GetFieldInputControl($documentType, $arFieldType, $arFieldName, $fieldValue, $bAllowSelection = false, $publicMode = false)
{
	$iblockId = intval(mb_substr($documentType, mb_strlen("iblock_")));
	if ($iblockId <= 0)
		throw new CBPArgumentOutOfRangeException("documentType", $documentType);

	global $APPLICATION;
	if(!$publicMode)
		$APPLICATION->showAjaxHead();

	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"] == "select")
	{
		$fieldValueTmp = $fieldValue;
		?>
		
		
			
_text" name="_text" value=" 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?>"> _text', 'select');"> " name="" value="">', 'user');"> 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 (CBPDocument::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); foreach ($fieldValueTmp2 as &$fld) if (!isset($fld['VALUE'])) $fld = array("VALUE" => $fld); if ($arFieldType["Type"] == "E:EList") { static $fl = true; if ($fl) { if (!empty($_SERVER['HTTP_BX_AJAX'])) $GLOBALS["APPLICATION"]->ShowAjaxHead(); $GLOBALS["APPLICATION"]->AddHeadScript('/bitrix/js/iblock/iblock_edit.js'); } $fl = false; } 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]); } ?>"> _text', 'user', '');"> '; $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 <> '') { if($arFieldType["Type"] == "S:HTML") { if (CModule::includeModule("fileman")) { $editor = new CHTMLEditor; $res = array_merge( array( 'useFileDialogs' => false, 'height' => 200, 'useFileDialogs' => false, 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'bAllowPhp' => false, 'limitPhpAccess' => false, 'showTaskbars' => false, 'showNodeNavi' => false, 'askBeforeUnloadPage' => true, 'bbCode' => false, 'siteId' => SITE_ID, 'autoResize' => true, 'autoResizeOffset' => 40, 'saveOnBlur' => true, 'controlsMap' => array( array('id' => 'Bold', 'compact' => true, 'sort' => 80), array('id' => 'Italic', 'compact' => true, 'sort' => 90), array('id' => 'Underline', 'compact' => true, 'sort' => 100), array('id' => 'Strikeout', 'compact' => true, 'sort' => 110), array('id' => 'RemoveFormat', 'compact' => true, 'sort' => 120), array('id' => 'Color', 'compact' => true, 'sort' => 130), array('id' => 'FontSelector', 'compact' => false, 'sort' => 135), array('id' => 'FontSize', 'compact' => false, 'sort' => 140), array('separator' => true, 'compact' => false, 'sort' => 145), array('id' => 'OrderedList', 'compact' => true, 'sort' => 150), array('id' => 'UnorderedList', 'compact' => true, 'sort' => 160), array('id' => 'AlignList', 'compact' => false, 'sort' => 190), array('separator' => true, 'compact' => false, 'sort' => 200), array('id' => 'InsertLink', 'compact' => true, 'sort' => 210, 'wrap' => 'bx-b-link-'.$fieldNameId), array('id' => 'InsertImage', 'compact' => false, 'sort' => 220), array('id' => 'InsertVideo', 'compact' => true, 'sort' => 230, 'wrap' => 'bx-b-video-'.$fieldNameId), array('id' => 'InsertTable', 'compact' => false, 'sort' => 250), array('id' => 'Code', 'compact' => true, 'sort' => 260), array('id' => 'Quote', 'compact' => true, 'sort' => 270, 'wrap' => 'bx-b-quote-'.$fieldNameId), array('id' => 'Smile', 'compact' => false, 'sort' => 280), array('separator' => true, 'compact' => false, 'sort' => 290), array('id' => 'Fullscreen', 'compact' => false, 'sort' => 310), array('id' => 'BbCode', 'compact' => true, 'sort' => 340), array('id' => 'More', 'compact' => true, 'sort' => 400) ) ), array( 'name' => $fieldNameName, 'inputName' => $fieldNameName, 'id' => $fieldNameId, 'width' => '100%', 'content' => htmlspecialcharsBack($value), ) ); $editor->show($res); } else { ?> $arFieldType["Options"]), array("VALUE" => $value1), array( "FORM_NAME" => $arFieldName["Form"], "VALUE" => $fieldNameName ), true ) ); } } else { switch ($arFieldType["Type"]) { case "int": case "double": unset($fieldValueTmp[$key]); ?> $arFieldType["Options"]), array("VALUE" => $value1), array( "FORM_NAME" => $arFieldName["Form"], "VALUE" => $fieldNameName ), true ) ); } break; default: unset($fieldValueTmp[$key]); ?>');">'; } if ($arFieldType["Multiple"]) echo ""; if ($arFieldType["Multiple"] && $arFieldType["Type"] != "S:HTML" && (($arFieldType["Type"] != "file") || $publicMode)) { echo '
'; } elseif($arFieldType["Multiple"] && $arFieldType["Type"] == "S:HTML") { $functionOnclick = 'CBPVirtualDocumentCloneRow('CBPVirtualDocument_'.$arFieldName["Field"].'_Table');createAdditionalHtmlEditor('CBPVirtualDocument_'.$arFieldName["Field"].'_Table');'; echo '
'; } if ($bAllowSelection) { if (in_array($arFieldType["Type"], array("file", "bool", "date", "datetime")) || (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && $customMethodName <> '')) { ?> _text" name="_text" value=" 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?>"> _text', '', '');">