• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/classes/general/log_comments.php
  • Класс: CAllSocNetLogComments
  • Вызов: CAllSocNetLogComments::OnSendMentionGetEntityFields_Forum
static function OnSendMentionGetEntityFields_Forum($arCommentFields)
{
	if ($arCommentFields["EVENT_ID"] != "forum")
	{
		return false;
	}

	$dbLog = CSocNetLog::GetList(
		array(),
		array(
			"ID" => $arCommentFields["LOG_ID"],
			"EVENT_ID" => "forum"
		),
		false,
		false,
		array("ID", "TITLE")
	);

	if ($arLog = $dbLog->Fetch())
	{
		$genderSuffix = "";
		$dbUsers = CUser::GetList("ID", "desc", array("ID" => $arCommentFields["USER_ID"]), array("PERSONAL_GENDER", "LOGIN", "NAME", "LAST_NAME", "SECOND_NAME"));
		if ($arUser = $dbUsers->Fetch())
		{
			$genderSuffix = $arUser["PERSONAL_GENDER"];
		}

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

		$title = str_replace(Array("rn", "n"), " ", $arLog["TITLE"]);
		$title = TruncateText($title, 100);
		$title_out = TruncateText($title, 255);

		$arReturn = array(
			"URL" => $strPathToLogEntryComment,
			"NOTIFY_TAG" => "FORUM|COMMENT_MENTION|".$arCommentFields["ID"],
			"NOTIFY_MESSAGE" => GetMessage("SONET_GLC_FORUM_MENTION".($genderSuffix <> '' ? "_".$genderSuffix : ""), Array(
				"#title#" => "".$title.""
			)),
			"NOTIFY_MESSAGE_OUT" => GetMessage("SONET_GLC_FORUM_MENTION".($genderSuffix <> '' ? "_".$genderSuffix : ""), Array(
				"#title#" => $title_out
			))." ("."#server_name##url#)"
		);

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