summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TWizardStep.php
blob: 4d91227109ebfe202e4dd06d02ce8500a85ef3e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/**
 * TWizard and the relevant class definitions.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @link http://www.pradosoft.com/
 * @copyright Copyright &copy; 2005-2014 PradoSoft
 * @license http://www.pradosoft.com/license/
 * @package Prado\Web\UI\WebControls
 */

namespace Prado\Web\UI\WebControls;
use Prado\TPropertyValue;

/**
 * TWizardStep class.
 *
 * TWizardStep represents a wizard step. The wizard owning the step
 * can be obtained by {@link getWizard Wizard}.
 * To specify the type of the step, set {@link setStepType StepType};
 * For step title, set {@link setTitle Title}. If a step can be re-visited,
 * set {@link setAllowReturn AllowReturn} to true.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @package Prado\Web\UI\WebControls
 * @since 3.0
 */
class TWizardStep extends TView
{
	private $_wizard;

	/**
	 * @return TWizard the wizard owning this step
	 */
	public function getWizard()
	{
		return $this->_wizard;
	}

	/**
	 * Sets the wizard owning this step.
	 * This method is used internally by {@link TWizard}.
	 * @param TWizard the wizard owning this step
	 */
	public function setWizard($wizard)
	{
		$this->_wizard=$wizard;
	}

	/**
	 * @return string the title for this step.
	 */
	public function getTitle()
	{
		return $this->getViewState('Title','');
	}

	/**
	 * @param string the title for this step.
	 */
	public function setTitle($value)
	{
		$this->setViewState('Title',$value,'');
		if($this->_wizard)
			$this->_wizard->wizardStepsChanged();
	}

	/**
	 * @return boolean whether this step can be re-visited. Default to true.
	 */
	public function getAllowReturn()
	{
		return $this->getViewState('AllowReturn',true);
	}

	/**
	 * @param boolean whether this step can be re-visited.
	 */
	public function setAllowReturn($value)
	{
		$this->setViewState('AllowReturn',TPropertyValue::ensureBoolean($value),true);
	}

	/**
	 * @return TWizardStepType the wizard step type. Defaults to TWizardStepType::Auto.
	 */
	public function getStepType()
	{
		return $this->getViewState('StepType',TWizardStepType::Auto);
	}

	/**
	 * @param TWizardStepType the wizard step type.
	 */
	public function setStepType($type)
	{
		$type=TPropertyValue::ensureEnum($type,'Prado\\Web\\UI\\WebControls\\TWizardStepType');
		if($type!==$this->getStepType())
		{
			$this->setViewState('StepType',$type,TWizardStepType::Auto);
			if($this->_wizard)
				$this->_wizard->wizardStepsChanged();
		}
	}
}