Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
workgrouplisttasks.php
1<?php
2
11
14use Bitrix\Tasks\Internals\Counter;
15
16class WorkgroupListTasks implements Base
17{
18 private int $userId;
19
20 public function __construct(array $params = [])
21 {
22 $this->userId = (int)($params['userId'] ?? 0);
23
24 if ($this->userId <= 0)
25 {
26 throw new ArgumentException('Wrong userId value');
27 }
28 }
29
30 public function getCounterValue(): array
31 {
32 if (!Loader::includeModule('tasks'))
33 {
34 return [];
35 }
36
37 $counter = Counter::getInstance($this->userId);
38
39 return [
40 Counter\CounterDictionary::COUNTER_PROJECTS_MAJOR => (
41 $counter->get(Counter\CounterDictionary::COUNTER_GROUPS_TOTAL_COMMENTS)
42 + $counter->get(Counter\CounterDictionary::COUNTER_PROJECTS_TOTAL_COMMENTS)
43 + $counter->get(Counter\CounterDictionary::COUNTER_GROUPS_TOTAL_EXPIRED)
44 + $counter->get(Counter\CounterDictionary::COUNTER_PROJECTS_TOTAL_EXPIRED)
45 ),
46 Counter\CounterDictionary::COUNTER_SCRUM_TOTAL_COMMENTS => $counter->get(Counter\CounterDictionary::COUNTER_SCRUM_TOTAL_COMMENTS),
47 ];
48 }
49}