25 'ELEMENT_ID_LIST' => [],
29 $userId = (!empty($params[
'userId']) && (int)$params[
'userId'] > 0 ? (
int)$params[
'userId'] : 0);
35 if (!Loader::includeModule(
'iblock'))
42 'IBLOCK_ID' => $honourIblockId,
44 '=PROPERTY_USERS' => $userId,
47 $gratCode = (!empty($params[
'gratCode']) ? $params[
'gratCode'] :
false);
50 $res = \CIBlockPropertyEnum::getList(
53 'IBLOCK_ID' => $honourIblockId,
54 'CODE' =>
'GRATITUDE',
58 if ($enumFields = $res->fetch())
60 $filter[
'PROPERTY_GRATITUDE'] = $enumFields[
'ID'];
61 $result[
'GRAT_VALUE'] = $enumFields[
'VALUE'];
65 $iblockElementsIdList = [];
68 $res = \CIBlockElement::getList(
73 [
'ID',
'PROPERTY_GRATITUDE' ]
75 while($iblockElementFields = $res->fetch())
77 $badgeEnumId = $iblockElementFields[
'PROPERTY_GRATITUDE_ENUM_ID'];
78 if (!isset($badgesData[$badgeEnumId]))
80 $badgesData[$badgeEnumId] = [
81 'NAME' => $iblockElementFields[
'PROPERTY_GRATITUDE_VALUE'],
86 $badgesData[$badgeEnumId][
'ID'][] = (int)$iblockElementFields[
'ID'];
87 $iblockElementsIdList[] = $iblockElementFields[
'ID'];
90 $result[
'BADGES_DATA'] = $badgesData;
91 $result[
'ELEMENT_ID_LIST'] = $iblockElementsIdList;
103 global $CACHE_MANAGER;
106 'POST_ID_LIST' => [],
107 'AUTHOR_ID_LIST' => [],
108 'ELEMENT_ID_LIST' => [],
111 $iblockElementsIdList = (!empty($params[
'iblockElementsIdList']) && is_array($params[
'iblockElementsIdList']) ? $params[
'iblockElementsIdList'] : []);
112 if (empty($iblockElementsIdList))
117 if (!Loader::includeModule(
'blog'))
124 $res = \Bitrix\Blog\PostTable::getList([
126 '@UF_GRATITUDE' => $iblockElementsIdList
128 'select' => [
'ID',
'AUTHOR_ID',
'UF_GRATITUDE']
131 $iblockElementsIdList = [];
132 while($postFields = $res->fetch())
134 $postIdList[] = $postFields[
'ID'];
135 $authorsIdList[] = $postFields[
'AUTHOR_ID'];
136 $iblockElementsIdList[] = $postFields[
'UF_GRATITUDE'];
138 if (defined(
'BX_COMP_MANAGED_CACHE'))
140 $CACHE_MANAGER->registerTag(
'blog_post_' . $postFields[
'ID']);
141 $CACHE_MANAGER->registerTag(
'USER_CARD_' . (
int)($postFields[
'AUTHOR_ID'] / TAGGED_user_card_size));
145 $result[
'POST_ID_LIST'] = $postIdList;
146 $result[
'AUTHOR_ID_LIST'] = array_unique($authorsIdList);
147 $result[
'ELEMENT_ID_LIST'] = $iblockElementsIdList;
164 $result[
'GRAT_POST_FILTER'] = [];
165 $result[
'RETURN_EMPTY_LIST'] =
false;
167 $userId = (int)$request->get(
'gratUserId');
168 $gratCode = $request->get(
'gratCode');
172 && ModuleManager::isModuleInstalled(
'intranet')
175 $res = \CUser::getById($userId);
177 if ($userFields = $res->fetch())
179 $gratUserName = \CUser::formatName(\CSite::getNameFormat(
false), $userFields,
true);
182 $result[
'RETURN_EMPTY_LIST'] =
true;
189 $filterParams[
'gratCode'] = $gratCode;
193 $iblockElementsIdList = $gratitudesData[
'ELEMENT_ID_LIST'];
196 if ($gratitudesData[
'GRAT_VALUE'] <>
'')
198 $gratValue = $gratitudesData[
'GRAT_VALUE'];
202 if (!empty($iblockElementsIdList))
205 'iblockElementsIdList' => $iblockElementsIdList,
207 $postIdList = $gratitudesData[
'POST_ID_LIST'];
210 if (!empty($postIdList))
212 $result[
'GRAT_POST_FILTER'] = $postIdList;
213 $result[
'RETURN_EMPTY_LIST'] =
false;
216 if ($gratUserName <>
'')
218 $APPLICATION->setTitle(
Loc::getMessage($gratValue <>
'' ?
'SONET_LOG_LIST_TITLE_GRAT2' :
'SONET_LOG_LIST_TITLE_GRAT', [
219 '#USER_NAME#' => $gratUserName,
220 '#GRAT_NAME#' => $gratValue,