1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
workgrouprequestsin.php
См. документацию.
1<?php
2
9
10namespace Bitrix\Socialnetwork\Internals\Counter\Provider;
11
12use Bitrix\Main\ArgumentException;
13use Bitrix\Socialnetwork\UserToGroupTable;
14
15class WorkgroupRequestsIn implements Base
16{
17 private int $groupId;
18 private int $counterValue;
19
20 private static array $instance = [];
21
22 public static function getInstance($groupId): self
23 {
24 if (!array_key_exists($groupId, self::$instance))
25 {
26 self::$instance[$groupId] = new self($groupId);
27 }
28
29 return self::$instance[$groupId];
30 }
31
32 private function __construct(int $groupId)
33 {
34 if ($groupId <= 0)
35 {
36 throw new ArgumentException('Wrong workgroupId value');
37 }
38
39 $this->groupId = $groupId;
40 $this->fillCounterValue();
41 }
42
43 public function getCounterValue(): array
44 {
45 return [
46 'all' => $this->counterValue,
47 ];
48 }
49
50 private function fillCounterValue(): void
51 {
52 $this->counterValue = (new \Bitrix\Main\Entity\Query(UserToGroupTable::getEntity()))
53 ->addFilter('=GROUP_ID', $this->groupId)
54 ->addFilter('=ROLE', UserToGroupTable::ROLE_REQUEST)
55 ->addFilter('=INITIATED_BY_TYPE', UserToGroupTable::INITIATED_BY_USER)
56 ->addSelect('ID')
57 ->countTotal(true)
58 ->exec()
59 ->getCount();
60 }
61}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804