Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
contentviewhandler.php
1<?php
2
4
8
16{
17 const CONTENT_TYPE_ID_COMMENT = 'FORUM_POST';
18
19 final static function getContentTypeIdList()
20 {
21 return [
23 ];
24 }
25
32 public static function onContentViewed(Event $event)
33 {
34 $userId = intval($event->getParameter('userId'));
35 $contentTypeId = $event->getParameter('typeId');
36 $contentEntityId = intval($event->getParameter('entityId'));
37
38 if (
39 $userId <= 0
40 || !in_array($contentTypeId, self::getContentTypeIdList())
41 || $contentEntityId <= 0
42 )
43 {
44 return false;
45 }
46
47 $subTagList = [];
48 if ($contentTypeId == self::CONTENT_TYPE_ID_COMMENT)
49 {
50 $res = MessageTable::getList([
51 'filter' => [
52 '=ID' => $contentEntityId
53 ],
54 'select' => [ 'XML_ID' ]
55 ]);
56 if ($message = $res->fetch())
57 {
58 if (preg_match("/^TASK_(.+)\$/", $message["XML_ID"], $match))
59 {
60 $taskId = intval($match[1]);
61
62 $event = new Event(
63 'forum', 'onTaskCommentContentViewed',
64 [
65 'userId' => $userId,
66 'taskId' => $taskId,
67 'commentId' => $contentEntityId
68 ]
69 );
70 $event->send();
71
72 $subTagList[] = "TASKS|COMMENT|".$taskId.'|'.$userId.'|'.$contentEntityId.'|TASK_UPDATE';
73 }
74 else
75 {
76 $subTagList[] = "FORUM|COMMENT|".$contentEntityId.'|'.$userId;
77 }
78 }
79 }
80
81 if (
82 Loader::includeModule('im')
83 && !empty($subTagList)
84 )
85 {
86 $CIMNotify = new \CIMNotify();
87 $CIMNotify->markNotifyReadBySubTag($subTagList);
88 }
89
90 return true;
91 }
92}
send($sender=null)
Definition event.php:139
getParameter($key)
Definition event.php:80