本文整理汇总了PHP中CIntranetUtils::createAvatar方法的典型用法代码示例。如果您正苦于以下问题:PHP CIntranetUtils::createAvatar方法的具体用法?PHP CIntranetUtils::createAvatar怎么用?PHP CIntranetUtils::createAvatar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIntranetUtils
的用法示例。
在下文中一共展示了CIntranetUtils::createAvatar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLastSelectedUsers
public static function getLastSelectedUsers($arManagers, $bSubordinateOnly = false, $nameTemplate = '', $siteId = SITE_ID)
{
/** @var CAllUser $USER */
static $arLastUsers;
global $USER, $arParams;
$cacheKey = md5(serialize($arManagers) . (string) $bSubordinateOnly . '|' . $nameTemplate . '|' . (string) $siteId);
if (!isset($arLastUsers[$cacheKey])) {
$arSubDeps = CIntranetUtils::getSubordinateDepartments($USER->GetID(), true);
if (!class_exists('CUserOptions')) {
include_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/classes/" . $GLOBALS['DBType'] . "/favorites.php";
}
$arLastSelected = CUserOptions::GetOption("intranet", "user_search", array());
if (is_array($arLastSelected) && strlen($arLastSelected['last_selected']) > 0) {
$arLastSelected = array_unique(explode(',', $arLastSelected['last_selected']));
} else {
$arLastSelected = false;
}
if (is_array($arLastSelected)) {
$currentUser = array_search($USER->getID(), $arLastSelected);
if ($currentUser !== false) {
unset($arLastSelected[$currentUser]);
}
array_unshift($arLastSelected, $USER->getID());
} elseif ($USER->getID()) {
$arLastSelected = array($USER->getID());
}
$arFilter = array('ACTIVE' => 'Y');
if ($bSubordinateOnly) {
$arFilter["UF_DEPARTMENT"] = $arSubDeps;
} else {
$arFilter['!UF_DEPARTMENT'] = false;
}
// Prevent using users, that doesn't activate it's account
// http://jabber.bx/view.php?id=29118
if (IsModuleInstalled('bitrix24')) {
$arFilter['CONFIRM_CODE'] = false;
}
$arFilter['ID'] = is_array($arLastSelected) ? implode('|', array_slice($arLastSelected, 0, 10)) : '-1';
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', $arFilter, array('SELECT' => array('UF_DEPARTMENT')));
$arLastUsers[$cacheKey] = array();
while ($arRes = $dbRes->GetNext()) {
$arLastUsers[$cacheKey][$arRes['ID']] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat() : $nameTemplate, $arRes, true, false), '~NAME' => CUser::FormatName(empty($nameTemplate) ? CSite::GetNameFormat() : $nameTemplate, array("NAME" => $arRes["~NAME"], "LAST_NAME" => $arRes["~LAST_NAME"], "LOGIN" => $arRes["~LOGIN"], "SECOND_NAME" => $arRes["~SECOND_NAME"]), true, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => $arRes['WORK_POSITION'] ? $arRes['WORK_POSITION'] : $arRes['PERSONAL_PROFESSION'], '~WORK_POSITION' => $arRes['~WORK_POSITION'] ? $arRes['~WORK_POSITION'] : $arRes['~PERSONAL_PROFESSION'], 'PHOTO' => (string) CIntranetUtils::createAvatar($arRes, array(), $siteId), 'HEAD' => false, 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
}
}
return $arLastUsers[$cacheKey];
}
示例2: array
$notSelectedUsersId = $arParams['VALUE'];
// Prevent using users, that doesn't activate it's account
// http://jabber.bx/view.php?id=29118
if (IsModuleInstalled('bitrix24')) {
$arFilter['CONFIRM_CODE'] = false;
}
$dbRes = CUser::GetList($by = 'last_name', $order = 'asc', $arFilter, array('SELECT' => array('UF_DEPARTMENT')));
while ($arRes = $dbRes->GetNext()) {
if (($key = array_search($arRes['ID'], $notSelectedUsersId)) !== false) {
//if user already selected, then we not select from extranet
unset($notSelectedUsersId[$key]);
}
$arResult["CURRENT_USERS"][] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName($arParams["NAME_TEMPLATE"], $arRes, true, false), '~NAME' => CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $arRes["~NAME"], "LAST_NAME" => $arRes["~LAST_NAME"], "LOGIN" => $arRes["~LOGIN"], "SECOND_NAME" => $arRes["~SECOND_NAME"]), true, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => $arRes['WORK_POSITION'] ? $arRes['WORK_POSITION'] : $arRes['PERSONAL_PROFESSION'], '~WORK_POSITION' => $arRes['~WORK_POSITION'] ? $arRes['~WORK_POSITION'] : $arRes['~PERSONAL_PROFESSION'], 'PHOTO' => (string) CIntranetUtils::createAvatar($arRes, array(), $arParams['SITE_ID']), 'HEAD' => false, 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
}
if ($notSelectedUsersId && CModule::IncludeModule('extranet')) {
foreach (CIntranetUserSelectorHelper::getExtranetUsers(implode('|', $notSelectedUsersId)) as $arRes) {
$arResult["CURRENT_USERS"][] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName($arParams["NAME_TEMPLATE"], $arRes, true, false), '~NAME' => CUser::FormatName($arParams["NAME_TEMPLATE"], array("NAME" => $arRes["~NAME"], "LAST_NAME" => $arRes["~LAST_NAME"], "LOGIN" => $arRes["~LOGIN"], "SECOND_NAME" => $arRes["~SECOND_NAME"]), true, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => $arRes['WORK_POSITION'] ? $arRes['WORK_POSITION'] : $arRes['PERSONAL_PROFESSION'], '~WORK_POSITION' => $arRes['~WORK_POSITION'] ? $arRes['~WORK_POSITION'] : $arRes['~PERSONAL_PROFESSION'], 'PHOTO' => (string) CIntranetUtils::createAvatar($arRes, array(), $arParams['SITE_ID']), 'HEAD' => false, 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
}
unset($arRes);
}
}
$arResult['FIXED_USERS'] = isset($arParams['FIXED_USERS']) && is_array($arParams['FIXED_USERS']) ? $arParams['FIXED_USERS'] : array();
$groups = array();
if ($arParams["DISPLAY_TAB_GROUP"] == 'Y') {
$groups = CIntranetUserSelectorHelper::getUserGroups($USER->GetID());
}
$arResult["GROUPS"] = $groups;
$arResult["CURRENT_USERS"] = array_values(array_filter($arResult["CURRENT_USERS"], array('CIntranetUserSelectorHelper', 'filterViewableUsers')));
$arResult["LAST_USERS"] = array_values(array_filter($arResult["LAST_USERS"], array('CIntranetUserSelectorHelper', 'filterViewableUsers')));
CUtil::InitJSCore(array("tooltip"));
$this->IncludeComponentTemplate();
示例3: elseif
$arFilter["!UF_DEPARTMENT"] = false;
} elseif (IsModuleInstalled("extranet") && $showExtranetUsers != SHOW_ALL) {
if ($showExtranetUsers == SHOW_FROM_MY_GROUPS && CModule::IncludeModule("extranet")) {
$arFilteredUserIDs = CExtranet::GetMyGroupsUsersSimple(CExtranet::GetExtranetSiteID());
} elseif ($showExtranetUsers == SHOW_FROM_EXACT_GROUP) {
$arFilteredUserIDs = array();
if (CModule::IncludeModule("socialnetwork")) {
$dbUsers = CSocNetUserToGroup::GetList(array(), array("GROUP_ID" => array($exGroupID), "<=ROLE" => SONET_ROLES_USER, "USER_ACTIVE" => "Y"), false, false, array("ID", "USER_ID"));
if ($dbUsers) {
while ($arUser = $dbUsers->GetNext()) {
$arFilteredUserIDs[] = $arUser["USER_ID"];
}
}
}
}
if (is_array($arFilteredUserIDs) && empty($arFilteredUserIDs)) {
$arFilter["!UF_DEPARTMENT"] = false;
} elseif (is_array($arFilteredUserIDs)) {
$arFilter[] = array('LOGIC' => 'OR', '!UF_DEPARTMENT' => false, 'ID' => $arFilteredUserIDs);
}
}
$arFilter["CONFIRM_CODE"] = false;
$dbRes = \Bitrix\Main\UserTable::getList(array('order' => array('SORT_WEIGHT' => 'DESC', 'LAST_NAME' => 'ASC', 'NAME' => 'ASC'), 'filter' => $arFilter, 'select' => array("ID", "NAME", "LAST_NAME", "SECOND_NAME", "EMAIL", "LOGIN", "WORK_POSITION", "PERSONAL_PROFESSION", "PERSONAL_PHOTO", "PERSONAL_GENDER", "UF_DEPARTMENT", $sortWeight), 'limit' => 10, 'data_doubling' => false));
while ($arRes = $dbRes->fetch()) {
$arUsers[] = array('ID' => $arRes['ID'], 'NAME' => CUser::FormatName($nameTemplate, $arRes, $bUseLogin, false), 'LOGIN' => $arRes['LOGIN'], 'EMAIL' => $arRes['EMAIL'], 'WORK_POSITION' => $arRes['WORK_POSITION'] ? $arRes['WORK_POSITION'] : $arRes['PERSONAL_PROFESSION'], 'PHOTO' => (string) CIntranetUtils::createAvatar($arRes, array()), 'HEAD' => false, 'UF_DEPARTMENT' => $arRes['UF_DEPARTMENT'], 'SUBORDINATE' => is_array($arSubDeps) && is_array($arRes['UF_DEPARTMENT']) && array_intersect($arRes['UF_DEPARTMENT'], $arSubDeps) ? 'Y' : 'N', 'SUPERORDINATE' => in_array($arRes["ID"], $arManagers) ? 'Y' : 'N');
}
}
Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET);
echo CUtil::PhpToJsObject(array_values(array_filter($arUsers, array('CIntranetUserSelectorHelper', 'filterViewableUsers'))));
die;
}