1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
workgroupusersender.php
См. документацию.
1
<?php
2
9
10
namespace
Bitrix\Socialnetwork\Internals\EventService\Push;
11
12
use Bitrix\Main\Loader;
13
use Bitrix\Main\ModuleManager;
14
use Bitrix\Socialnetwork\UserToGroupTable;
15
16
class
WorkgroupUserSender
17
{
18
19
public
function
__construct
()
20
{
21
22
}
23
27
public
function
send
(
array
$pushList,
array
$notVisibleGroupsUsers): void
28
{
29
if
(
30
!
ModuleManager::isModuleInstalled
(
'pull'
)
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
45
$query
=
\Bitrix\Pull\Model\WatchTable::query
();
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
82
if
($role ===
UserToGroupTable::ROLE_REQUEST
)
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
}
$userId
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения
check_mail.php:18
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Определения
loader.php:67
Bitrix\Main\ModuleManager\isModuleInstalled
static isModuleInstalled($moduleName)
Определения
modulemanager.php:125
Bitrix\Main\ORM\Data\DataManager\query
static query()
Определения
datamanager.php:549
Bitrix\Socialnetwork\Internals\EventService\Push\PullDictionary\PULL_WORKGROUP_USERS_TAG_PREFIX
const PULL_WORKGROUP_USERS_TAG_PREFIX
Определения
pulldictionary.php:13
Bitrix\Socialnetwork\Internals\EventService\Push\PushEventDictionary\getPushEventType
static getPushEventType(string $eventType)
Определения
pusheventdictionary.php:33
Bitrix\Socialnetwork\Internals\EventService\Push\PushSender\sendPersonalEvent
static sendPersonalEvent(array $userIds, string $command='', array $eventData=[])
Определения
pushsender.php:15
Bitrix\Socialnetwork\Internals\EventService\Push\WorkgroupUserSender
Определения
workgroupusersender.php:17
Bitrix\Socialnetwork\Internals\EventService\Push\WorkgroupUserSender\__construct
__construct()
Определения
workgroupusersender.php:19
Bitrix\Socialnetwork\Internals\EventService\Push\WorkgroupUserSender\send
send(array $pushList, array $notVisibleGroupsUsers)
Определения
workgroupusersender.php:27
Bitrix\Socialnetwork\UserToGroupTable\ROLE_REQUEST
const ROLE_REQUEST
Определения
usertogroup.php:54
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$query
$query
Определения
get_search.php:11
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$matches
$matches
Определения
index.php:22
bitrix
modules
socialnetwork
lib
internals
eventservice
push
workgroupusersender.php
Создано системой
1.14.0