本文整理汇总了PHP中CExtranet::GetMyGroupsUsersFull方法的典型用法代码示例。如果您正苦于以下问题:PHP CExtranet::GetMyGroupsUsersFull方法的具体用法?PHP CExtranet::GetMyGroupsUsersFull怎么用?PHP CExtranet::GetMyGroupsUsersFull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CExtranet
的用法示例。
在下文中一共展示了CExtranet::GetMyGroupsUsersFull方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$dbFriends = CSocNetUserRelations::GetRelatedUsers($arResult["UserSelf"]["ID"], SONET_RELATIONS_FRIEND);
if ($dbFriends) {
$arResult["Friends"] = array();
while ($arFriends = $dbFriends->GetNext()) {
$pref = IntVal($arResult["UserSelf"]["ID"]) == $arFriends["FIRST_USER_ID"] ? "SECOND" : "FIRST";
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arFriends[$pref . "_USER_ID"]));
$canViewProfile = CSocNetUserPerms::CanPerformOperation($arResult["UserSelf"]["ID"], $arFriends[$pref . "_USER_ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$arTmpUser = array("NAME" => $arFriends["~" . $pref . "_USER_NAME"], "LAST_NAME" => $arFriends["~" . $pref . "_USER_LAST_NAME"], "SECOND_NAME" => $arFriends["~" . $pref . "_USER_SECOND_NAME"], "LOGIN" => $arFriends["~" . $pref . "_USER_LOGIN"]);
$strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arTmpUser, $bUseLogin);
$arResult["Friends"][] = array("USER_ID" => $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_NAME_FORMATTED" => $strNameFormatted, "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "PATH_TO_MESSAGES_CHAT" => str_replace("#user_id#", $arFriends[$pref . "_USER_ID"], $arParams["PATH_TO_MESSAGES_CHAT"]), "IS_ONLINE" => $arFriends[$pref . "_USER_IS_ONLINE"] == "Y");
}
}
} elseif (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite()) {
$arResult["Friends"] = array();
$arUsersInListID = array();
$arMyGroupsUsers = CExtranet::GetMyGroupsUsersFull(SITE_ID, true);
foreach ($arMyGroupsUsers as $arUser) {
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));
$canViewProfile = CSocNetUserPerms::CanPerformOperation($arResult["UserSelf"]["ID"], $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin);
$arResult["Friends"][] = array("USER_ID" => $arUser["ID"], "USER_NAME" => $arUser["NAME"], "USER_LAST_NAME" => $arUser["LAST_NAME"], "USER_SECOND_NAME" => $arUser["SECOND_NAME"], "USER_LOGIN" => $arUser["LOGIN"], "USER_NAME_FORMATTED" => $strNameFormatted, "USER_PROFILE_URL" => $pu, "SHOW_PROFILE_LINK" => $canViewProfile, "PATH_TO_MESSAGES_CHAT" => str_replace("#user_id#", $arUser["ID"], $arParams["PATH_TO_MESSAGES_CHAT"]), "IS_ONLINE" => $arUser["IS_ONLINE"] == "Y");
$arUsersInListID[] = $arUser["ID"];
}
$arPublicUsers = CExtranet::GetPublicUsers(true);
foreach ($arPublicUsers as $arUser) {
if (in_array($arUser["ID"], $arUsersInListID)) {
continue;
}
$pu = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_USER"], array("user_id" => $arUser["ID"]));
$canViewProfile = CSocNetUserPerms::CanPerformOperation($arResult["UserSelf"]["ID"], $arUser["ID"], "viewprofile", CSocNetUser::IsCurrentUserModuleAdmin());
$strNameFormatted = CUser::FormatName($arParams['NAME_TEMPLATE'], $arUser, $bUseLogin);
示例2: array
}
}
if (!$arGadgetParams['DETAIL_URL']) {
$arGadgetParams['DETAIL_URL'] = SITE_DIR . "personal/user/#ID#/";
}
if (!$arGadgetParams['MESSAGES_CHAT_URL']) {
$arGadgetParams['MESSAGES_CHAT_URL'] = SITE_DIR . "personal/messages/chat/#ID#/";
}
if (!$arGadgetParams['FULLLIST_URL']) {
$arGadgetParams['FULLLIST_URL'] = SITE_DIR . "contacts/";
}
if (!$arGadgetParams['EMPLOYEES_FULLLIST_URL']) {
$arGadgetParams['EMPLOYEES_FULLLIST_URL'] = SITE_DIR . "contacts/employees.php";
}
$APPLICATION->SetAdditionalCSS('/bitrix/gadgets/bitrix/extranet_contacts/styles.css');
$arUsersInMyGroups = CExtranet::GetMyGroupsUsersFull(SITE_ID, true, true);
$arPublicUsers = CExtranet::GetPublicUsers(true);
$arUsersInMyGroupsFmt = array();
$arPublicUsersFmt = array();
?>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<?php
echo "<tr><td colspan='2'><b>" . GetMessage('GD_CONTACTS_MYGROUPS_USERS') . "</b></td></tr>";
$arUsersInListID = array();
foreach ($arUsersInMyGroups as $arUser) {
$arUsersInListID[] = $arUser["ID"];
_FormatUser($arUser, $arGadgetParams);
$arUsersInMyGroupsFmt[] = $arUser;
}
uasort($arUsersInMyGroupsFmt, '_SortByLastMessage');
$nCount = 1;
示例3: GetUsers
public static function GetUsers($arParams = array(), $bSelf = true)
{
global $USER;
$userId = intval($USER->GetID());
if (isset($arParams['all']) && $arParams['all'] == 'Y') {
if (IsModuleInstalled("intranet")) {
return self::GetUsersAll($arParams);
} else {
$arParamsNew = $arParams;
$arParamsNew["id"] = array($userId);
unset($arParamsNew["all"]);
return CSocNetLogDestination::GetUsers($arParamsNew, $bSelf);
}
}
$bExtranet = false;
$arFilter = array('ACTIVE' => 'Y');
if (IsModuleInstalled("intranet") || COption::GetOptionString("main", "new_user_registration_email_confirmation", "N") == "Y") {
$arFilter["CONFIRM_CODE"] = false;
}
$arExtParams = array("FIELDS" => array("ID", "LAST_NAME", "NAME", "SECOND_NAME", "LOGIN", "PERSONAL_PHOTO", "WORK_POSITION", "PERSONAL_PROFESSION", "IS_ONLINE"));
if (isset($arParams['id'])) {
if (empty($arParams['id'])) {
$arFilter['ID'] = $userId;
} else {
$arSelect = array($userId);
foreach ($arParams['id'] as $value) {
if (intval($value) > 0 && !in_array($value, $arSelect)) {
$arSelect[] = intval($value);
}
}
sort($arSelect);
$arFilter['ID'] = implode('|', $arSelect);
}
} elseif (isset($arParams['deportament_id'])) {
if (is_array($arParams['deportament_id'])) {
$arFilter['UF_DEPARTMENT'] = $arParams['deportament_id'];
} else {
if ($arParams['deportament_id'] == 'EX') {
$bExtranet = true;
} else {
$arFilter['UF_DEPARTMENT'] = intval($arParams['deportament_id']);
}
}
$arExtParams['SELECT'] = array('UF_DEPARTMENT');
}
$cacheTtl = 3153600;
$cacheId = 'socnet_destination_getusers_' . md5(serialize($arFilter)) . $bSelf . ($bExtranet ? '_ex_' . $userId : '');
$cacheDir = '/socnet/dest/' . (isset($arParams['id']) ? 'user' : 'dept') . '/';
$obCache = new CPHPCache();
if ($obCache->InitCache($cacheTtl, $cacheId, $cacheDir)) {
$arUsers = $obCache->GetVars();
} else {
$obCache->StartDataCache();
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->StartTagCache($cacheDir);
}
if ($bExtranet && CModule::IncludeModule("extranet")) {
$arUsers = array();
$arExtranetUsers = CExtranet::GetMyGroupsUsersFull(CExtranet::GetExtranetSiteID(), $bSelf);
foreach ($arExtranetUsers as $arUserTmp) {
$sName = trim(CUser::FormatName(empty($arParams["NAME_TEMPLATE"]) ? CSite::GetNameFormat(false) : $arParams["NAME_TEMPLATE"], $arUserTmp, true, false));
if (empty($sName)) {
$sName = $arUserTmp["~LOGIN"];
}
$arFileTmp = CFile::ResizeImageGet($arUserTmp["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
$arUsers['U' . $arUserTmp["ID"]] = array('id' => 'U' . $arUserTmp["ID"], 'entityId' => $arUserTmp["ID"], 'name' => $sName, 'avatar' => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], 'desc' => $arUserTmp['WORK_POSITION'] ? $arUserTmp['WORK_POSITION'] : ($arUserTmp['PERSONAL_PROFESSION'] ? $arUserTmp['PERSONAL_PROFESSION'] : ' '));
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . IntVal($arUserTmp["ID"]));
}
}
} else {
$bExtranetInstalled = CModule::IncludeModule("extranet");
CSocNetTools::InitGlobalExtranetArrays();
if (!isset($arFilter['UF_DEPARTMENT']) && $bExtranetInstalled) {
$arUserIdVisible = CExtranet::GetMyGroupsUsersSimple(SITE_ID);
}
$arUsers = array();
$dbUsers = CUser::GetList($sort_by = array('last_name' => 'asc', 'IS_ONLINE' => 'desc'), $dummy = '', $arFilter, $arExtParams);
while ($arUser = $dbUsers->GetNext()) {
if (!$bSelf && is_object($USER) && $userId == $arUser["ID"]) {
continue;
}
if (!isset($arFilter['UF_DEPARTMENT']) && $bExtranetInstalled) {
if (isset($arUser["UF_DEPARTMENT"]) && (!is_array($arUser["UF_DEPARTMENT"]) || empty($arUser["UF_DEPARTMENT"]) || intval($arUser["UF_DEPARTMENT"][0]) <= 0) && (empty($arUserIdVisible) || !is_array($arUserIdVisible) || !in_array($arUser["ID"], $arUserIdVisible))) {
continue;
}
}
$sName = trim(CUser::FormatName(empty($arParams["NAME_TEMPLATE"]) ? CSite::GetNameFormat(false) : $arParams["NAME_TEMPLATE"], $arUser, true, false));
if (empty($sName)) {
$sName = $arUser["~LOGIN"];
}
$arFileTmp = CFile::ResizeImageGet($arUser["PERSONAL_PHOTO"], array('width' => 32, 'height' => 32), BX_RESIZE_IMAGE_EXACT, false);
$arUsers['U' . $arUser["ID"]] = array('id' => 'U' . $arUser["ID"], 'entityId' => $arUser["ID"], 'name' => $sName, 'avatar' => empty($arFileTmp['src']) ? '' : $arFileTmp['src'], 'desc' => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : ($arUser['PERSONAL_PROFESSION'] ? $arUser['PERSONAL_PROFESSION'] : ' '), 'isExtranet' => isset($GLOBALS["arExtranetUserID"]) && is_array($GLOBALS["arExtranetUserID"]) && in_array($arUser["ID"], $GLOBALS["arExtranetUserID"]) ? "Y" : "N");
$arUsers['U' . $arUser["ID"]]['checksum'] = md5(serialize($arUsers['U' . $arUser["ID"]]));
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->RegisterTag("USER_NAME_" . IntVal($arUser["ID"]));
}
}
}
if (defined("BX_COMP_MANAGED_CACHE")) {
//.........这里部分代码省略.........
示例4: AjaxRequest
public function AjaxRequest($arParams = false)
{
global $USER;
if (!$USER->IsAuthorized()) {
return false;
}
$elements = "";
if ($_REQUEST['action'] == 'structure-item') {
$arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 'structure-item');
//be careful with field list because of CUser::FormatName()
if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser($arParams["SITE_ID"])) {
$arExtranetUsers = CExtranet::GetMyGroupsUsersFull(CExtranet::GetExtranetSiteID(), false);
$dbRes = new CDBResult();
$dbRes->InitFromArray($arExtranetUsers);
} else {
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', array('ACTIVE' => 'Y', 'CONFIRM_CODE' => false, 'UF_DEPARTMENT' => intval($_REQUEST['item'])), array("FIELDS" => array('ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'EMAIL', 'PERSONAL_PHOTO', 'PERSONAL_GENDER', 'WORK_POSITION', 'PERSONAL_PROFESSION')));
}
while ($arUser = $dbRes->Fetch()) {
$arPhoto = array('IMG' => '');
if (!$arUser['PERSONAL_PHOTO']) {
switch ($arUser['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arUser['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
if ($arUser['PERSONAL_PHOTO'] > 0) {
$arPhoto = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30);
}
$arItem = array("ID" => "IU" . $arUser["ID"], "NAME" => CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false), "AVATAR" => $arPhoto['CACHE']['src'], "DESC" => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : $arUser['PERSONAL_PROFESSION']);
$elements .= CFinder::GetFinderItem($arFinderParams, $arItem);
}
} else {
$search = urldecode($_REQUEST['search']);
if (!CModule::IncludeModule('extranet') || CExtranet::IsIntranetUser($arParams["SITE_ID"])) {
$arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 4);
$dbRes = CIBlockSection::GetList(array('ID' => 'ASC'), array('IBLOCK_ID' => COption::GetOptionInt('intranet', 'iblock_structure'), '%NAME' => $search), false, array('ID', 'NAME'));
$dbRes->NavStart(7);
while ($arSection = $dbRes->NavNext(false)) {
$arItem = array("ID" => $arSection["ID"], "AVATAR" => "/bitrix/js/main/core/images/access/avatar-user-everyone.png", "NAME" => $arSection["NAME"], "DESC" => GetMessage("authprov_group"), "CHECKBOX" => array("D#ID#" => GetMessage("authprov_check_d"), "DR#ID#" => GetMessage("authprov_check_dr")));
$elements .= CFinder::GetFinderItem($arFinderParams, $arItem);
}
}
$arFinderParams = array("PROVIDER" => $this->id, "TYPE" => 3);
$arFilter = array("ACTIVE" => "Y", "CONFIRM_CODE" => false, "NAME_SEARCH" => $search);
if (CModule::IncludeModule('extranet') && !CExtranet::IsIntranetUser($arParams["SITE_ID"])) {
$arExtranetUsersId = CExtranet::GetMyGroupsUsers($arParams["SITE_ID"]);
if (count($arExtranetUsersId) > 0) {
$arFilter["ID"] = implode('|', $arExtranetUsersId);
} else {
$arFilter = false;
}
}
if ($arFilter) {
//be careful with field list because of CUser::FormatName()
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', $arFilter, array("FIELDS" => array('ID', 'NAME', 'LAST_NAME', 'SECOND_NAME', 'LOGIN', 'EMAIL', 'PERSONAL_PHOTO', 'PERSONAL_GENDER', 'WORK_POSITION', 'PERSONAL_PROFESSION'), "NAV_PARAMS" => array("nTopCount" => 7)));
while ($arUser = $dbRes->Fetch()) {
$arPhoto = array('IMG' => '');
if (!$arUser['PERSONAL_PHOTO']) {
switch ($arUser['PERSONAL_GENDER']) {
case "M":
$suffix = "male";
break;
case "F":
$suffix = "female";
break;
default:
$suffix = "unknown";
}
$arUser['PERSONAL_PHOTO'] = COption::GetOptionInt("socialnetwork", "default_user_picture_" . $suffix, false, SITE_ID);
}
if ($arUser['PERSONAL_PHOTO'] > 0) {
$arPhoto = CIntranetUtils::InitImage($arUser['PERSONAL_PHOTO'], 30);
}
$arItem = array("ID" => "IU" . $arUser["ID"], "NAME" => CUser::FormatName(CSite::GetNameFormat(false), $arUser, true, false), "AVATAR" => $arPhoto['CACHE']['src'], "DESC" => $arUser['WORK_POSITION'] ? $arUser['WORK_POSITION'] : $arUser['PERSONAL_PROFESSION']);
$elements .= CFinder::GetFinderItem($arFinderParams, $arItem);
}
}
}
return $elements;
}