1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
countersmanager.php
См. документацию.
1<?php
2
3namespace Bitrix\Calendar\Ui;
4
5use Bitrix\Calendar\Internals\Counter;
6
8{
9 private const RED_COLOR = 'DANGER';
10 private const GREEN_COLOR = 'SUCCESS';
11 private const EMPTY_COLOR = 'THEME';
12
13 private static array $countersValues = [];
14
22 public static function getValues(int $userId, array $groupIds = []): array
23 {
24 if (empty(self::$countersValues[$userId]))
25 {
26 $counterService = Counter::getInstance($userId);
27 $invites = $counterService->get(Counter\CounterDictionary::COUNTER_INVITES);
28
29 self::$countersValues[$userId] = [
30 'invitation' => [
31 'value' => $invites,
32 'color' => self::getCounterColor($invites),
33 'preset_id' => CalendarFilter::PRESET_INVITED,
34 ],
35 // 'comments' => \CUserCounter::GetValue($userId, self::COMMENTS_COUNTER_ID)
36 ];
37
38 if ($groupIds)
39 {
40 foreach ($groupIds as $groupId)
41 {
42 $groupInvites = $counterService->get(
44 $groupId
45 );
46
47 self::$countersValues[$userId] = [
49 'value' => $groupInvites,
50 'color' => self::getCounterColor($groupInvites),
51 'preset_id' => CalendarFilter::PRESET_INVITED,
52 ]
53 ];
54 }
55 }
56 }
57
58 return self::$countersValues[$userId];
59 }
60
61 private static function getCounterColor(int $value): string
62 {
63 return $value > 0 ? self::RED_COLOR : self::EMPTY_COLOR;
64 }
65}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
static getValues(int $userId, array $groupIds=[])
Определения countersmanager.php:22
static getInstance()
Определения application.php:98
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804