• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/internals/counter.php
  • Класс: BitrixTasksInternalsCounter
  • Вызов: Counter::get
public function get($name, int $groupId = 0)
{
	$value = 0;

	switch ($name)
	{
		case CounterDictionary::COUNTER_TOTAL:
			$value = $this->get(CounterDictionary::COUNTER_EXPIRED, $groupId)
				+ $this->get(CounterDictionary::COUNTER_NEW_COMMENTS, $groupId)
				+ $this->getMajorForeignExpired();
			break;

		case CounterDictionary::COUNTER_MEMBER_TOTAL:
			$value = $this->get(CounterDictionary::COUNTER_EXPIRED, $groupId)
				+ $this->get(CounterDictionary::COUNTER_NEW_COMMENTS, $groupId);
			break;

		case CounterDictionary::COUNTER_MY:
			$value = $this->get(CounterDictionary::COUNTER_MY_EXPIRED, $groupId)
				+ $this->get(CounterDictionary::COUNTER_MY_NEW_COMMENTS, $groupId);
			break;

		case CounterDictionary::COUNTER_ORIGINATOR:
			$value = $this->get(CounterDictionary::COUNTER_ORIGINATOR_EXPIRED, $groupId)
				+ $this->get(CounterDictionary::COUNTER_ORIGINATOR_NEW_COMMENTS, $groupId);
			break;

		case CounterDictionary::COUNTER_ACCOMPLICES:
			$value = $this->get(CounterDictionary::COUNTER_ACCOMPLICES_EXPIRED, $groupId)
				+ $this->get(CounterDictionary::COUNTER_ACCOMPLICES_NEW_COMMENTS, $groupId);
			break;

		case CounterDictionary::COUNTER_AUDITOR:
			$value = $this->get(CounterDictionary::COUNTER_AUDITOR_EXPIRED, $groupId)
				+ $this->get(CounterDictionary::COUNTER_AUDITOR_NEW_COMMENTS, $groupId);
			break;

		case CounterDictionary::COUNTER_GROUP_EXPIRED:
			if ($groupId && self::isSonetEnable())
			{
				$value = $this->getState()->getValue(CounterDictionary::COUNTER_GROUP_EXPIRED, $groupId)
					- $this->getState()->getValue(CounterDictionary::COUNTER_EXPIRED, $groupId);
				$value = ($value > 0) ? $value : 0;
			}
			break;

		case CounterDictionary::COUNTER_GROUP_COMMENTS:
			if ($groupId && self::isSonetEnable())
			{
				$value = $this->getState()->getValue(CounterDictionary::COUNTER_GROUP_COMMENTS, $groupId)
					- $this->getState()->getValue(CounterDictionary::COUNTER_NEW_COMMENTS, $groupId);
				$value = ($value > 0) ? $value : 0;
			}
			break;

		case CounterDictionary::COUNTER_EFFECTIVE:
			$value = $this->getKpi();
			break;

		case CounterDictionary::COUNTER_PROJECTS_TOTAL_EXPIRED:
		case CounterDictionary::COUNTER_PROJECTS_TOTAL_COMMENTS:
		case CounterDictionary::COUNTER_PROJECTS_FOREIGN_EXPIRED:
		case CounterDictionary::COUNTER_PROJECTS_FOREIGN_COMMENTS:
			if (self::isSonetEnable())
			{
				$counters = $this->getRawCounters(CounterDictionary::META_PROP_PROJECT);
				$type = CounterDictionary::MAP_SONET_TOTAL[$name];
				$value = (isset($counters[$type][0]) && $counters[$type][0]) ? $counters[$type][0] : 0;
			}
			break;

		case CounterDictionary::COUNTER_GROUPS_TOTAL_EXPIRED:
		case CounterDictionary::COUNTER_GROUPS_TOTAL_COMMENTS:
		case CounterDictionary::COUNTER_GROUPS_FOREIGN_EXPIRED:
		case CounterDictionary::COUNTER_GROUPS_FOREIGN_COMMENTS:
			if (self::isSonetEnable())
			{
				$counters = $this->getRawCounters(CounterDictionary::META_PROP_GROUP);
				$type = CounterDictionary::MAP_SONET_TOTAL[$name];
				$value = (isset($counters[$type][0]) && $counters[$type][0]) ? $counters[$type][0] : 0;
			}
			break;

		case CounterDictionary::COUNTER_SONET_TOTAL_EXPIRED:
		case CounterDictionary::COUNTER_SONET_TOTAL_COMMENTS:
		case CounterDictionary::COUNTER_SONET_FOREIGN_EXPIRED:
		case CounterDictionary::COUNTER_SONET_FOREIGN_COMMENTS:
			if (self::isSonetEnable())
			{
				$counters = $this->getRawCounters();
				$type = CounterDictionary::MAP_SONET_TOTAL[$name];
				$value = (isset($counters[$type][0]) && $counters[$type][0]) ? $counters[$type][0] : 0;
			}
			break;

		case CounterDictionary::COUNTER_PROJECTS_MAJOR:
			if (self::isSonetEnable())
			{
				$value = $this->get(CounterDictionary::COUNTER_SONET_TOTAL_EXPIRED)
					+ $this->get(CounterDictionary::COUNTER_SONET_TOTAL_COMMENTS)
					+ $this->getMajorForeignExpired();
			}
			break;

		case CounterDictionary::COUNTER_SCRUM_TOTAL_COMMENTS:
		case CounterDictionary::COUNTER_SCRUM_FOREIGN_COMMENTS:
			if (self::isSonetEnable())
			{
				$counters = $this->getRawCounters(CounterDictionary::META_PROP_SCRUM);
				$type = CounterDictionary::MAP_SCRUM_TOTAL[$name];
				$value = (isset($counters[$type][0]) && $counters[$type][0]) ? $counters[$type][0] : 0;
			}
			break;

		default:
			$value = $this->getState()->getValue($name, $groupId);
			break;
	}

	return $value;
}