本文整理汇总了PHP中CSocNetUser::FormatNameEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CSocNetUser::FormatNameEx方法的具体用法?PHP CSocNetUser::FormatNameEx怎么用?PHP CSocNetUser::FormatNameEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSocNetUser
的用法示例。
在下文中一共展示了CSocNetUser::FormatNameEx方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
$canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arFriends[$pref . "_USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
if (intval($arParams["THUMBNAIL_LIST_SIZE"]) > 0) {
if (intval($arFriends[$pref . "_USER_PERSONAL_PHOTO"]) <= 0) {
switch ($arFriends[$pref . "_USER_PERSONAL_GENDER"]) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arFriends[$pref . "_USER_PERSONAL_PHOTO"] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
$arImage = CSocNetTools::InitImage($arFriends[$pref . "_USER_PERSONAL_PHOTO"], $arParams["THUMBNAIL_LIST_SIZE"], "/bitrix/images/socialnetwork/nopic_30x30.gif", 30, $pu, $canViewProfile);
} else {
// old
$arImage = CSocNetTools::InitImage($arFriends[$pref . "_USER_PERSONAL_PHOTO"], 150, "/bitrix/images/socialnetwork/nopic_user_150.gif", 150, $pu, $canViewProfile);
}
$arResult["Friends"]["List"][] = array("ID" => $arFriends["ID"], "USER_ID" => $arFriends[$pref . "_USER_ID"], "USER_NAME_FORMATED" => CSocNetUser::FormatNameEx($arFriends[$pref . "_USER_NAME"], $arFriends[$pref . "_USER_SECOND_NAME"], $arFriends[$pref . "_USER_LAST_NAME"], $arFriends[$pref . "_USER_LOGIN"], $bIntranet ? $arFriends[$pref . "_USER_EMAIL"] : "", $arFriends[$pref . "_USER_ID"]), "USER_NAME" => $arFriends[$pref . "_USER_NAME"], "USER_LAST_NAME" => $arFriends[$pref . "_USER_LAST_NAME"], "USER_SECOND_NAME" => $arFriends[$pref . "_USER_SECOND_NAME"], "USER_LOGIN" => $arFriends[$pref . "_USER_LOGIN"], "USER_PERSONAL_PHOTO" => $arFriends[$pref . "_USER_PERSONAL_PHOTO"], "USER_PERSONAL_PHOTO_FILE" => $arImage["FILE"], "USER_PERSONAL_PHOTO_IMG" => $arImage["IMG"], "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "IS_ONLINE" => $arFriends[$pref . "_USER_IS_ONLINE"] == "Y");
}
}
}
}
}
}
}
$arResult["bIntranet"] = $bIntranet;
}
$this->IncludeComponentTemplate();
示例2: SearchUser
/**
* <p>Метод ищет пользователя по его имени или коду.</p>
*
*
*
*
* @param string $user Имя или код пользователя. Если параметр является числом или
* строкой, в которой содержится число в квадратных скобках, то это
* число рассматривается как код пользователя. В противном случае
* параметр рассматривается как строка, содержащая ФИО
* пользователя.
*
*
*
* @param bool $bIntranet = false Флаг, определяющий, осуществляется ли работа в рамках решения
* интранет. Необязательный параметр. По умолчанию равен false.
*
*
*
* @return array <p>Массив пользователей, удовлетворяющих условию поиска.</p> <br><br>
*
* @static
* @link http://dev.1c-bitrix.ru/api_help/socialnetwork/classes/CSocNetUser/searchuser.php
* @author Bitrix
*/
public static function SearchUser($user, $bIntranet = false)
{
$user = Trim($user);
if (StrLen($user) <= 0) {
return false;
}
$userID = 0;
if ($user . "|" == IntVal($user) . "|") {
$userID = IntVal($user);
}
if ($userID <= 0) {
$arMatches = array();
if (preg_match("#\\[(\\d+)\\]#i", $user, $arMatches)) {
$userID = IntVal($arMatches[1]);
}
}
$dbUsers = false;
if ($userID > 0) {
$arFilter = array("ID_EQUAL_EXACT" => $userID);
$dbUsers = CUser::GetList($by = "LAST_NAME", $order = "asc", $arFilter, array("NAV_PARAMS" => false));
} else {
$email = "";
$arMatches = array();
if (preg_match("#<(.+?)>#i", $user, $arMatches)) {
if (check_email($arMatches[1])) {
$email = $arMatches[1];
$user = Trim(Str_Replace("<" . $email . ">", "", $user));
}
}
$arUser = array();
$arUserTmp = Explode(" ", $user);
foreach ($arUserTmp as $s) {
$s = Trim($s);
if (StrLen($s) > 0) {
$arUser[] = $s;
}
}
if (count($arUser) <= 0 && strlen($email) > 0) {
$arFilter = array("ACTIVE" => "Y", "EMAIL" => $email);
$dbUsers = CUser::GetList($by = "id", $order = "asc", $arFilter);
} else {
$dbUsers = CUser::SearchUserByName($arUser, $email);
}
}
if ($dbUsers) {
$arResult = array();
while ($arUsers = $dbUsers->GetNext()) {
$arResult[$arUsers["ID"]] = CSocNetUser::FormatNameEx($arUsers["NAME"], $arUsers["SECOND_NAME"], $arUsers["LAST_NAME"], $arUsers["LOGIN"], $bIntranet ? $arUsers["EMAIL"] : "", $arUsers["ID"]);
}
return $arResult;
}
return false;
}
示例3: __ShowUserField
function __ShowUserField($name, $value, $form_name)
{
?>
<input type="radio" name="USER_TYPE_<?php
echo $name;
?>
" id="ID_USER_TYPE_NONE_<?php
echo $name;
?>
"<?php
echo StrLen($value) <= 0 ? " checked" : "";
?>
value="none">
<label for="ID_USER_TYPE_NONE_<?php
echo $name;
?>
"><?php
echo GetMessage("INTVT_NOT_SET");
?>
</label><br />
<input type="radio" name="USER_TYPE_<?php
echo $name;
?>
" id="ID_USER_TYPE_CURRENT_<?php
echo $name;
?>
"<?php
echo $value == "current" ? " checked" : "";
?>
value="current">
<label for="ID_USER_TYPE_CURRENT_<?php
echo $name;
?>
"><?php
echo GetMessage("INTVT_CUR_USER");
?>
</label><br />
<input type="radio" name="USER_TYPE_<?php
echo $name;
?>
" id="ID_USER_TYPE_SELECTED_<?php
echo $name;
?>
"<?php
echo StrLen($value) > 0 && $value != "current" ? " checked" : "";
?>
value="selected">
<label for="ID_USER_TYPE_SELECTED_<?php
echo $name;
?>
"><?php
echo GetMessage("INTVT_THIS_USER");
?>
</label><br /><br />
<?php
$val = "";
if (StrLen($value) > 0 && $value != "current") {
$dbUser = CUser::GetByID($value);
$arUser = $dbUser->Fetch();
$val = CSocNetUser::FormatNameEx($arUser["NAME"], $arUser["SECOND_NAME"], $arUser["LAST_NAME"], $arUser["LOGIN"], $arUser["EMAIL"], $arUser["ID"]);
}
if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
$bExtranet = true;
} elseif (CModule::IncludeModule('extranet')) {
$bIntranet = true;
}
$GLOBALS["APPLICATION"]->IncludeComponent("bitrix:socialnetwork.user_search_input", ".default", array("TEXT" => "style='width:98%'", "NAME" => $name, "FUNCTION" => "", "EXTRANET" => $bExtranet ? "E" : ($bIntranet ? "I" : ""), "VALUE" => htmlspecialcharsback($val)), null, array('HIDE_ICONS' => 'Y'));
}