Документация для разработчиков
Темная тема

IsNextButtonClick

Описание

bool
IsNextButtonClick();

Метод возвращает true, если была нажата кнопка Далее, иначе false.

Смотрите также

Примеры использования

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
class FirstStep extends CWizardStep
{
	function InitStep()
	{
		$this->SetTitle("Первый шаг");
		$this->SetStepID("first");
		$this->SetNextStep("second");
		$this->SetPrevStep("second");
		$this->SetFinishStep("second");
		$this->SetCancelStep("second");
	}
	function OnPostForm()
	{
		$wizard =& $this->GetWizard();
		$code = $wizard->GetVar("code");
		if (strlen($code) <= 0)
			return;
		if ($code == "xxx")
			$this->SetError("Вы ввели запрещённый код", "code");
		if ($wizard->IsNextButtonClick() && $code == "aaa")
			$wizard->SetCurrentStep("first");
		elseif ($wizard->IsPrevButtonClick() && $code == "bbb")
			$wizard->SetCurrentStep("third");
		elseif ($wizard->IsFinishButtonClick() && $code == "ccc")
			$wizard->SetCurrentStep("fourth");
		elseif ($wizard->IsCancelButtonClick() && $code == "ddd")
			$wizard->SetCurrentStep("first");
	}
	function ShowStep()
	{
		$this->content .= '<div class="wizard-note-box">Следующий шаг мастера зависит от введенного кода и нажатой кнопки.</div><br />';
		$this->content .= "Введите код: ".$this->ShowInputField("text", "code", Array("size" => "15"));
		$this->content .= <<<HTML
		<br /><br />Подсказка:<br />
		<table class="wizard-data-table">
			<tr>
				<th>Кнопка навигации</th>
				<th>Код</th>
				<th>Результат</th>
			</tr>
			<tr>
				<td>Далее</td>
				<td>aaa</td>
				<td>Шаг 1</td>
			</tr>
			<tr>
				<td>Назад</td>
				<td>bbb</td>
				<td>Шаг 3</td>
			</tr>
			<tr>
				<td>Готово</td>
				<td>ccc</td>
				<td>Шаг 4</td>
			</tr>
			<tr>
				<td>Отмена</td>
				<td>ddd</td>
				<td>Шаг 1</td>
			</tr>
			<tr>
				<td>любая</td>
				<td>xxx</td>
				<td>ошибка</td>
			</tr>
			<tr>
				<td colspan="2">любые другие значения</td>
				<td>Шаг 2</td>
			</tr>
		</table>
HTML;
	}
}
class SecondStep extends CWizardStep
{
	function InitStep()
	{
		$this->SetTitle("Второй шаг");
		$this->SetStepID("second");
		$this->SetNextStep("third");
		$this->SetPrevStep("first");
	}
}
class ThirdStep extends CWizardStep
{
	function InitStep()
	{
		$this->SetTitle("Третий шаг");
		$this->SetStepID("third");
		$this->SetNextStep("fourth");
	}
}
class FourthStep extends CWizardStep
{
	function InitStep()
	{
		$this->SetTitle("Четвертый шаг");
		$this->SetStepID("fourth");
		$this->SetCancelStep("fourth");
	}
}
?>

Статическое определение шагов в файле .description.php

<?
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
$arWizardDescription = Array(
	"NAME" => "Мой мастер",
	"STEPS" => Array("FirstStep", "SecondStep", "ThirdStep", "FourthStep"),
);
?>

Или динамическое определение шагов в файле wizard.php

$wizard = new CWizardBase("Мой мастер", $package);
$wizard->AddSteps(Array("FirstStep", "SecondStep", "ThirdStep", "FourthStep"));
$wizard->Display();


© «Битрикс», 2001-2024, «1С-Битрикс», 2024