• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/wizard_site.php
  • Класс: CWizard
  • Вызов: CWizard::_InitSubStep
function _InitSubStep($stepType, &$arInstallation, $bInitStep = true)
{
	if (!is_array($arInstallation))
		return false;

	if ($stepType == "install" || $stepType == "select")
	{
		$stepTypeKey = mb_strtoupper($stepType."_steps");
		if (!array_key_exists($stepTypeKey, $arInstallation))
			return false;

		$arSteps =& $arInstallation[$stepTypeKey];
	}
	else
	{
		$arSteps =& $arInstallation;
	}

	if (!array_key_exists("SCRIPT", $arSteps) || !array_key_exists("STEPS", $arSteps))
		return false;

	$instScript = $_SERVER["DOCUMENT_ROOT"].$this->path."/".$arSteps["SCRIPT"];
	if (!is_file($instScript))
		return false;

	$package = $this;
	$this->IncludeWizardLang($arSteps["SCRIPT"]);
	include_once($instScript);

	$stepNumber = 1;
	$stepCount = count($arSteps["STEPS"]);
	$firstStepExists = false;
	$lastStepExists = false;

	foreach ($arSteps["STEPS"] as $stepID => $stepClass)
	{
		if (!class_exists($stepClass))
			continue;

		if ($bInitStep)
		{
			$subStep = new $stepClass;
			$this->wizard->AddStep($subStep, $stepID);
		}
		else
		{
			if (!array_key_exists($stepID, $this->wizard->wizardSteps))
				continue;
			$subStep = $this->wizard->wizardSteps[$stepID];
		}

		if ($stepType == "select")
		{
			$subStep->SetCancelStep(BX_WIZARD_CANCEL_ID);
		}
		elseif ($stepType == "install")
		{
			$subStep->SetAutoSubmit();
			$subStep->SetCancelStep(null);
			$subStep->SetPrevStep(null);
		}
		elseif ($stepType == "static")
		{
			$subStep->SetCancelStep(BX_WIZARD_CANCEL_ID);
		}

		//First step
		if ($stepNumber == 1)
		{
			if ($stepType == "install")
				$subStep->SetPrevStep(null); //hide previous button
			$this->__obFirstStep = $subStep;
			$firstStepExists = true;
		}

		//Last step
		if ($stepNumber == $stepCount)
		{
			$this->__obLastStep = $subStep;
			$lastStepExists = true;
		}

		$stepNumber++;
	}

	return ($firstStepExists && $lastStepExists);
}