diff options
Diffstat (limited to 'framework/Web/UI/WebControls/TWizard.php')
-rw-r--r-- | framework/Web/UI/WebControls/TWizard.php | 98 |
1 files changed, 74 insertions, 24 deletions
diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php index 684ef5dc..a4a0e36a 100644 --- a/framework/Web/UI/WebControls/TWizard.php +++ b/framework/Web/UI/WebControls/TWizard.php @@ -84,6 +84,7 @@ class TWizard extends TWebControl implements INamingContainer {
/**
* Wizard step types.
+ * @deprecated deprecated since version 3.0.4 (use TWizardStepType constants instead)
*/
const ST_AUTO='Auto';
const ST_START='Start';
@@ -917,7 +918,7 @@ class TWizard extends TWebControl implements INamingContainer }
}
$activeStepType=$this->getStepType($activeStep);
- if($activeStepType===self::ST_COMPLETE)
+ if($activeStepType===TWizardStepType::Complete)
{
$this->_sideBar->setVisible(false);
$this->_header->setVisible(false);
@@ -1013,24 +1014,24 @@ class TWizard extends TWebControl implements INamingContainer /**
* Determines the type of the specified wizard step.
* @param TWizardStep
- * @return string type of the step, 'Finish', 'Start', 'Step'.
+ * @return TWizardStepType type of the step
*/
protected function getStepType($wizardStep)
{
- if(($type=$wizardStep->getStepType())===self::ST_AUTO)
+ if(($type=$wizardStep->getStepType())===TWizardStepType::Auto)
{
$steps=$this->getWizardSteps();
if(($index=$steps->indexOf($wizardStep))>=0)
{
$stepCount=$steps->getCount();
- if($stepCount===1 || ($index<$stepCount-1 && $steps->itemAt($index+1)->getStepType()==='Complete'))
- return self::ST_FINISH;
+ if($stepCount===1 || ($index<$stepCount-1 && $steps->itemAt($index+1)->getStepType()===TWizardStepType::Complete))
+ return TWizardStepType::Finish;
else if($index===0)
- return self::ST_START;
+ return TWizardStepType::Start;
else if($index===$stepCount-1)
- return self::ST_FINISH;
+ return TWizardStepType::Finish;
else
- return self::ST_STEP;
+ return TWizardStepType::Step;
}
else
return $type;
@@ -1161,7 +1162,7 @@ class TWizard extends TWebControl implements INamingContainer if(($button=$item->findControl(self::ID_SIDEBAR_BUTTON))!==null)
{
$step=$item->getDataItem();
- if(($this->getStepType($step)==='Complete'))
+ if(($this->getStepType($step)===TWizardStepType::Complete))
$button->setEnabled(false);
if(($title=$step->getTitle())!=='')
$button->setText($title);
@@ -1514,19 +1515,19 @@ class TWizardNavigationButtonStyle extends TStyle }
/**
- * @return string button type. Default to 'Button'.
+ * @return TWizardNavigationButtonType button type. Default to TWizardNavigationButtonType::Button.
*/
public function getButtonType()
{
- return $this->_buttonType===null?'Button':$this->_buttonType;
+ return $this->_buttonType===null? TWizardNavigationButtonType::Button :$this->_buttonType;
}
/**
- * @param string button type. Valid values include 'Button', 'Image', 'Link'.
+ * @param TWizardNavigationButtonType button type.
*/
public function setButtonType($value)
{
- $this->_buttonType=TPropertyValue::ensureEnum($value,'Button','Image','Link');
+ $this->_buttonType=TPropertyValue::ensureEnum($value,'TWizardNavigationButtonType');
}
/**
@@ -1617,22 +1618,22 @@ class TWizardStep extends TView }
/**
- * @return string the wizard step type. Defaults to 'Auto'.
+ * @return TWizardStepType the wizard step type. Defaults to TWizardStepType::Auto.
*/
public function getStepType()
{
- return $this->getViewState('StepType',TWizard::ST_AUTO);
+ return $this->getViewState('StepType',TWizardStepType::Auto);
}
/**
- * @param string the wizard step type. Valid values include 'Auto', 'Complete', 'Start', 'Step', 'Finish'.
+ * @param TWizardStepType the wizard step type.
*/
public function setStepType($type)
{
- $type=TPropertyValue::ensureEnum($type,TWizard::ST_AUTO,TWizard::ST_COMPLETE,TWizard::ST_STEP,TWizard::ST_START,TWizard::ST_FINISH);
+ $type=TPropertyValue::ensureEnum($type,'TWizardStepType');
if($type!==$this->getStepType())
{
- $this->setViewState('StepType',$type,TWizard::ST_AUTO);
+ $this->setViewState('StepType',$type,TWizardStepType::Auto);
if($this->_wizard)
$this->_wizard->wizardStepsChanged();
}
@@ -1643,7 +1644,7 @@ class TWizardStep extends TView /**
* TCompleteWizardStep class.
*
- * TCompleteWizardStep represents a wizard step of type 'Complete'.
+ * TCompleteWizardStep represents a wizard step of type TWizardStepType::Complete.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @version $Revision: $ $Date: $
@@ -1653,11 +1654,11 @@ class TWizardStep extends TView class TCompleteWizardStep extends TWizardStep
{
/**
- * @return string the wizard step type. Always 'Complete'.
+ * @return TWizardStepType the wizard step type. Always TWizardStepType::Complete.
*/
public function getStepType()
{
- return 'Complete';
+ return TWizardStepType::Complete;
}
/**
@@ -2099,13 +2100,13 @@ class TWizardNavigationTemplate extends TComponent implements ITemplate {
switch($buttonStyle->getButtonType())
{
- case 'Button':
+ case TWizardNavigationButtonType::Button:
$button=new TButton;
break;
- case 'Link' :
+ case TWizardNavigationButtonType::Link:
$button=new TLinkButton;
break;
- case 'Image' :
+ case TWizardNavigationButtonType::Image:
$button=new TImageButton;
$button->setImageUrl($buttonStyle->getImageUrl());
break;
@@ -2217,4 +2218,53 @@ class TWizardStepNavigationTemplate extends TWizardNavigationTemplate }
}
+
+/**
+ * TWizardNavigationButtonType class.
+ * TWizardNavigationButtonType defines the enumerable type for the possible types of buttons
+ * that can be used in the navigation part of a {@link TWizard}.
+ *
+ * The following enumerable values are defined:
+ * - Button: a regular click button
+ * - Image: an image button
+ * - Link: a hyperlink button
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TWizardNavigationButtonType extends TEnumerable
+{
+ const Button='Button';
+ const Image='Image';
+ const Link='Link';
+}
+
+
+/**
+ * TWizardStepType class.
+ * TWizardStepType defines the enumerable type for the possible types of {@link TWizard wizard} steps.
+ *
+ * The following enumerable values are defined:
+ * - Auto: the type is automatically determined based on the location of the wizard step in the whole step collection.
+ * - Complete: the step is the last summary step.
+ * - Start: the step is the first step
+ * - Step: the step is between the begin and the end steps.
+ * - Finish: the last step before the Complete step.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class TWizardStepType extends TEnumerable
+{
+ const Auto='Auto';
+ const Complete='Complete';
+ const Start='Start';
+ const Step='Step';
+ const Finish='Finish';
+}
+
?>
\ No newline at end of file |