Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
countersmanager.php
1<?php
2
3namespace Bitrix\Calendar\Ui;
4
6{
7 private const INVITATION_COUNTER_ID = 'calendar';
8 private const COMMENTS_COUNTER_ID = 'calendar_comments';
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
21 public static function getValues(int $userId): array
22 {
23 if (empty(self::$countersValues[$userId]))
24 {
25 self::$countersValues[$userId] = [
26 'invitation' => [
27 'value' => \CUserCounter::GetValue($userId, self::INVITATION_COUNTER_ID),
28 'color' => self::getCounterColor(\CUserCounter::GetValue($userId, self::INVITATION_COUNTER_ID)),
29 'preset_id' => 'filter_calendar_meeting_status_q'
30 ],
31 // 'comments' => \CUserCounter::GetValue($userId, self::COMMENTS_COUNTER_ID)
32 ];
33 }
34
35 return self::$countersValues[$userId];
36 }
37
38 private static function getCounterColor(int $value): string
39 {
40 return $value > 0 ? self::RED_COLOR : self::EMPTY_COLOR;
41 }
42}