1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
workgroupusersender.php
См. документацию.
1<?php
2
9
10namespace Bitrix\Socialnetwork\Internals\EventService\Push;
11
12use Bitrix\Main\Loader;
13use Bitrix\Main\ModuleManager;
14use Bitrix\Socialnetwork\UserToGroupTable;
15
17{
18
19 public function __construct()
20 {
21
22 }
23
27 public function send(array $pushList, array $notVisibleGroupsUsers): void
28 {
29 if (
31 || !Loader::includeModule('pull')
32 )
33 {
34 return;
35 }
36
37 $tagList = [];
38 foreach ($pushList as $push)
39 {
40 $tagList[] = PullDictionary::PULL_WORKGROUP_USERS_TAG_PREFIX . '_' . (int)$push['GROUP_ID'];
41 }
42
43 $tagList = array_unique($tagList);
44
46 $query->addSelect('USER_ID');
47 $query->addSelect('TAG');
48 $query->whereIn('TAG', $tagList);
49 $records = $query->fetchAll();
50
51 $subscribedUsers = [];
52 foreach ($records as $record)
53 {
54 if (!preg_match('/^'. PullDictionary::PULL_WORKGROUP_USERS_TAG_PREFIX . '(\d+)$/i', $record['TAG'], $matches))
55 {
56 continue;
57 }
58
59 $groupId = (int)$matches[1];
60
61 if (!isset($subscribedUsers[$groupId]))
62 {
63 $subscribedUsers[$groupId] = [];
64 }
65
66 $subscribedUsers[$groupId][] = (int)$record['USER_ID'];
67 }
68
69 foreach ($pushList as $push)
70 {
71 $pushCommand = PushEventDictionary::getPushEventType($push['EVENT']);
72 $groupId = (int)$push['GROUP_ID'];
73 $userId = (int)$push['USER_ID'];
74 $role = (int)$push['ROLE'];
75
76 $pushParams = [
77 'module_id' => 'socialnetwork',
78 'command' => $pushCommand,
79 'params' => [ 'GROUP_ID' => $groupId ],
80 ];
81
83 {
84 $recipients = [ $userId ];
85 }
86 elseif (!empty($subscribedUsers[$groupId]))
87 {
88 $recipients = (
89 isset($notVisibleGroupsUsers[$groupId])
90 ? array_intersect($subscribedUsers[$groupId], $notVisibleGroupsUsers[$groupId])
91 : $subscribedUsers[$groupId]
92 );
93 }
94
95 PushSender::sendPersonalEvent($recipients, $pushCommand, $pushParams);
96 }
97 }
98}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static includeModule($moduleName)
Определения loader.php:67
static isModuleInstalled($moduleName)
Определения modulemanager.php:125
static sendPersonalEvent(array $userIds, string $command='', array $eventData=[])
Определения pushsender.php:15
send(array $pushList, array $notVisibleGroupsUsers)
Определения workgroupusersender.php:27
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$query
Определения get_search.php:11
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$matches
Определения index.php:22