174 ? intval(
$params[
'avatarSize'])
191 ? (is_array($tagName)) ?
" NAME IN (".implode(
',', array_map(
function(
$val) use (
$DB) {
return "'".$DB->forSql(
$val).
"'"; }, $tagName)).
")" :
" NAME = '".$DB->forSql($tagName).
"'"
195 $whereClause = (!empty($nameFilter) ?
'WHERE '.$nameFilter :
'');
197 $tagsSql =
'SELECT NAME FROM '.self::getTableName().
' '.$whereClause;
199 if (\
Bitrix\
Main\ModuleManager::isModuleInstalled(
'intranet'))
201 $ratingId = \CRatings::getAuthorityRating();
202 if (intval($ratingId) <= 0)
209 RS1.ENTITY_ID as USER_ID,
211 MAX(RS1.VOTES) as WEIGHT
213 b_rating_subordinate RS1,
215 INNER JOIN b_user U ON U.ID = UT1.USER_ID
217 RS1.RATING_ID = ".(
int) $ratingId.
"
218 AND RS1.ENTITY_ID = UT1.USER_ID
219 AND UT1.NAME IN (".$tagsSql.
")
222 UT1.NAME, RS1.ENTITY_ID
232 UT1.USER_ID as USER_ID,
234 FROM b_sonet_user_tag UT1
235 INNER JOIN b_user U ON U.ID = UT1.USER_ID
237 UT1.NAME IN (".$tagsSql.
")
244 $userWeightData = $tagUserData =
array();
246 $currentTagName =
false;
249 while ($resultFields =
$res->fetch())
253 && $resultFields[
'USER_ID'] ==
$USER->getId()
259 if ($resultFields[
'NAME'] != $currentTagName)
263 $tagUserData[$resultFields[
'NAME']] =
array();
266 $currentTagName = $resultFields[
'NAME'];
269 if ($cnt > ($hasMine ? $topCount+1 : $topCount))
274 $tagUserData[$resultFields[
'NAME']][] = $resultFields[
'USER_ID'];
275 if (!isset($userWeightData[$resultFields[
'USER_ID']]))
277 $userWeightData[$resultFields[
'USER_ID']] = floatval($resultFields[
'WEIGHT']);
282 'userIdList' => array_keys($userWeightData),
283 'avatarSize' => $avatarSize
286 foreach($tagUserData as $tagName => $userIdList)
290 foreach($userIdList as
$userId)
294 'NAME_FORMATTED' => $userData[
$userId][
'NAME_FORMATTED'],
295 'PERSONAL_PHOTO' => $userData[
$userId][
'PERSONAL_PHOTO'][
'ID'],
296 'PERSONAL_PHOTO_SRC' => $userData[
$userId][
'PERSONAL_PHOTO'][
'SRC'],
297 'PERSONAL_GENDER' => $userData[
$userId][
'PERSONAL_GENDER'],
298 'WEIGHT' => $userWeightData[
$userId]
309 if (
$a[
'WEIGHT'] == $b[
'WEIGHT'])
313 return (
$a[
'WEIGHT'] > $b[
'WEIGHT']) ? -1 : 1;