• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/bizprocdocument.php
  • Класс: BitrixDiskBizProcDocument
  • Вызов: BizProcDocument::getFieldInputControl
static function getFieldInputControl($documentType, $fieldType, $fieldName, $fieldValue, $allowSelection = false, $publicMode = false)
{
	global $USER_FIELD_MANAGER, $APPLICATION;

	$storageId = self::getStorageIdByType($documentType);
	if(!$storageId)
	{
		throw new CBPArgumentNullException('documentType');
	}

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

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

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

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

	ob_start();
	if ($fieldType['Type'] == 'select')
	{
		$fieldValueTmp = $fieldValue;
		?>
		
		
			
0 || !is_array($customMethodNameMulty) && $customMethodNameMulty <> '' ) ) { if (!is_array($fieldValue)) $fieldValue = array(); if ($allowSelection) { $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 ($fieldType["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" => $fieldType["Options"]), $fieldValueTmp2, array( "FORM_NAME" => $fieldName["Form"], "VALUE" => htmlspecialcharsbx($fieldName["Field"]) ), true ) ); if ($allowSelection) { ?>
_text" name="_text" value=" 0) { $a = array_values($fieldValueTmp1); echo htmlspecialcharsbx($a[0]); } ?>"> _text', 'user');"> '; $fieldValueTmp = $fieldValue; $ind = -1; foreach ($fieldValue as $key => $value) { $ind++; $fieldNameId = 'id_'.htmlspecialcharsbx($fieldName['Field']).'__n'.$ind.'_'; $fieldNameName = htmlspecialcharsbx($fieldName['Field']).($fieldType['Multiple'] ? '[n'.$ind.']' : ''); if ($fieldType['Multiple']) echo ''; if (mb_strpos($fieldType['Type'], static::getPrefixForCustomType()) === 0) { $value1 = $value; if($allowSelection && CBPDocument::isExpression(trim($value1))) { $value1 = null; } else { unset($fieldValueTmp[$key]); } $type = str_replace(static::getPrefixForCustomType(), '', $fieldType['Type']); $_REQUEST[$fieldName['Field']] = $value1; $userFieldType = $USER_FIELD_MANAGER->getUserType($type); $userField = array( 'ENTITY_ID' => 'DISK_FILE_' . $storageId, 'FIELD_NAME' => $fieldName['Field'], 'USER_TYPE_ID' => $type, 'SORT' => 100, 'MULTIPLE' => $fieldType['Multiple'] ? 'Y' : 'N', 'MANDATORY' => $fieldType['Required'] ? 'Y' : 'N', 'EDIT_IN_LIST' => 'Y', 'EDIT_FORM_LABEL' => $userFieldType['DESCRIPTION'], 'VALUE' => $value1, // 'USER_TYPE' => $userFieldType, 'SETTINGS' => array() ); if ( $fieldType['Type'] == static::getPrefixForCustomType() . 'iblock_element' || $fieldType['Type'] == static::getPrefixForCustomType() . 'iblock_section' || $fieldType['Type'] == static::getPrefixForCustomType() . 'boolean' ) { $options = $fieldType['Options']; if(is_string($options)) { $userField['SETTINGS']['IBLOCK_ID'] = $options; } elseif(is_array($options)) { $userField['SETTINGS']= $options; } } $APPLICATION->includeComponent( 'bitrix:system.field.edit', $type, array( 'arUserField' => $userField, 'bVarsFromForm' => true, 'form_name' => $fieldName['Form'], 'FILE_MAX_HEIGHT' => 400, 'FILE_MAX_WIDTH' => 400, 'FILE_SHOW_POPUP' => true ), false, array('HIDE_ICONS' => 'Y') ); } elseif (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && $customMethodName <> '') { if($fieldType['Type'] == static::getPrefixForCustomType() . 'HTML') { if (Loader::includeModule("fileman")) { $editor = new CHTMLEditor; $res = array_merge( array( 'height' => 200, 'minBodyWidth' => 350, 'normalBodyWidth' => 555, 'bAllowPhp' => false, 'limitPhpAccess' => false, 'showTaskbars' => false, 'showNodeNavi' => false, 'askBeforeUnloadPage' => true, 'bbCode' => true, '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 { ?> $fieldType["Options"]), array("VALUE" => $value1), array( "FORM_NAME" => $fieldName["Form"], "VALUE" => $fieldNameName ), true ) ); } } else { switch ($fieldType['Type']) { case 'int': unset($fieldValueTmp[$key]); ?> includeComponent( 'bitrix:main.calendar', '', array( 'SHOW_INPUT' => 'Y', 'FORM_NAME' => $fieldName['Form'], 'INPUT_NAME' => $fieldNameName, 'INPUT_VALUE' => $v, 'SHOW_TIME' => 'Y' ), false, array('HIDE_ICONS' => 'Y') ); break; case 'text': unset($fieldValueTmp[$key]); ?>');">'; } if ($fieldType['Multiple']) echo ''; if ($fieldType["Multiple"] && $fieldType['Type'] != static::getPrefixForCustomType() . 'HTML' && (($fieldType["Type"] != "file") || $publicMode)) { echo '
'; } elseif($fieldType["Multiple"] && $fieldType['Type'] == static::getPrefixForCustomType() . 'HTML') { $functionOnclick = 'CBPVirtualDocumentCloneRowHtml('CBPVirtualDocument_'.CUtil::JSEscape($fieldName["Field"]).'_Table');'; if(!$publicMode) $functionOnclick = 'CBPVirtualDocumentCloneRow('CBPVirtualDocument_'.CUtil::JSEscape($fieldName["Field"]).'_Table');createAdditionalHtmlEditor('CBPVirtualDocument_'.CUtil::JSEscape($fieldName["Field"]).'_Table');'; echo '
'; } if ($allowSelection) { if (in_array($fieldType['Type'], array('file', 'bool', "date", "datetime")) || (mb_strpos($fieldType['Type'], static::getPrefixForCustomType()) === 0)) { ?> _text" name="_text" value=" 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?>"> _text', '');">