• Модуль: lists
  • Путь к файлу: ~/bitrix/modules/lists/classes/general/livefeed.php
  • Класс: CListsLiveFeed
  • Вызов: CListsLiveFeed::OnSendMentionGetEntityFields
static function OnSendMentionGetEntityFields($commentFields)
{
	if (!in_array($commentFields["EVENT_ID"], array("lists_new_element_comment")))
	{
		return false;
	}

	if (!CModule::IncludeModule("socialnetwork"))
	{
		return true;
	}

	$dbLog = CSocNetLog::GetList(
		array(),
		array(
			"ID" => $commentFields["LOG_ID"],
		),
		false,
		false,
		array("ID", "TITLE", "SOURCE_ID", "PARAMS")
	);

	if ($log = $dbLog->GetNext())
	{
		$genderSuffix = "";
		$dbUser = CUser::GetByID($commentFields["USER_ID"]);
		if($user = $dbUser->Fetch())
		{
			$genderSuffix = $user["PERSONAL_GENDER"];
		}

		$params = unserialize($log["~PARAMS"], ['allowed_classes' => false]);
		$title = $log["TITLE"]." - ".$params["ELEMENT_NAME"];
		$entityName = GetMessage("LISTS_LF_COMMENT_MENTION_TITLE", Array("#PROCESS#" => $title));
		$notifyMessage = GetMessage("LISTS_LF_COMMENT_MENTION" . ($genderSuffix <> '' ? "_" . $genderSuffix : ""), Array("#title#" => "".$entityName.""));
		$notifyMessageOut = GetMessage("LISTS_LF_COMMENT_MENTION" . ($genderSuffix <> '' ? "_" . $genderSuffix : ""), Array("#title#" => $entityName)) . " (" . "#server_name##url#)";

		$strPathToLogEntry = str_replace("#log_id#", $log["ID"], COption::GetOptionString("socialnetwork", "log_entry_page", "/company/personal/log/#log_id#/", SITE_ID));
		$strPathToLogEntryComment = $strPathToLogEntry . (mb_strpos($strPathToLogEntry, "?") !== false ? "&" : "?") . "commentID=" . $commentFields["ID"] . "#com" . $commentFields["ID"];

		$return = array(
			"URL" => $strPathToLogEntryComment,
			"NOTIFY_MODULE" => "lists",
			"NOTIFY_TAG" => "LISTS|COMMENT_MENTION|".$commentFields["ID"],
			"NOTIFY_MESSAGE" => $notifyMessage,
			"NOTIFY_MESSAGE_OUT" => $notifyMessageOut
		);

		return $return;
	}
	else
	{
		return false;
	}
}