1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
openevent.php
См. документацию.
1<?php
2
3namespace Bitrix\Calendar\Internals\Counter\Processor;
4
5use Bitrix\Calendar\Core\Event\Event as CalendarEvent;
6use Bitrix\Calendar\Internals\Counter\Event\Event;
7use Bitrix\Calendar\Internals\Counter\Event\EventCollection;
8use Bitrix\Calendar\Internals\Counter\Event\EventDictionary;
9
10class OpenEvent implements Base
11{
12 private const SUPPORTED_EVENTS = [
13 EventDictionary::OPEN_EVENT_CREATED,
14 EventDictionary::OPEN_EVENT_DELETED,
15 EventDictionary::OPEN_EVENT_SEEN,
16 ];
17
18 public function process(): void
19 {
20 foreach (EventCollection::getInstance()->list() as $event)
21 {
22 /* @var $event Event */
23 $eventType = $event->getType();
24 if (!in_array($eventType, self::SUPPORTED_EVENTS, true))
25 {
26 continue;
27 }
28
29 switch ($eventType)
30 {
31 case EventDictionary::OPEN_EVENT_CREATED:
32 $this->handleEventCreated($event);
33 break;
34 case EventDictionary::OPEN_EVENT_DELETED:
35 $this->handleEventDeleted($event);
36 break;
37 case EventDictionary::OPEN_EVENT_SEEN:
38 $this->handleEventSeen($event);
39 break;
40 }
41 }
42 }
43
52 public function upCounter(array $userIds, CalendarEvent $event): void
53 {
54 (new Handler\OpenEventUpCounter())($userIds, $event);
55 }
56
65 public function dropCounter(array $userIds, int $eventId, int $categoryId): void
66 {
67 (new Handler\OpenEventDropCounter())($userIds, $eventId, $categoryId);
68 }
69
70 private function handleEventCreated(Event $event): void
71 {
72 $eventId = (int)($event->getData()['event_id'] ?? null);
73
74 (new Handler\OpenEventCreated())($eventId);
75 }
76
77 private function handleEventDeleted(Event $event): void
78 {
79 $eventId = (int)($event->getData()['event_id'] ?? null);
80 $categoryId = (int)($event->getData()['category_id'] ?? null);
81
82 (new Handler\OpenEventDeleted())($eventId, $categoryId);
83 }
84
85 private function handleEventSeen(Event $event): void
86 {
87 $categories = $event->getData()['categories'] ?? [];
88 $userId = (int)($event->getData()['user_id'] ?? null);
89
90 (new Handler\OpenEventSeen())($categories, $userId);
91 }
92}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
upCounter(array $userIds, CalendarEvent $event)
Определения openevent.php:52
dropCounter(array $userIds, int $eventId, int $categoryId)
Определения openevent.php:65
Определения event.php:5
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$event
Определения prolog_after.php:141