• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/counter.php
  • Класс: BitrixTasksInternalsCounter
  • Вызов: Counter::getCounters
public function getCounters($role, int $groupId = 0, $params = []): array
{
	$skipAccessCheck = (isset($params['SKIP_ACCESS_CHECK']) && $params['SKIP_ACCESS_CHECK']);

	if (!$skipAccessCheck && !$this->isAccessToCounters())
	{
		return [];
	}

	switch (strtolower($role))
	{
		case CounterRole::ALL:
			$counters = [
				'total' => [
					'counter' => $this->get(CounterDictionary::COUNTER_MEMBER_TOTAL, $groupId),
					'code' => '',
				],
				'expired' => [
					'counter' => $this->get(CounterDictionary::COUNTER_EXPIRED, $groupId),
					'code' => CounterType::TYPE_EXPIRED,
				],
				'new_comments' => [
					'counter' => $this->get(CounterDictionary::COUNTER_NEW_COMMENTS, $groupId),
					'code' => CounterType::TYPE_NEW_COMMENTS,
				],
			];
			break;

		case CounterRole::RESPONSIBLE:
			$counters = [
				'total' => [
					'counter' => $this->get(CounterDictionary::COUNTER_MY, $groupId),
					'code' => '',
				],
				'expired' => [
					'counter' => $this->get(CounterDictionary::COUNTER_MY_EXPIRED, $groupId),
					'code' => CounterType::TYPE_EXPIRED,
				],
				'new_comments' => [
					'counter' => $this->get(CounterDictionary::COUNTER_MY_NEW_COMMENTS, $groupId),
					'code' => CounterType::TYPE_NEW_COMMENTS,
				],
			];
			break;

		case CounterRole::ORIGINATOR:
			$counters = [
				'total' => [
					'counter' => $this->get(CounterDictionary::COUNTER_ORIGINATOR, $groupId),
					'code' => '',
				],
				'expired' => [
					'counter' => $this->get(CounterDictionary::COUNTER_ORIGINATOR_EXPIRED, $groupId),
					'code' => CounterType::TYPE_EXPIRED,
				],
				'new_comments' => [
					'counter' => $this->get(CounterDictionary::COUNTER_ORIGINATOR_NEW_COMMENTS, $groupId),
					'code' => CounterType::TYPE_NEW_COMMENTS,
				],
			];
			break;

		case CounterRole::ACCOMPLICE:
			$counters = [
				'total' => [
					'counter' => $this->get(CounterDictionary::COUNTER_ACCOMPLICES, $groupId),
					'code' => '',
				],
				'expired' => [
					'counter' => $this->get(CounterDictionary::COUNTER_ACCOMPLICES_EXPIRED, $groupId),
					'code' => CounterType::TYPE_EXPIRED,
				],
				'new_comments' => [
					'counter' => $this->get(CounterDictionary::COUNTER_ACCOMPLICES_NEW_COMMENTS, $groupId),
					'code' => CounterType::TYPE_NEW_COMMENTS,
				],
			];
			break;

		case CounterRole::AUDITOR:
			$counters = [
				'total' => [
					'counter' => $this->get(CounterDictionary::COUNTER_AUDITOR, $groupId),
					'code' => '',
				],
				'expired' => [
					'counter' => $this->get(CounterDictionary::COUNTER_AUDITOR_EXPIRED, $groupId),
					'code' => CounterType::TYPE_EXPIRED,
				],
				'new_comments' => [
					'counter' => $this->get(CounterDictionary::COUNTER_AUDITOR_NEW_COMMENTS, $groupId),
					'code' => CounterType::TYPE_NEW_COMMENTS,
				],
			];
			break;

		default:
			$counters = [];
			break;
	}

	return $counters;
}