Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
log.php
1<?
7
12
13class Log
14{
15 const EVENT_ID_FORUM = 'forum';
16
23 public static function getEventIdList()
24 {
25 return array(
26 self::EVENT_ID_FORUM
27 );
28 }
29
36 public static function onIndexGetContent(Event $event)
37 {
38 $result = new EventResult(
39 EventResult::UNDEFINED,
40 array(),
41 'forum'
42 );
43
44 $eventId = $event->getParameter('eventId');
45 $sourceId = $event->getParameter('sourceId');
46
47 if (!in_array($eventId, self::getEventIdList()))
48 {
49 return $result;
50 }
51
52 $content = "";
53 $message = false;
54
55 if (intval($sourceId) > 0)
56 {
57
58 $select = array('*', 'TOPIC.TITLE', 'UF_FORUM_MES_URL_PRV');
59
60 if (
61 \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false)
62 && \Bitrix\Main\ModuleManager::isModuleInstalled('disk')
63 )
64 {
65 $select[] = 'UF_FORUM_MESSAGE_DOC';
66 }
67
68 $res = MessageTable::getList(array(
69 'filter' => array(
70 '=ID' => $sourceId
71 ),
72 'select' => $select
73 ));
74 $message = $res->fetch();
75 }
76
77 if ($message)
78 {
79 $content .= LogIndex::getUserName($message["AUTHOR_ID"])." ";
80 $content .= $message['FORUM_MESSAGE_TOPIC_TITLE']." ";
81 $content .= \forumTextParser::clearAllTags($message['POST_MESSAGE']);
82
83 if (!empty($message['UF_FORUM_MESSAGE_DOC']))
84 {
85 $fileNameList = LogIndex::getDiskUFFileNameList($message['UF_FORUM_MESSAGE_DOC']);
86 if (!empty($fileNameList))
87 {
88 $content .= ' '.join(' ', $fileNameList);
89 }
90 }
91
92 if (!empty($message['UF_FORUM_MES_URL_PRV']))
93 {
94 $metadata = \Bitrix\Main\UrlPreview\UrlMetadataTable::getRowById($message['UF_FORUM_MES_URL_PRV']);
95 if (
96 $metadata
97 && !empty($metadata['TITLE'])
98 )
99 {
100 $content .= ' '.$metadata['TITLE'];
101 }
102 }
103 }
104
105 $result = new EventResult(
106 EventResult::SUCCESS,
107 array(
108 'content' => $content,
109 ),
110 'forum'
111 );
112
113 return $result;
114 }
115
116
117}
static onIndexGetContent(Event $event)
Definition log.php:36
getParameter($key)
Definition event.php:80