- Модуль: 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;
?>
if ($bAllowSelection)
{
?>
_text" name="= htmlspecialcharsbx($arFieldName["Field"]) ?>_text" value="
if (count($fieldValueTmp) > 0)
{
$a = array_values($fieldValueTmp);
echo htmlspecialcharsbx($a[0]);
}
?>">
echo CBPHelper::renderControlSelectorButton('id_'.$arFieldName["Field"].'_text', 'select');
}
}
elseif ($arFieldType["Type"] == "S:UserID")
{
$fieldValue = CBPHelper::UsersArrayToString($fieldValue, null, array("bizproc", "CBPVirtualDocument", $documentType));
?>" name="= $arFieldName["Field"] ?>" value="= htmlspecialcharsbx($fieldValue) ?>">
echo CBPHelper::renderControlSelectorButton('id_'.$arFieldName["Field"], 'user');
}
elseif ((mb_strpos($arFieldType["Type"], ":") !== false)
&& $arFieldType["Multiple"]
&& (
is_array($customMethodNameMulty) && count($customMethodNameMulty) > 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="= htmlspecialcharsbx($arFieldName["Field"]) ?>_text" value="
if (count($fieldValueTmp1) > 0)
{
$a = array_values($fieldValueTmp1);
echo htmlspecialcharsbx($a[0]);
}
?>">
echo CBPHelper::renderControlSelectorButton(
'id_'.$arFieldName["Field"].'_text',
$arFieldType["BaseType"],
array('mode' => $arFieldType["Type"] == 'S:employee'? 'employee' : '')
);
}
}
else
{
if (!array_key_exists("CBPVirtualDocumentCloneRowPrinted_".$documentType, $GLOBALS) && $arFieldType["Multiple"])
{
$GLOBALS["CBPVirtualDocumentCloneRowPrinted_".$documentType] = 1;
?>
}
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]); ?> break; case "F": if ($publicMode) { //unset($fieldValueTmp[$key]); ?> } break; case "B": if (in_array($value, array("Y", "N"))) unset($fieldValueTmp[$key]); ?> break; case "T": unset($fieldValueTmp[$key]); ?> break; default: unset($fieldValueTmp[$key]); ?> } } if ($bAllowSelection) { if (!in_array($arFieldType["Type"], array("F", "B")) && (is_array($customMethodName) && count($customMethodName) <= 0 || !is_array($customMethodName) && $customMethodName == '')) { echo CBPHelper::renderControlSelectorButton($fieldNameId, $arFieldType["BaseType"]); } } if ($arFieldType["Multiple"]) echo ' |
'; if ($bAllowSelection) { if (in_array($arFieldType["Type"], array("F", "B")) || (is_array($customMethodName) && count($customMethodName) > 0 || !is_array($customMethodName) && $customMethodName <> '')) { ?> _text" name="= htmlspecialcharsbx($arFieldName["Field"]) ?>_text" value=" if (count($fieldValueTmp) > 0) { $a = array_values($fieldValueTmp); echo htmlspecialcharsbx($a[0]); } ?>"> echo CBPHelper::renderControlSelectorButton( 'id_'.$arFieldName["Field"].'_text', $arFieldType["BaseType"], array('mode' => $arFieldType["Type"] == 'S:employee'? 'employee' : '') ); } } } $s = ob_get_contents(); ob_end_clean(); return $s; }