17 return Loader::includeModule(
'calendar');
22 return Dictionary::ENTITY_TYPE[
'calendar_comment'];
27 $eventId = (int)($this->event->getData()[
'ID'] ??
null);
28 $commentId = (int)($this->event->getData()[
'COMMENT_ID'] ??
null);
30 if ($eventId <= 0 || $commentId <= 0)
35 switch ($this->event->getType())
37 case EventDictionary::EVENT_SPACE_CALENDAR_EVENT_COMMENT_ADD:
38 $this->onCommentAdd($eventId, $commentId);
40 case EventDictionary::EVENT_SPACE_CALENDAR_EVENT_COMMENT_DEL:
41 $this->onCommentDelete($commentId);
48 private function onCommentAdd(
int $eventId,
int $commentId): void
50 $attendeeCodes = $this->
event->getData()[
'ATTENDEES_CODES'] ??
null;
52 if (is_string($attendeeCodes))
54 $attendeeCodes = explode(
',', $attendeeCodes);
56 elseif (!is_array($attendeeCodes))
61 $spaceIds = $this->getSpaceIdsFromCodes($attendeeCodes, $this->recipient);
63 $spaceIds = array_unique($spaceIds);
64 foreach ($spaceIds as $spaceId)
70 private function onCommentDelete(
int $commentId): void
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)