48 global $USER_FIELD_MANAGER;
51 EventResult::UNDEFINED,
59 if (!in_array($eventId, self::getEventIdList()))
67 if (intval($sourceId) > 0)
69 $post = Post::getById($sourceId);
74 $postFieldList = $post->getFields();
76 $content .= LogIndex::getUserName($postFieldList[
"AUTHOR_ID"]).
" ";
78 $postFieldList[
"MICRO"] !=
"Y"
79 && isset($postFieldList[
"TITLE"])
80 && $postFieldList[
"TITLE"] <>
''
83 $content .= \blogTextParser::killAllTags($postFieldList[
"TITLE"]).
" ";
85 $content .= \blogTextParser::killAllTags($postFieldList[
"DETAIL_TEXT"]);
87 $destinationsList = array();
88 $res = \CBlogPost::getSocNetPerms($sourceId);
89 foreach($res as $group => $list)
91 foreach($list as $key => $valuesList)
93 $destinationsList = array_merge($destinationsList, $valuesList);
97 if (!empty($destinationsList))
99 $content .=
' '.join(
' ', LogIndex::getEntitiesName($destinationsList));
102 if (!empty($postFieldList[
'UF_BLOG_POST_FILE']))
104 $fileNameList = LogIndex::getDiskUFFileNameList($postFieldList[
'UF_BLOG_POST_FILE']);
105 if (!empty($fileNameList))
107 $content .=
' '.join(
' ', $fileNameList);
111 if (!empty($postFieldList[
'UF_BLOG_POST_URL_PRV']))
113 $metadata = \Bitrix\Main\UrlPreview\UrlMetadataTable::getRowById($postFieldList[
'UF_BLOG_POST_URL_PRV']);
116 && isset($metadata[
'TITLE'])
117 && $metadata[
'TITLE'] <>
''
120 $content .=
' '.$metadata[
'TITLE'];
125 !empty($postFieldList[
'UF_BLOG_POST_VOTE'])
126 && intval($postFieldList[
'UF_BLOG_POST_VOTE']) > 0
127 && Loader::includeModule(
'vote')
130 $postUFList = $USER_FIELD_MANAGER->getUserFields(
"BLOG_POST", $sourceId, LANGUAGE_ID);
132 if (!empty($postUFList[
'UF_BLOG_POST_VOTE']))
135 ($userFieldManager = Manager::getInstance($postUFList[
'UF_BLOG_POST_VOTE']))
136 && ($attach = $userFieldManager->loadFromAttachId(intval($postFieldList[
'UF_BLOG_POST_VOTE'])))
139 foreach ($attach[
"QUESTIONS"] as $question)
141 $content .=
' '.$question[
"QUESTION"];
142 foreach ($question[
"ANSWERS"] as $answer)
144 $content .=
' '.$answer[
"MESSAGE"];
151 if (!empty($postFieldList[
'CATEGORY_ID']))
153 $categoryList = explode(
",", $postFieldList[
"CATEGORY_ID"]);
155 foreach($categoryList as $value)
157 $category = \CBlogCategory::getByID($value);
158 $tagList[] = $category[
"NAME"];
159 $tagList[] =
'#'.$category[
"NAME"];
161 if (!empty($tagList))
163 $content .=
' '.implode(
' ', $tagList);
169 EventResult::SUCCESS,
171 'content' => $content,