• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/update/stepper.php
  • Класс: BitrixMainUpdateStepper
  • Вызов: Stepper::getHtml
static function getHtml($ids = array(), $title = "")
{
	if (static::class !== __CLASS__)
	{
		$title = static::getTitle();
		$ids = [static::$moduleId => [ static::class ]];
		return call_user_func(array(__CLASS__, "getHtml"), $ids, $title);
	}

	$return = array();
	$count = 0;
	$steps = 0;

	if (is_string($ids))
	{
		$ids = array($ids => null);
	}

	foreach($ids as $moduleId => $classesId)
	{
		if (is_string($classesId))
			$classesId = array($classesId);
		if (is_array($classesId))
		{
			foreach($classesId as $classId)
			{
				if (($option = Option::get("main.stepper.".$moduleId, $classId, "")) !== "")
				{
					$option = unserialize($option, ['allowed_classes' => false]);
					if (is_array($option))
					{
						$return[] = array(
							"moduleId" => $moduleId,
							"class" => $classId,
							"title" => $option["title"],
							"steps" => $option["steps"],
							"count" => $option["count"]
						);
						$count += $option["count"];
						$steps += ($option["count"] > $option["steps"] ? $option["steps"] : $option["count"]);
					}
				}
			}
		}
		else if (is_null($classesId))
		{
			$options = Option::getForModule("main.stepper.".$moduleId);
			foreach($options as $classId => $option)
			{
				$option = unserialize($option, ['allowed_classes' => false]);
				if (is_array($option))
				{
					$return[] = array(
						"moduleId" => $moduleId,
						"class" => $classId,
						"title" => $option["title"],
						"steps" => $option["steps"],
						"count" => $option["count"]
					);
					$count += $option["count"];
					$steps += ($option["count"] > $option["steps"] ? $option["steps"] : $option["count"]);
				}
			}
		}
	}

	$result = '';
	if (!empty($return))
	{
		$id = ++self::$countId;
		CJSCore::Init(array('update_stepper'));
		$title = empty($title) ? self::getTitle() : $title;
		$progress = $count > 0 ? intval($steps * 100 / $count) : 0;
		$result .= <<
{$title}
{$steps} / {$count}
HTML; $return = CUtil::PhpToJSObject($return); $result = <<{$result}
HTML; } return $result; }