1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
calendarcommentprocessor.php
См. документацию.
1<?php
2
4
9use Bitrix\Socialnetwork\Space\List\RecentActivity\Event\Trait\AccessCodeTrait;
10
12{
13 use AccessCodeTrait;
14
15 public function isAvailable(): bool
16 {
17 return Loader::includeModule('calendar');
18 }
19
20 protected function getTypeId(): string
21 {
22 return Dictionary::ENTITY_TYPE['calendar_comment'];
23 }
24
25 public function process(): void
26 {
27 $eventId = (int)($this->event->getData()['ID'] ?? null);
28 $commentId = (int)($this->event->getData()['COMMENT_ID'] ?? null);
29
30 if ($eventId <= 0 || $commentId <= 0)
31 {
32 return;
33 }
34
35 switch ($this->event->getType())
36 {
37 case EventDictionary::EVENT_SPACE_CALENDAR_EVENT_COMMENT_ADD:
38 $this->onCommentAdd($eventId, $commentId);
39 break;
40 case EventDictionary::EVENT_SPACE_CALENDAR_EVENT_COMMENT_DEL:
41 $this->onCommentDelete($commentId);
42 break;
43 default:
44 break;
45 }
46 }
47
48 private function onCommentAdd(int $eventId, int $commentId): void
49 {
50 $attendeeCodes = $this->event->getData()['ATTENDEES_CODES'] ?? null;
51
52 if (is_string($attendeeCodes))
53 {
54 $attendeeCodes = explode(',', $attendeeCodes);
55 }
56 elseif (!is_array($attendeeCodes))
57 {
58 $attendeeCodes = [];
59 }
60
61 $spaceIds = $this->getSpaceIdsFromCodes($attendeeCodes, $this->recipient);
62
63 $spaceIds = array_unique($spaceIds);
64 foreach ($spaceIds as $spaceId)
65 {
66 $this->saveRecentActivityData($spaceId, $commentId ,$eventId);
67 }
68 }
69
70 private function onCommentDelete(int $commentId): void
71 {
72 $this->deleteRecentActivityData($commentId);
73 }
74}
Определения loader.php:13
saveRecentActivityData(int $spaceId, int $entityId, ?int $secondaryEntityId=null)
Определения AbstractProcessor.php:31
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393