本文整理汇总了PHP中CBPHelper::StripUserPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::StripUserPrefix方法的具体用法?PHP CBPHelper::StripUserPrefix怎么用?PHP CBPHelper::StripUserPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPHelper
的用法示例。
在下文中一共展示了CBPHelper::StripUserPrefix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetFieldInputValuePrintable
function GetFieldInputValuePrintable($documentType, $arFieldType, $fieldValue)
{
$result = $fieldValue;
switch ($arFieldType['Type']) {
case "user":
if (!is_array($fieldValue)) {
$fieldValue = array($fieldValue);
}
$result = CBPHelper::UsersArrayToString($fieldValue, null, array("iblock", "CIBlockDocument", $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);
$dbImg = CFile::GetByID($r);
if ($arImg = $dbImg->Fetch()) {
$result[] = "[url=/bitrix/tools/bizproc_show_file.php?f=" . htmlspecialcharsbx($arImg["FILE_NAME"]) . "&i=" . $r . "&h=" . md5($arImg["SUBDIR"]) . "]" . htmlspecialcharsbx($arImg["ORIGINAL_NAME"]) . "[/url]";
}
}
} else {
$fieldValue = intval($fieldValue);
$dbImg = CFile::GetByID($fieldValue);
if ($arImg = $dbImg->Fetch()) {
$result = "[url=/bitrix/tools/bizproc_show_file.php?f=" . htmlspecialcharsbx($arImg["FILE_NAME"]) . "&i=" . $fieldValue . "&h=" . md5($arImg["SUBDIR"]) . "]" . htmlspecialcharsbx($arImg["ORIGINAL_NAME"]) . "[/url]";
}
}
break;
case "select":
if (is_array($arFieldType["Options"])) {
if (is_array($fieldValue)) {
$result = array();
foreach ($fieldValue as $r) {
if (array_key_exists($r, $arFieldType["Options"])) {
$result[] = $arFieldType["Options"][$r];
}
}
} else {
if (array_key_exists($fieldValue, $arFieldType["Options"])) {
$result = $arFieldType["Options"][$fieldValue];
}
}
}
break;
}
if (strpos($arFieldType['Type'], ":") !== false) {
if ($arFieldType["Type"] == "S:employee") {
$fieldValue = CBPHelper::StripUserPrefix($fieldValue);
}
$arCustomType = CIBlockProperty::GetUserType(substr($arFieldType['Type'], 2));
if (array_key_exists("GetPublicViewHTML", $arCustomType)) {
if (is_array($fieldValue) && !CBPHelper::IsAssociativeArray($fieldValue)) {
$result = array();
foreach ($fieldValue as $value) {
$r = call_user_func_array($arCustomType["GetPublicViewHTML"], array(array("LINK_IBLOCK_ID" => $arFieldType["Options"]), array("VALUE" => $value), ""));
$result[] = HTMLToTxt($r);
}
} else {
$result = call_user_func_array($arCustomType["GetPublicViewHTML"], array(array("LINK_IBLOCK_ID" => $arFieldType["Options"]), array("VALUE" => $fieldValue), ""));
$result = HTMLToTxt($result);
}
}
}
return $result;
}
示例2: FunctionConvert
private function FunctionConvert($args)
{
if (!is_array($args)) {
$args = array($args);
}
$ar = $this->ArrgsToArray($args);
$val = array_shift($ar);
$type = array_shift($ar);
$attr = array_shift($ar);
$type = strtolower($type);
if ($type === 'printableuserb24') {
$result = array();
$users = CBPHelper::StripUserPrefix($val);
if (!is_array($users)) {
$users = array($users);
}
foreach ($users as $userId) {
$db = CUser::GetByID($userId);
if ($ar = $db->GetNext()) {
$ix = randString(5);
$attr = !empty($attr) ? 'href="' . $attr . '"' : 'href="#" onClick="return false;"';
$result[] = '<a class="feed-post-user-name" id="bp_' . $userId . '_' . $ix . '" ' . $attr . ' bx-post-author-id="' . $userId . '">' . CUser::FormatName(CSite::GetNameFormat(false), $ar, false) . '</a><script type="text/javascript">BX.tooltip(\'' . $userId . '\', "bp_' . $userId . '_' . $ix . '", "");</script>';
}
}
$result = implode(", ", $result);
} elseif ($type == 'printableuser') {
$result = array();
$users = CBPHelper::StripUserPrefix($val);
if (!is_array($users)) {
$users = array($users);
}
foreach ($users as $userId) {
$db = CUser::GetByID($userId);
if ($ar = $db->GetNext()) {
$result[] = CUser::FormatName(CSite::GetNameFormat(false), $ar, false);
}
}
$result = implode(", ", $result);
} else {
$result = $val;
}
return $result;
}