Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
log.php
1<?php
9
14
15class Log
16{
17 const EVENT_ID_LISTS = 'lists_new_element';
18
25 public static function getEventIdList()
26 {
27 return array(
28 self::EVENT_ID_LISTS
29 );
30 }
31
38 public static function onIndexGetContent(Event $event)
39 {
40 $result = new EventResult(
41 EventResult::UNDEFINED,
42 array(),
43 'lists'
44 );
45
46 $eventId = $event->getParameter('eventId');
47 $itemId = $event->getParameter('itemId');
48
49 if (!in_array($eventId, self::getEventIdList()))
50 {
51 return $result;
52 }
53
54 $content = "";
55 $logItem = false;
56
57 if (intval($itemId) > 0)
58 {
59 $logItem = \Bitrix\Socialnetwork\Item\Log::getById($itemId);
60 }
61
62 if ($logItem)
63 {
64 $logFieldList = $logItem->getFields();
65
66 $content .= LogIndex::getUserName($logFieldList["USER_ID"])." ";
67
68 if (!empty($logFieldList["TITLE"]))
69 {
70 $content .= \CTextParser::clearAllTags($logFieldList["TITLE"])." ";
71 }
72
73 if (
74 !empty($logFieldList["PARAMS"])
75 && ($logEntryParams = unserialize($logFieldList["PARAMS"]))
76 && !empty($logEntryParams["ELEMENT_NAME"])
77 )
78 {
79 $content .= \CTextParser::clearAllTags($logEntryParams["ELEMENT_NAME"]);
80 }
81
82 if (
83 !empty($logFieldList["MESSAGE"])
84 && Loader::includeModule('bizproc')
85 && ($documentData = \CBPStateService::GetStateDocumentId($logFieldList["MESSAGE"]))
86 && ($documentData[0] == 'lists')
87 && (intval($documentData[2]) > 0)
88 && Loader::includeModule('iblock')
89 )
90 {
91 $elementObject = \CIBlockElement::getList(
92 array(),
93 array('ID' => intval($documentData[2])),
94 false,
95 false,
96 array('SEARCHABLE_CONTENT')
97 );
98 if ($element = $elementObject->fetch())
99 {
100 $content .= " ".$element["SEARCHABLE_CONTENT"];
101 }
102 }
103 }
104
105 $result = new EventResult(
106 EventResult::SUCCESS,
107 array(
108 'content' => $content,
109 ),
110 'lists'
111 );
112
113 return $result;
114 }
115}
116
static onIndexGetContent(Event $event)
Definition log.php:38
getParameter($key)
Definition event.php:80