16 private static array $cache = [];
18 private static ?
self $instance;
22 self::$instance ??=
new self();
24 return self::$instance;
30 array $attendeeEntities
39 $attendeeIds = array_map(
'intval', $attendeeEntities);
40 $eventCategory->
getAttendees()->setAttendeesId($attendeeIds);
48 foreach ($attendeeUserIds as $attendee)
51 'CATEGORY_ID' => $eventCategoryId,
52 'USER_ID' => $attendee,
57 OpenEventCategoryAttendeeTable::insertIgnoreMulti($rowsToAdd);
63 array $attendeeUserIds,
67 if (
count($attendeeUserIds) > $chunkSize * 1.1)
69 $chunks = array_chunk($attendeeUserIds, $chunkSize);
73 $chunks = [$attendeeUserIds];
76 foreach ($chunks as $chunk)
85 array $attendeeEntities
89 $newAccessCodes = $attendeeService->getAttendeeAccessCodes($attendeeEntities,
$userId);
91 if ($oldAccessCodes === $newAccessCodes)
98 $oldAttendeeIds = \CCalendar::GetDestinationUsers($oldAccessCodes);
99 $newAttendeeIds = \CCalendar::GetDestinationUsers($newAccessCodes);
101 $excluded = array_diff($oldAttendeeIds, $newAttendeeIds);
107 $included = array_diff($newAttendeeIds, $oldAttendeeIds);
116 OpenEventCategoryAttendeeTable::deleteByFilter([
117 'CATEGORY_ID' => $eventCategoryId,
118 'USER_ID' => $excludedUserIds,
124 public function createSystem(
int $categoryId): void
127 $mapperFactory = ServiceLocator::getInstance()->get(
'calendar.service.mappers.factory');
129 $eventCategory = $mapperFactory->getEventCategory()->getById($categoryId);
130 if ($eventCategory->getClosed())
135 OpenEventCategoryAttendeeTable::add([
136 'CATEGORY_ID' => $eventCategory->getId(),
137 'USER_ID' => Common::SYSTEM_USER_ID,
145 if (!isset(self::$cache[
$key]))
147 self::$cache[
$key] = (bool)OpenEventCategoryAttendeeTable::query()
149 ->where(
'CATEGORY_ID', $categoryId)
155 return self::$cache[
$key];
158 private function getKey(
int $categoryId,
int $userId): string
160 return sprintf(
'is_attendee:%d:%d', $categoryId,
$userId);
163 private function __construct()
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
setAccessCodes(?array $accessCodes)
processAttendeesForExistCategory(int $userId, EventCategory $eventCategory, array $attendeeEntities)
addAttendeesToCategory(int $eventCategoryId, array $attendeeUserIds)
addAttendeesToCategoryByChunk(int $eventCategoryId, array $attendeeUserIds, int $chunkSize=200)
deleteAttendeesFromCategory(int $eventCategoryId, array $excludedUserIds)
processAttendeesForNewCategory(int $userId, EventCategory $eventCategory, array $attendeeEntities)
isAttendee(int $categoryId, int $userId)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"