• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/tasknotifications.php
  • Класс: CTaskNotifications
  • Вызов: CTaskNotifications::OnGetMessageRatingVote
static function OnGetMessageRatingVote(&$params, &$forEmail)
{
	static $intranetInstalled = null;

	if ($intranetInstalled === null)
	{
		$intranetInstalled = BitrixMainModuleManager::isModuleInstalled('intranet');
	}

	if($params['ENTITY_TYPE_ID'] == 'TASK' && !$forEmail)
	{
		$type = (
			$params['VALUE'] >= 0
				? ($intranetInstalled ? 'REACT' : 'LIKE')
				: 'DISLIKE'
		);

		$genderSuffix = '';
		if (
			$type == 'REACT'
			&& !empty($params['USER_ID'])
			&& intval($params['USER_ID']) > 0
		)
		{
			$res = BitrixMainUserTable::getList(array(
				'filter' => array(
					'ID' => intval($params['USER_ID'])
				),
				'select' => array('PERSONAL_GENDER')
			));
			if ($userFields = $res->fetch())
			{
				switch ($userFields['PERSONAL_GENDER'])
				{
					case "M":
					case "F":
						$genderSuffix = '_'.$userFields['PERSONAL_GENDER'];
						break;
					default:
						$genderSuffix = '';
				}
			}
		}

		$langMessage = GetMessage('TASKS_NOTIFICATIONS_I_'.$type.'_TASK'.$genderSuffix);
		if((string) $langMessage != '')
		{
			$taskTitle = self::formatTaskName($params['ENTITY_ID'], $params['ENTITY_TITLE']);

			$params['MESSAGE'] = str_replace(
				'#LINK#',
				(string) $params['ENTITY_LINK'] != '' ? ''.$taskTitle.'': ''.$taskTitle.'', $langMessage);
		}

		if ($intranetInstalled)
		{
			$params['MESSAGE'] .= "n".str_replace("#REACTION#", CRatingsComponentsMain::getRatingLikeMessage(!empty($params['REACTION']) ? $params['REACTION'] : ''), BitrixMainLocalizationLoc::getMessage("TASKS_NOTIFICATIONS_I_REACTION"));
		}
	}
}