• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/util/process.php
  • Класс: BitrixTasksUtilProcess
  • Вызов: Process::getPercent
public function getPercent()
	{
		if($this->stage === false)
		{
			return 100;
		}

		try
		{
			$prevStage = $this->getPreviousStage();
			$percent = $this->stages[$prevStage]['PERCENT'];
		}
		catch(FlowException $e)
		{
			$percent = 0;
		}

		$subPercent = 0;
		if(is_callable(array($this, $this->stage.'LocalPercent')))
		{
			$localPercent = call_user_func(array($this, $this->stage.'LocalPercent'));

			$base = $this->getStagePercent($this->stage) - $this->getStagePercent($this->getStageIndexByCode($this->stage) - 1);
			if($base > 0)
			{
				// rescale percent
				$subPercent = floor(($localPercent/100) * $base);
			}
		}

		return $percent + $subPercent;
	}