2namespace Bitrix\Main\Rest;
9class Rating extends \IRestService
11 const LIST_LIMIT = 20;
13 public static function getLikeReactions(
$query, $nav = 0, \CRestServer $server)
17 $entityTypeId = (
$query[
'entity_type_id'] ??
'');
25 throw new Rest\RestException(
"Wrong entity data.", Rest\RestException::ERROR_ARGUMENT, \CRestServer::STATUS_WRONG_REQUEST);
28 $reactionResult = \CRatings::getRatingVoteReaction(
array(
29 "ENTITY_TYPE_ID" => $entityTypeId,
31 "USE_REACTIONS_CACHE" =>
'Y'
34 return $reactionResult[
'reactions'];
37 public static function getLikeList(
$query, $nav = 0, \CRestServer $server)
45 $entityTypeId = (
$query[
'entity_type_id'] ??
'');
47 $reaction = (
$query[
'reaction'] ??
false);
55 throw new Rest\RestException(
"Wrong entity data.", Rest\RestException::ERROR_ARGUMENT, \CRestServer::STATUS_WRONG_REQUEST);
59 "ENTITY_TYPE_ID" => $entityTypeId,
63 "LIST_TYPE" =>
'plus',
64 "USE_REACTIONS_CACHE" =>
'Y'
67 $extranetInstalled = $mailInstalled =
false;
70 $extranetInstalled =
true;
71 $queryParams[
"USER_SELECT"] =
array(
"UF_DEPARTMENT");
75 $mailInstalled =
true;
76 $queryParams[
"USER_FIELDS"] =
array(
"ID",
"NAME",
"LAST_NAME",
"SECOND_NAME",
"LOGIN",
"PERSONAL_PHOTO",
"EXTERNAL_AUTH_ID");
79 if (!empty($reaction))
81 $queryParams[
"REACTION"] = $reaction;
84 $res = \CRatings::getRatingVoteList($queryParams);
87 'items_all' =>
$res[
'items_all'],
88 'items_reaction' => ($reaction && isset(
$res[
'reactions']) && isset(
$res[
'reactions'][$reaction]) ? intval(
$res[
'reactions'][$reaction]) : 0),
89 'items_page' =>
$res[
'items_page'],
93 foreach(
$res[
'items'] as
$key => $value)
96 'USER_ID' => $value[
'ID'],
97 'VOTE_VALUE' => $value[
'VOTE_VALUE'],
98 'PHOTO' => $value[
'PHOTO'],
99 'PHOTO_SRC' => $value[
'PHOTO_SRC'],
100 'FULL_NAME' => $value[
'FULL_NAME'],
102 "UID" => $value[
"USER_ID"],
103 "user_id" => $value[
"USER_ID"],
104 "USER_ID" => $value[
"USER_ID"]
110 && $value[
"EXTERNAL_AUTH_ID"] ==
"email"
113 $userVote[
"USER_TYPE"] =
"mail";
118 empty($value[
"UF_DEPARTMENT"])
119 || intval($value[
"UF_DEPARTMENT"][0]) <= 0
123 $userVote[
"USER_TYPE"] =
"extranet";
126 $voteList[
'items'][] = $userVote;
130 $USER->isAuthorized()
136 'onRatingListViewed',
138 'entityTypeId' => $entityTypeId,
140 'userId' =>
$USER->getId()
146 return static::setNavData($voteList[
'items'],
array(
147 "count" => ($reaction && $reaction !=
'all' ? $voteList[
'items_reaction'] : $voteList[
'items_all']),
static includeModule($moduleName)
static isModuleInstalled($moduleName)
static makePathFromTemplate($template, $arParams=array())
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(Main\Loader::includeModule("rest")) endif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key