1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
contentviewhandler.php
См. документацию.
1<?php
2
3namespace Bitrix\Forum\Integration\Socialnetwork;
4
5use Bitrix\Main\Loader;
6use Bitrix\Forum\MessageTable;
7use Bitrix\Main\Event;
8
16{
17 const CONTENT_TYPE_ID_COMMENT = 'FORUM_POST';
18
19 final static function getContentTypeIdList()
20 {
21 return [
22 self::CONTENT_TYPE_ID_COMMENT
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 (
83 && !empty($subTagList)
84 )
85 {
86 $CIMNotify = new \CIMNotify();
87 $CIMNotify->markNotifyReadBySubTag($subTagList);
88 }
89
90 return true;
91 }
92}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
Определения event.php:5
static includeModule($moduleName)
Определения loader.php:67
$res
Определения filter_act.php:7
$message
Определения payment.php:8
$event
Определения prolog_after.php:141