1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
CollabInfo.php
См. документацию.
1<?php
2
4
8
9class CollabInfo implements PopupDataItem
10{
11 use ContextCustomer;
12
13 private Chat\CollabChat $chat;
14 private GuestCounter $guestCounter;
15
16 public function __construct(Chat\CollabChat $chat)
17 {
18 $this->chat = $chat;
19 $this->guestCounter = new GuestCounter($this->chat);
20 $this->setContext($chat->getContext());
21 }
22
23 public function merge(PopupDataItem $item): PopupDataItem
24 {
25 return $this;
26 }
27
28 public static function getRestEntityName(): string
29 {
30 return 'collabInfo';
31 }
32
33 public function toRestFormat(array $option = []): ?array
34 {
35 $groupId = (int)$this->chat->getEntityLink()->getEntityId();
36 $entities = (new Chat\Collab\Entity\Factory($groupId))->getEntities();
37 $rest = [
38 'guestCount' => $this->guestCounter->getGuestCount(),
39 'collabId' => $groupId,
40 'entities' => [],
41 ];
42
43 foreach ($entities as $entity)
44 {
45 if ($entity::isAvailable())
46 {
47 $rest['entities'][$entity::getRestEntityName()] = $entity->toRestFormat($option);
48 }
49 }
50
51 return $rest;
52 }
53}
static getRestEntityName()
Определения CollabInfo.php:28
toRestFormat(array $option=[])
Определения CollabInfo.php:33
__construct(Chat\CollabChat $chat)
Определения CollabInfo.php:16
merge(PopupDataItem $item)
Определения CollabInfo.php:23
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$entity
trait ContextCustomer
Определения ContextCustomer.php:12
$option
Определения options.php:1711