Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
logcomment.php
1<?php
9
14
16{
17 const EVENT_ID_FORUM_COMMENT = 'forum';
18 const EVENT_ID_TASKS_COMMENT = 'tasks_comment';
19 const EVENT_ID_CALENDAR_COMMENT = 'calendar_comment';
20 const EVENT_ID_WIKI_COMMENT = 'wiki_comment';
21 const EVENT_ID_TIMEMAN_ENTRY_COMMENT = 'timeman_entry_comment';
22 const EVENT_ID_TIMEMAN_REPORT_COMMENT = 'report_comment';
23 const EVENT_ID_LISTS_NEW_ELEMENT_COMMENT = 'lists_new_element_comment';
24 const EVENT_ID_CRM_ACTIVITY_ADD_COMMENT = 'crm_activity_add_comment';
25
39
46 public static function onIndexGetContent(Event $event)
47 {
48 $result = new EventResult(
49 EventResult::UNDEFINED,
50 array(),
51 'forum'
52 );
53
54 $eventId = $event->getParameter('eventId');
55 $sourceId = $event->getParameter('sourceId');
56
57 if (!in_array($eventId, self::getEventIdList()))
58 {
59 return $result;
60 }
61
62 $content = "";
63 $message = false;
64
65 if ((int)$sourceId > 0)
66 {
67 $select = array('*', 'UF_FORUM_MES_URL_PRV', 'SERVICE_TYPE');
68
69 if (
70 \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false)
71 && \Bitrix\Main\ModuleManager::isModuleInstalled('disk')
72 )
73 {
74 $select[] = 'UF_FORUM_MESSAGE_DOC';
75 }
76
77 $res = MessageTable::getList(array(
78 'filter' => array(
79 '=ID' => $sourceId
80 ),
81 'select' => $select
82 ));
83 $message = $res->fetch();
84 }
85
86 if ($message)
87 {
88 if (!empty($message['SERVICE_TYPE']))
89 {
90 return $result;
91 }
92
93 $content .= LogIndex::getUserName($message["AUTHOR_ID"])." ";
94 $content .= \forumTextParser::clearAllTags($message['POST_MESSAGE']);
95
96 if (!empty($message['UF_FORUM_MESSAGE_DOC']))
97 {
98 $fileNameList = LogIndex::getDiskUFFileNameList($message['UF_FORUM_MESSAGE_DOC']);
99 if (!empty($fileNameList))
100 {
101 $content .= ' '.implode(' ', $fileNameList);
102 }
103 }
104
105 if (!empty($message['UF_FORUM_MES_URL_PRV']))
106 {
107 $metadata = \Bitrix\Main\UrlPreview\UrlMetadataTable::getRowById($message['UF_FORUM_MES_URL_PRV']);
108 if (
109 $metadata
110 && !empty($metadata['TITLE'])
111 )
112 {
113 $content .= ' '.$metadata['TITLE'];
114 }
115 }
116 }
117
118 $result = new EventResult(
119 EventResult::SUCCESS,
120 array(
121 'content' => $content,
122 ),
123 'forum'
124 );
125
126 return $result;
127 }
128}
129
getParameter($key)
Definition event.php:80