1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
collabevent.php
См. документацию.
1<?php
2
4
9
10final class CollabEvent
11{
12 private const LOG_MARKER = 'DEBUG_CALENDAR_SOCNET_COLLAB_ADD';
13
14 private static ?Logger $logger = null;
15
21 public static function onCollabAdd($event): void
22 {
23 try
24 {
25 $collabId = $event->getCollab()->getId();
26 $calendarType = Dictionary::CALENDAR_TYPE['group'];
27
28 if (self::isSectionExist($collabId, $calendarType))
29 {
30 return;
31 }
32
33 \CCalendarSect::CreateDefault(array(
34 'type' => $calendarType,
35 'ownerId' => $collabId,
36 ));
37 }
38 catch (\Throwable $e)
39 {
40 // not break collab creation flow
41 self::getLogger()->log($e);
42 }
43
44 }
45
46 private static function getLogger(): Logger
47 {
48 self::$logger ??= new Logger(self::LOG_MARKER);
49
50 return self::$logger;
51 }
52
53 private static function isSectionExist($collabId, $calendarType): bool
54 {
55 return (bool)SectionTable::query()
56 ->setSelect(['ID'])
57 ->where('CAL_TYPE', $calendarType)
58 ->where('OWNER_ID', $collabId)
59 ->setLimit(1)
60 ->exec()
61 ->fetch()
62 ;
63 }
64}
</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