• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/component/loglist/gratitude.php
  • Класс: BitrixSocialnetworkComponentLogListGratitude
  • Вызов: Gratitude::prepareGratPostFilter
public function prepareGratPostFilter(&$result): void
{
	global $APPLICATION;

	$request = Util::getRequest();

	$result['GRAT_POST_FILTER'] = [];
	$result['RETURN_EMPTY_LIST'] = false;

	$userId = (int)$request->get('gratUserId');
	$gratCode = $request->get('gratCode');

	if (
		$userId
		&& ModuleManager::isModuleInstalled('intranet')
	)
	{
		$res = CUser::getById($userId);
		$gratUserName = '';
		if ($userFields = $res->fetch())
		{
			$gratUserName = CUser::formatName(CSite::getNameFormat(false), $userFields, true);
		}

		$result['RETURN_EMPTY_LIST'] = true;
		$filterParams = [
			'userId' => $userId
		];

		if ($gratCode <> '')
		{
			$filterParams['gratCode'] = $gratCode;
		}

		$gratitudesData = self::getGratitudesIblockData($filterParams);
		$iblockElementsIdList = $gratitudesData['ELEMENT_ID_LIST'];
		$gratValue = '';

		if ($gratitudesData['GRAT_VALUE'] <> '')
		{
			$gratValue = $gratitudesData['GRAT_VALUE'];
		}

		$postIdList = [];
		if (!empty($iblockElementsIdList))
		{
			$gratitudesData = self::getGratitudesBlogData([
				'iblockElementsIdList' => $iblockElementsIdList,
			]);
			$postIdList = $gratitudesData['POST_ID_LIST'];
		}

		if (!empty($postIdList))
		{
			$result['GRAT_POST_FILTER'] = $postIdList;
			$result['RETURN_EMPTY_LIST'] = false;
		}

		if ($gratUserName <> '')
		{
			$APPLICATION->setTitle(Loc::getMessage($gratValue <> '' ? 'SONET_LOG_LIST_TITLE_GRAT2' : 'SONET_LOG_LIST_TITLE_GRAT', [
				'#USER_NAME#' => $gratUserName,
				'#GRAT_NAME#' => $gratValue,
			]));
		}
	}
}