summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TWizard.php
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2015-01-20 23:42:12 +0100
committerFabio Bas <ctrlaltca@gmail.com>2015-01-20 23:42:12 +0100
commitca22da21b0cedab985e698f4dedf3ac1158a1487 (patch)
treea20472bc56644eea7b98aeaadb851ad29fe3dc1a /framework/Web/UI/WebControls/TWizard.php
parentab5b3b30e2fc7e1ef60cb5ead102f48d8ec1aa84 (diff)
one class per file: framework/Web/UI/WebControls
Diffstat (limited to 'framework/Web/UI/WebControls/TWizard.php')
-rw-r--r--framework/Web/UI/WebControls/TWizard.php710
1 files changed, 1 insertions, 709 deletions
diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php
index 6b82a691..75653f4e 100644
--- a/framework/Web/UI/WebControls/TWizard.php
+++ b/framework/Web/UI/WebControls/TWizard.php
@@ -1434,712 +1434,4 @@ class TWizard extends TWebControl implements INamingContainer
}
return false;
}
-}
-
-
-/**
- * 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 System.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,'TWizardStepType');
- if($type!==$this->getStepType())
- {
- $this->setViewState('StepType',$type,TWizardStepType::Auto);
- if($this->_wizard)
- $this->_wizard->wizardStepsChanged();
- }
- }
-}
-
-
-/**
- * TCompleteWizardStep class.
- *
- * TCompleteWizardStep represents a wizard step of type TWizardStepType::Complete.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TCompleteWizardStep extends TWizardStep
-{
- /**
- * @return TWizardStepType the wizard step type. Always TWizardStepType::Complete.
- */
- public function getStepType()
- {
- return TWizardStepType::Complete;
- }
-
- /**
- * @param string the wizard step type.
- * @throws TInvalidOperationException whenever this method is invoked.
- */
- public function setStepType($value)
- {
- throw new TInvalidOperationException('completewizardstep_steptype_readonly');
- }
-}
-
-
-/**
- * TTemplatedWizardStep class.
- *
- * TTemplatedWizardStep represents a wizard step whose content and navigation
- * can be customized using templates. To customize the step content, specify
- * {@link setContentTemplate ContentTemplate}. To customize navigation specific
- * to the step, specify {@link setNavigationTemplate NavigationTemplate}. Note,
- * if the navigation template is not specified, default navigation will be used.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TTemplatedWizardStep extends TWizardStep implements INamingContainer
-{
- /**
- * @var ITemplate the template for displaying the navigation UI of a wizard step.
- */
- private $_navigationTemplate=null;
- /**
- * @var ITemplate the template for displaying the content within the wizard step.
- */
- private $_contentTemplate=null;
- /**
- * @var TWizardNavigationContainer
- */
- private $_navigationContainer=null;
-
- /**
- * Creates child controls.
- * This method mainly instantiates the content template, if any.
- */
- public function createChildControls()
- {
- $this->getControls()->clear();
- if($this->_contentTemplate)
- $this->_contentTemplate->instantiateIn($this);
- }
-
- /**
- * Ensures child controls are created.
- * @param mixed event parameter
- */
- public function onInit($param)
- {
- parent::onInit($param);
- $this->ensureChildControls();
- }
-
- /**
- * @return ITemplate the template for the content of the wizard step.
- */
- public function getContentTemplate()
- {
- return $this->_contentTemplate;
- }
-
- /**
- * @param ITemplate the template for the content of the wizard step.
- */
- public function setContentTemplate($value)
- {
- $this->_contentTemplate=$value;
- }
-
- /**
- * @return ITemplate the template for displaying the navigation UI of a wizard step. Defaults to null.
- */
- public function getNavigationTemplate()
- {
- return $this->_navigationTemplate;
- }
-
- /**
- * @param ITemplate the template for displaying the navigation UI of a wizard step.
- */
- public function setNavigationTemplate($value)
- {
- $this->_navigationTemplate=$value;
- }
-
- /**
- * @return TWizardNavigationContainer the control containing the navigation.
- * It could be null if no navigation template is specified.
- */
- public function getNavigationContainer()
- {
- return $this->_navigationContainer;
- }
-
- /**
- * Instantiates the navigation template if any
- */
- public function instantiateNavigationTemplate()
- {
- if(!$this->_navigationContainer && $this->_navigationTemplate)
- {
- $this->_navigationContainer=new TWizardNavigationContainer;
- $this->_navigationTemplate->instantiateIn($this->_navigationContainer);
- }
- }
-}
-
-
-/**
- * TWizardStepCollection class.
- *
- * TWizardStepCollection represents the collection of wizard steps owned
- * by a {@link TWizard}.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TWizardStepCollection extends TList
-{
- /**
- * @var TWizard
- */
- private $_wizard;
-
- /**
- * Constructor.
- * @param TWizard wizard that owns this collection
- */
- public function __construct(TWizard $wizard)
- {
- $this->_wizard=$wizard;
- }
-
- /**
- * Inserts an item at the specified position.
- * This method overrides the parent implementation by checking if
- * the item being added is a {@link TWizardStep}.
- * @param integer the speicified position.
- * @param mixed new item
- * @throws TInvalidDataTypeException if the item being added is not TWizardStep.
- */
- public function insertAt($index,$item)
- {
- if($item instanceof TWizardStep)
- {
- parent::insertAt($index,$item);
- $this->_wizard->getMultiView()->getViews()->insertAt($index,$item);
- $this->_wizard->addedWizardStep($item);
- }
- else
- throw new TInvalidDataTypeException('wizardstepcollection_wizardstep_required');
- }
-
- /**
- * Removes an item at the specified position.
- * @param integer the index of the item to be removed.
- * @return mixed the removed item.
- */
- public function removeAt($index)
- {
- $step=parent::removeAt($index);
- $this->_wizard->getMultiView()->getViews()->remove($step);
- $this->_wizard->removedWizardStep($step);
- return $step;
- }
-}
-
-
-/**
- * TWizardNavigationContainer class.
- *
- * TWizardNavigationContainer represents a control containing
- * a wizard navigation. The navigation may contain a few buttons, including
- * {@link getPreviousButton PreviousButton}, {@link getNextButton NextButton},
- * {@link getCancelButton CancelButton}, {@link getCompleteButton CompleteButton}.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TWizardNavigationContainer extends TControl implements INamingContainer
-{
- private $_previousButton=null;
- private $_nextButton=null;
- private $_cancelButton=null;
- private $_completeButton=null;
-
- /**
- * @return mixed the previous button
- */
- public function getPreviousButton()
- {
- return $this->_previousButton;
- }
-
- /**
- * @param mixed the previous button
- */
- public function setPreviousButton($value)
- {
- $this->_previousButton=$value;
- }
-
- /**
- * @return mixed the next button
- */
- public function getNextButton()
- {
- return $this->_nextButton;
- }
-
- /**
- * @param mixed the next button
- */
- public function setNextButton($value)
- {
- $this->_nextButton=$value;
- }
-
- /**
- * @return mixed the cancel button
- */
- public function getCancelButton()
- {
- return $this->_cancelButton;
- }
-
- /**
- * @param mixed the cancel button
- */
- public function setCancelButton($value)
- {
- $this->_cancelButton=$value;
- }
-
- /**
- * @return mixed the complete button
- */
- public function getCompleteButton()
- {
- return $this->_completeButton;
- }
-
- /**
- * @param mixed the complete button
- */
- public function setCompleteButton($value)
- {
- $this->_completeButton=$value;
- }
-}
-
-
-/**
- * TWizardNavigationEventParameter class.
- *
- * TWizardNavigationEventParameter represents the parameter for
- * {@link TWizard}'s navigation events.
- *
- * The index of the currently active step can be obtained from
- * {@link getCurrentStepIndex CurrentStepIndex}, while the index
- * of the candidate new step is in {@link getNextStepIndex NextStepIndex}.
- * By modifying {@link setNextStepIndex NextStepIndex}, the new step
- * can be changed to another one. If there is anything wrong with
- * the navigation and it is not wanted, set {@link setCancelNavigation CancelNavigation}
- * to true.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TWizardNavigationEventParameter extends TEventParameter
-{
- private $_cancel=false;
- private $_currentStep;
- private $_nextStep;
-
- /**
- * Constructor.
- * @param integer current step index
- */
- public function __construct($currentStep)
- {
- $this->_currentStep=$currentStep;
- $this->_nextStep=$currentStep;
- }
-
- /**
- * @return integer the zero-based index of the currently active step.
- */
- public function getCurrentStepIndex()
- {
- return $this->_currentStep;
- }
-
- /**
- * @return integer the zero-based index of the next step. Default to {@link getCurrentStepIndex CurrentStepIndex}.
- */
- public function getNextStepIndex()
- {
- return $this->_nextStep;
- }
-
- /**
- * @param integer the zero-based index of the next step.
- */
- public function setNextStepIndex($index)
- {
- $this->_nextStep=TPropertyValue::ensureInteger($index);
- }
-
- /**
- * @return boolean whether navigation to the next step should be canceled. Default to false.
- */
- public function getCancelNavigation()
- {
- return $this->_cancel;
- }
-
- /**
- * @param boolean whether navigation to the next step should be canceled.
- */
- public function setCancelNavigation($value)
- {
- $this->_cancel=TPropertyValue::ensureBoolean($value);
- }
-}
-
-/**
- * TWizardSideBarTemplate class.
- * TWizardSideBarTemplate is the default template for wizard sidebar.
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TWizardSideBarTemplate extends TComponent implements ITemplate
-{
- /**
- * Instantiates the template.
- * It creates a {@link TDataList} control.
- * @param TControl parent to hold the content within the template
- */
- public function instantiateIn($parent)
- {
- $dataList=new TDataList;
- $dataList->setID(TWizard::ID_SIDEBAR_LIST);
- $dataList->getSelectedItemStyle()->getFont()->setBold(true);
- $dataList->setItemTemplate(new TWizardSideBarListItemTemplate);
- $parent->getControls()->add($dataList);
- }
-}
-
-/**
- * TWizardSideBarListItemTemplate class.
- * TWizardSideBarListItemTemplate is the default template for each item in the sidebar datalist.
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TWizardSideBarListItemTemplate extends TComponent implements ITemplate
-{
- /**
- * Instantiates the template.
- * It creates a {@link TLinkButton}.
- * @param TControl parent to hold the content within the template
- */
- public function instantiateIn($parent)
- {
- $button=new TLinkButton;
- $button->setID(TWizard::ID_SIDEBAR_BUTTON);
- $parent->getControls()->add($button);
- }
-}
-
-/**
- * TWizardNavigationTemplate class.
- * TWizardNavigationTemplate is the base class for various navigation templates.
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TWizardNavigationTemplate extends TComponent implements ITemplate
-{
- private $_wizard;
-
- /**
- * Constructor.
- * @param TWizard the wizard owning this template
- */
- public function __construct($wizard)
- {
- $this->_wizard=$wizard;
- }
-
- /**
- * @return TWizard the wizard owning this template
- */
- public function getWizard()
- {
- return $this->_wizard;
- }
-
- /**
- * Instantiates the template.
- * Derived classes should override this method.
- * @param TControl parent to hold the content within the template
- */
- public function instantiateIn($parent)
- {
- }
-
- /**
- * Creates a navigation button.
- * It creates a {@link TButton}, {@link TLinkButton}, or {@link TImageButton},
- * depending on the given parameters.
- * @param TWizardNavigationButtonStyle button style
- * @param boolean whether the button should cause validation
- * @param string command name for the button's OnCommand event
- * @throws TInvalidDataValueException if the button type is not recognized
- */
- protected function createNavigationButton($buttonStyle,$causesValidation,$commandName)
- {
- switch($buttonStyle->getButtonType())
- {
- case TWizardNavigationButtonType::Button:
- $button=new TButton;
- break;
- case TWizardNavigationButtonType::Link:
- $button=new TLinkButton;
- break;
- case TWizardNavigationButtonType::Image:
- $button=new TImageButton;
- $button->setImageUrl($buttonStyle->getImageUrl());
- break;
- default:
- throw new TInvalidDataValueException('wizard_buttontype_unknown',$buttonStyle->getButtonType());
- }
- $button->setText($buttonStyle->getButtonText());
- $button->setCausesValidation($causesValidation);
- $button->setCommandName($commandName);
- return $button;
- }
-}
-
-/**
- * TWizardStartNavigationTemplate class.
- * TWizardStartNavigationTemplate is the template used as default wizard start navigation panel.
- * It consists of two buttons, Next and Cancel.
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TWizardStartNavigationTemplate extends TWizardNavigationTemplate
-{
- /**
- * Instantiates the template.
- * @param TControl parent to hold the content within the template
- */
- public function instantiateIn($parent)
- {
- $nextButton=$this->createNavigationButton($this->getWizard()->getStartNextButtonStyle(),true,TWizard::CMD_NEXT);
- $cancelButton=$this->createNavigationButton($this->getWizard()->getCancelButtonStyle(),false,TWizard::CMD_CANCEL);
-
- $controls=$parent->getControls();
- $controls->add($nextButton);
- $controls->add("\n");
- $controls->add($cancelButton);
-
- $parent->setNextButton($nextButton);
- $parent->setCancelButton($cancelButton);
- }
-}
-
-/**
- * TWizardFinishNavigationTemplate class.
- * TWizardFinishNavigationTemplate is the template used as default wizard finish navigation panel.
- * It consists of three buttons, Previous, Complete and Cancel.
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TWizardFinishNavigationTemplate extends TWizardNavigationTemplate
-{
- /**
- * Instantiates the template.
- * @param TControl parent to hold the content within the template
- */
- public function instantiateIn($parent)
- {
- $previousButton=$this->createNavigationButton($this->getWizard()->getFinishPreviousButtonStyle(),false,TWizard::CMD_PREVIOUS);
- $completeButton=$this->createNavigationButton($this->getWizard()->getFinishCompleteButtonStyle(),true,TWizard::CMD_COMPLETE);
- $cancelButton=$this->createNavigationButton($this->getWizard()->getCancelButtonStyle(),false,TWizard::CMD_CANCEL);
-
- $controls=$parent->getControls();
- $controls->add($previousButton);
- $controls->add("\n");
- $controls->add($completeButton);
- $controls->add("\n");
- $controls->add($cancelButton);
-
- $parent->setPreviousButton($previousButton);
- $parent->setCompleteButton($completeButton);
- $parent->setCancelButton($cancelButton);
- }
-}
-
-/**
- * TWizardStepNavigationTemplate class.
- * TWizardStepNavigationTemplate is the template used as default wizard step navigation panel.
- * It consists of three buttons, Previous, Next and Cancel.
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TWizardStepNavigationTemplate extends TWizardNavigationTemplate
-{
- /**
- * Instantiates the template.
- * @param TControl parent to hold the content within the template
- */
- public function instantiateIn($parent)
- {
- $previousButton=$this->createNavigationButton($this->getWizard()->getStepPreviousButtonStyle(),false,TWizard::CMD_PREVIOUS);
- $nextButton=$this->createNavigationButton($this->getWizard()->getStepNextButtonStyle(),true,TWizard::CMD_NEXT);
- $cancelButton=$this->createNavigationButton($this->getWizard()->getCancelButtonStyle(),false,TWizard::CMD_CANCEL);
-
- $controls=$parent->getControls();
- $controls->add($previousButton);
- $controls->add("\n");
- $controls->add($nextButton);
- $controls->add("\n");
- $controls->add($cancelButton);
-
- $parent->setPreviousButton($previousButton);
- $parent->setNextButton($nextButton);
- $parent->setCancelButton($cancelButton);
- }
-}
-
-
-/**
- * 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>
- * @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>
- * @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