本文整理汇总了PHP中CBPHelper::usersArrayToString方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::usersArrayToString方法的具体用法?PHP CBPHelper::usersArrayToString怎么用?PHP CBPHelper::usersArrayToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPHelper
的用法示例。
在下文中一共展示了CBPHelper::usersArrayToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderControl
/**
* @param FieldType $fieldType
* @param array $field
* @param mixed $value
* @param bool $allowSelection
* @param int $renderMode
* @return string
*/
protected static function renderControl(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode)
{
if ($value !== null && !is_array($value)) {
$value = array($value);
}
$value = \CBPHelper::usersArrayToString($value, null, $fieldType->getDocumentType());
$renderResult = parent::renderControl($fieldType, $field, $value, $allowSelection, $renderMode);
$renderResult .= static::renderControlSelector($field, null, false, '', $fieldType);
return $renderResult;
}
示例2: GetFieldInputValuePrintable
public 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[] = strtoupper($r) != "N" && !empty($r) ? GetMessage("BPVDX_YES") : GetMessage("BPVDX_NO");
}
} else {
$result = 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=" . htmlspecialcharsbx($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=" . htmlspecialcharsbx($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 (strpos($fieldType['Type'], ":") !== false) {
if ($fieldType["Type"] == "S:employee") {
$fieldValue = CBPHelper::stripUserPrefix($fieldValue);
}
$customType = CIBlockProperty::getUserType(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;
}