- Модуль: lists
- Путь к файлу: ~/bitrix/modules/lists/lib/bizprocdocument.php
- Класс: BizprocDocument
- Вызов: BizprocDocument::GetFieldInputValuePrintable
static function GetFieldInputValuePrintable($documentType, $fieldType, $fieldValue)
{
$result = $fieldValue;
switch ($fieldType['Type'])
{
case "user":
if (!is_array($fieldValue))
$fieldValue = array($fieldValue);
$result = CBPHelper::usersArrayToString($fieldValue, null, array("lists", get_called_class(), $documentType));
break;
case "bool":
if (is_array($fieldValue))
{
$result = array();
foreach ($fieldValue as $r)
$result[] = ((mb_strtoupper($r) != "N" && !empty($r)) ? GetMessage("BPVDX_YES") : GetMessage("BPVDX_NO"));
}
else
{
$result = ((mb_strtoupper($fieldValue) != "N" && !empty($fieldValue)) ? GetMessage("BPVDX_YES") : GetMessage("BPVDX_NO"));
}
break;
case "file":
if (is_array($fieldValue))
{
$result = array();
foreach ($fieldValue as $r)
{
$r = intval($r);
$imgQuery = CFile::getByID($r);
if ($img = $imgQuery->fetch())
$result[] = "[url=/bitrix/tools/bizproc_show_file.php?f=".urlencode($img["FILE_NAME"])."&i=".$r."&h=".md5($img["SUBDIR"])."]".htmlspecialcharsbx($img["ORIGINAL_NAME"])."[/url]";
}
}
else
{
$fieldValue = intval($fieldValue);
$imgQuery = CFile::getByID($fieldValue);
if ($img = $imgQuery->fetch())
$result = "[url=/bitrix/tools/bizproc_show_file.php?f=".urlencode($img["FILE_NAME"])."&i=".$fieldValue."&h=".md5($img["SUBDIR"])."]".htmlspecialcharsbx($img["ORIGINAL_NAME"])."[/url]";
}
break;
case "select":
if (is_array($fieldType["Options"]))
{
if (is_array($fieldValue))
{
$result = array();
foreach ($fieldValue as $r)
{
if (array_key_exists($r, $fieldType["Options"]))
$result[] = $fieldType["Options"][$r];
}
}
else
{
if (array_key_exists($fieldValue, $fieldType["Options"]))
$result = $fieldType["Options"][$fieldValue];
}
}
break;
}
if (mb_strpos($fieldType['Type'], ":") !== false)
{
if ($fieldType["Type"] == "S:employee")
$fieldValue = CBPHelper::stripUserPrefix($fieldValue);
$customType = CIBlockProperty::getUserType(mb_substr($fieldType['Type'], 2));
if (array_key_exists("GetPublicViewHTML", $customType))
{
if (is_array($fieldValue) && !CBPHelper::isAssociativeArray($fieldValue))
{
$result = array();
foreach ($fieldValue as $value)
{
$r = call_user_func_array(
$customType["GetPublicViewHTML"],
array(
array("LINK_IBLOCK_ID" => $fieldType["Options"]),
array("VALUE" => $value),
""
)
);
$result[] = HTMLToTxt($r);
}
}
else
{
$result = call_user_func_array(
$customType["GetPublicViewHTML"],
array(
array("LINK_IBLOCK_ID" => $fieldType["Options"]),
array("VALUE" => $fieldValue),
""
)
);
$result = HTMLToTxt($result);
}
}
}
return $result;
}