Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
workgroupeventprocessor.php
1<?php
2
11
15
17{
21 public function process(): void
22 {
23 $events = (EventCollection::getInstance())->list();
24
25 $requestInPushList = [];
26 $requestOutPushList = [];
27
28 foreach ($events as $event)
29 {
30 /* @var $event Event */
31 $eventType = $event->getType();
32 $groupId = $event->getGroupId();
33
34 $requestWorkgroupEventsList = [
38 ];
39
40 if (in_array($eventType, $requestWorkgroupEventsList, true))
41 {
42 $usedRolesList = $event->getUsedRoles();
43 if (!in_array(UserToGroupTable::ROLE_REQUEST, $usedRolesList, true))
44 {
45 continue;
46 }
47
48 $initiatedByType = $event->getInitiatedByType();
49 switch ($initiatedByType)
50 {
52 $requestInPushList[] = [
53 'EVENT' => $eventType,
54 'GROUP_ID' => $groupId,
55 ];
56 break;
58 $requestOutPushList[] = [
59 'EVENT' => $eventType,
60 'GROUP_ID' => $groupId,
61 ];
62 break;
63 }
64 }
65 }
66
67 if (!empty($requestInPushList))
68 {
69 (new WorkgroupRequestsInSender())->send($requestInPushList);
70 }
71
72 if (!empty($requestOutPushList))
73 {
74 (new WorkgroupRequestsOutSender())->send($requestOutPushList);
75 }
76
77 }
78
82 private function getResourceCollection(): EventResourceCollection
83 {
84 return EventResourceCollection::getInstance();
85 }
86}