1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
taskprocessor.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Integration\Tasks\RecentActivity;
4
5use Bitrix\Main\Loader;
6use Bitrix\Socialnetwork\Internals\EventService\EventDictionary;
7use Bitrix\Socialnetwork\Space\List\RecentActivity\Dictionary;
8use Bitrix\Socialnetwork\Space\List\RecentActivity\Event\Processor\AbstractProcessor;
9
11{
12 public function isAvailable(): bool
13 {
14 return Loader::includeModule('tasks');
15 }
16
17 protected function getTypeId(): string
18 {
19 return Dictionary::ENTITY_TYPE['task'];
20 }
21
22 public function process(): void
23 {
24 $groupId = (int)($this->event->getData()['GROUP_ID'] ?? null);
25 $taskId = (int)($this->event->getData()['ID'] ?? null);
26
27 if ($taskId <= 0 || $groupId < 0)
28 {
29 return;
30 }
31
32 switch ($this->event->getType())
33 {
34 case EventDictionary::EVENT_SPACE_TASK_DELETE:
35 $this->onTaskDelete($taskId);
36 break;
37 case EventDictionary::EVENT_SPACE_TASK_REMOVE_USERS:
38 $this->onTaskRemoveUsers($taskId);
39 break;
40 default:
41 $this->onDefaultEvent($taskId, $groupId);
42 break;
43 }
44 }
45
46 private function onTaskDelete(int $taskId): void
47 {
48 $this->deleteRecentActivityData($taskId);
49 }
50
51 private function onTaskRemoveUsers(int $taskId): void
52 {
53 $this->deleteRecentActivityData($taskId);
54 }
55
56 private function onDefaultEvent(int $taskId, int $groupId): void
57 {
58 if ($groupId > 0)
59 {
60 $this->saveRecentActivityData($groupId, $taskId);
61 }
62 else
63 {
64 $this->saveRecentActivityData(0, $taskId);
65 }
66 }
67}
saveRecentActivityData(int $spaceId, int $entityId, ?int $secondaryEntityId=null)
Определения AbstractProcessor.php:31