26 || !isset($params[
'tag'])
27 || trim($params[
'tag']) ===
''
33 $tag = trim($params[
'tag']);
35 $currentUserId = (isset($params[
'currentUserId']) ? (int)$params[
'currentUserId'] : 0);
36 $avatarSize = (isset($params[
'avatarSize']) ? (int)$params[
'avatarSize'] : 100);
37 $pageSize = (isset($params[
'pageSize']) ? (int)$params[
'pageSize'] : 10);
38 $pageNum = (!empty($params[
'page']) ? (int)$params[
'page'] : 1);
39 $pathToUser = (!empty($params[
'pathToUser']) ? $params[
'pathToUser'] :
'');
41 $ratingId = (int)\CRatings::getAuthorityRating();
51 ModuleManager::isModuleInstalled(
'intranet')
53 'SUBORDINATE.VOTES' =>
'DESC'
62 ModuleManager::isModuleInstalled(
'intranet')
64 new \Bitrix\Main\Entity\ReferenceField(
66 '\Bitrix\Intranet\RatingSubordinateTable',
67 Entity\
Query\Join::on(
'this.USER_ID',
'ref.ENTITY_ID')->where(
'ref.RATING_ID', $ratingId),
68 [
"join_type" =>
"left"]
73 'select' => [
'USER_ID' ]
76 if (isset($params[
'pageSize']))
78 $queryParams[
'limit'] = $pageSize;
79 $queryParams[
'offset'] = ($pageNum - 1) * $pageSize;
82 $res = UserTagTable::getList($queryParams);
84 while ($fields = $res->fetch())
86 $userIdList[] = $fields[
'USER_ID'];
89 if (!empty($userIdList))
92 'userIdList' => $userIdList,
93 'pathToUser' => $pathToUser,
94 'avatarSize' => $avatarSize
97 foreach($userIdList as $userId)
99 if (isset($userData[$userId]))
101 $result[
'USERS'][] = $userData[$userId];
106 $result[
'CAN_ADD'] =
'N';
107 if ($currentUserId > 0)
109 $res = UserTagTable::getList([
111 'USER_ID' => $currentUserId,
115 if (!($res->fetch()))
117 $result[
'CAN_ADD'] =
'Y';
130 && !is_array($params)
136 $userIdList = (!empty($params[
'userIdList']) && is_array($params[
'userIdList']) ? $params[
'userIdList'] : []);
137 $avatarSize = (!empty($params[
'avatarSize']) && (int)$params[
'avatarSize'] > 0 ? (
int)$params[
'avatarSize'] : 100);
139 if (empty($userIdList))
144 $select = [
'ID',
'NAME',
'LAST_NAME',
'SECOND_NAME',
'LOGIN',
'PERSONAL_PHOTO',
'PERSONAL_GENDER' ];
146 $getListClassName =
'\Bitrix\Main\UserTable';
147 if (Loader::includeModule(
'intranet'))
149 $getListClassName =
'\Bitrix\Intranet\UserTable';
150 $select[] =
'USER_TYPE';
152 $getListMethodName =
'getList';
154 $res = $getListClassName::$getListMethodName(array(
161 while ($userFields = $res->fetch())
163 $result[$userFields[
"ID"]] = array(
164 'ID' => $userFields[
"ID"],
165 'NAME_FORMATTED' => \CUser::formatName(
166 \CSite::getNameFormat(
false),
170 'PERSONAL_PHOTO' => array(
171 'ID' => $userFields[
'PERSONAL_PHOTO'],
174 'PERSONAL_GENDER' => $userFields[
'PERSONAL_GENDER'],
175 'URL' => \CComponentEngine::makePathFromTemplate($params[
'pathToUser'], array(
'user_id' => $userFields[
'ID'])),
176 'TYPE' => (!empty($userFields[
'USER_TYPE']) ? $userFields[
'USER_TYPE'] :
'')
179 if ((
int)$userFields[
'PERSONAL_PHOTO'] > 0)
181 $imageFile = \CFile::getFileArray($userFields[
"PERSONAL_PHOTO"]);
182 if ($imageFile !==
false)
184 $file = \CFile::resizeImageGet(
186 array(
"width" => $avatarSize,
"height" => $avatarSize),
187 BX_RESIZE_IMAGE_EXACT,
190 $result[$userFields[
"ID"]][
'PERSONAL_PHOTO'][
'SRC'] = $file[
'src'];