1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
counterprovider.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Integration\Calendar;
4
5use Bitrix\Calendar\Ui\CountersManager;
6use Bitrix\Main\Loader;
7use Bitrix\Socialnetwork\Internals\Space\Counter\Dictionary;
8use Bitrix\Socialnetwork\Internals\Space\Counter\ProviderInterface;
9
11{
12 public function __construct(private int $userId) { }
13
14 public function getTotal(int $spaceId = 0): int
15 {
16 $result = 0;
17
18 if (!$this->isCalendarModuleAvailable())
19 {
20 return $result;
21 }
22
23 if ($spaceId !== 0)
24 {
25 return $result;
26 }
27
28 $counters = CountersManager::getValues($this->userId);
29
30 if (isset($counters['invitation']['value']))
31 {
32 return (int)$counters['invitation']['value'];
33 }
34
35 return $result;
36 }
37
38 public function getValue(int $spaceId = 0, array $metrics = []): int
39 {
40 $result = 0;
41
42 if (!$this->isCalendarModuleAvailable())
43 {
44 return $result;
45 }
46
47 foreach ($metrics as $metric)
48 {
49 switch ($metric)
50 {
52 return $this->getTotal($spaceId);
53 //TODO: other cases ...
54 }
55 }
56
57 return $result;
58 }
59
60 public function getAvailableMetrics(): array
61 {
62 return [
64 ];
65 }
66
67 private function isCalendarModuleAvailable(): bool
68 {
69 return Loader::includeModule('calendar');
70 }
71}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
getValue(int $spaceId=0, array $metrics=[])
Определения counterprovider.php:38
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$result
Определения get_property_values.php:14
$counters
Определения options.php:100