Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
spacelistsender.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Internals\EventService\Push
;
4
5
use
Bitrix\Main\Loader
;
6
use
Bitrix\Main\ModuleManager
;
7
use
Bitrix\Socialnetwork\Integration\Pull\PushService
;
8
use
Bitrix\Socialnetwork\Internals\EventService\Event
;
9
use
Bitrix\Socialnetwork\Internals\EventService\EventDictionary
;
10
use
Bitrix\Socialnetwork\Internals\EventService\Recepients\Recepient
;
11
12
final
class
SpaceListSender
13
{
14
public
const
EVENT_MAP
= [
15
EventDictionary::EVENT_WORKGROUP_USER_ADD
=>
EventDictionary::EVENT_SPACE_USER_ROLE_CHANGE
,
16
EventDictionary::EVENT_WORKGROUP_USER_UPDATE
=>
EventDictionary::EVENT_SPACE_USER_ROLE_CHANGE
,
17
EventDictionary::EVENT_WORKGROUP_USER_DELETE
=>
EventDictionary::EVENT_SPACE_USER_ROLE_CHANGE
,
18
];
19
20
public
function
send
(
Event
$event): void
21
{
22
if
(!
ModuleManager::isModuleInstalled
(
'pull'
) || !Loader::includeModule(
'pull'
))
23
{
24
return
;
25
}
26
27
28
if
(key_exists($event->
getType
(), self::EVENT_MAP))
29
{
30
$recipients = [$event->
getUserId
()];
31
32
$userId = $event->
getUserId
();
33
$spaceId = $event->
getGroupId
();
34
35
PushService::addEvent($recipients, [
36
'module_id'
=> PushService::MODULE_NAME,
37
'command'
=>
PushEventDictionary::getPushEventType
(self::EVENT_MAP[$event->
getType
()]),
38
'params'
=> [
39
'USER_ID'
=> $userId,
40
'GROUP_ID'
=> $spaceId,
41
],
42
]);
43
}
44
}
45
}
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Main\ModuleManager
Definition
modulemanager.php:5
Bitrix\Main\ModuleManager\isModuleInstalled
static isModuleInstalled($moduleName)
Definition
modulemanager.php:67
Bitrix\Socialnetwork\Integration\Pull\PushService
Definition
pushservice.php:15
Bitrix\Socialnetwork\Internals\EventService\EventDictionary
Definition
eventdictionary.php:13
Bitrix\Socialnetwork\Internals\EventService\EventDictionary\EVENT_WORKGROUP_USER_UPDATE
const EVENT_WORKGROUP_USER_UPDATE
Definition
eventdictionary.php:20
Bitrix\Socialnetwork\Internals\EventService\EventDictionary\EVENT_WORKGROUP_USER_ADD
const EVENT_WORKGROUP_USER_ADD
Definition
eventdictionary.php:19
Bitrix\Socialnetwork\Internals\EventService\EventDictionary\EVENT_WORKGROUP_USER_DELETE
const EVENT_WORKGROUP_USER_DELETE
Definition
eventdictionary.php:21
Bitrix\Socialnetwork\Internals\EventService\EventDictionary\EVENT_SPACE_USER_ROLE_CHANGE
const EVENT_SPACE_USER_ROLE_CHANGE
Definition
eventdictionary.php:51
Bitrix\Socialnetwork\Internals\EventService\Event
Definition
event.php:16
Bitrix\Socialnetwork\Internals\EventService\Event\getUserId
getUserId()
Definition
event.php:57
Bitrix\Socialnetwork\Internals\EventService\Event\getGroupId
getGroupId()
Definition
event.php:62
Bitrix\Socialnetwork\Internals\EventService\Event\getType
getType()
Definition
event.php:47
Bitrix\Socialnetwork\Internals\EventService\Push\PushEventDictionary\getPushEventType
static getPushEventType(string $eventType)
Definition
pusheventdictionary.php:28
Bitrix\Socialnetwork\Internals\EventService\Push\SpaceListSender
Definition
spacelistsender.php:13
Bitrix\Socialnetwork\Internals\EventService\Push\SpaceListSender\send
send(Event $event)
Definition
spacelistsender.php:20
Bitrix\Socialnetwork\Internals\EventService\Push\SpaceListSender\EVENT_MAP
const EVENT_MAP
Definition
spacelistsender.php:14
Bitrix\Socialnetwork\Internals\EventService\Recepients\Recepient
Definition
recepient.php:6
Bitrix\Socialnetwork\Internals\EventService\Event
Definition
factory.php:3
Bitrix\Socialnetwork\Internals\EventService\Push
Definition
pulldictionary.php:3
modules
socialnetwork
lib
internals
eventservice
push
spacelistsender.php
Создано системой
1.10.0