1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
taskcommentprocessor.php
См. документацию.
1<?php
2
4
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_comment'];
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 $commentId = (int)($this->event->getData()['MESSAGE_ID'] ?? null);
27
28 if ($taskId <= 0 || $commentId <= 0 || $groupId < 0)
29 {
30 return;
31 }
32
33 switch ($this->event->getType())
34 {
35 case EventDictionary::EVENT_SPACE_TASK_COMMENT_ADD:
36 $this->onCommentAdd($taskId, $commentId, $groupId);
37 break;
38 case EventDictionary::EVENT_SPACE_TASK_COMMENT_DELETE:
39 $this->onCommentDelete($commentId);
40 break;
41 default:
42 break;
43 }
44 }
45
46 private function onCommentDelete(int $commentId): void
47 {
48 $this->deleteRecentActivityData($commentId);
49 }
50
51 private function onCommentAdd(int $taskId, int $commentId, int $groupId): void
52 {
53 if ($groupId > 0)
54 {
55 $this->saveRecentActivityData($groupId, $commentId, $taskId);
56 }
57 else
58 {
59 $this->saveRecentActivityData(0, $commentId, $taskId);
60 }
61 }
62}
Определения loader.php:13
saveRecentActivityData(int $spaceId, int $entityId, ?int $secondaryEntityId=null)
Определения AbstractProcessor.php:31