| // +---------------------------------------------------------------------------+ // $Id$ /** * This class demonstrates Wizard Functionality * * @package wiztest * @author Malaney J. Hill */ class WiztestMgr extends SGL_Manager { function WiztestMgr() { SGL::logMessage(null, PEAR_LOG_DEBUG); parent::SGL_Manager(); $this->pageTitle = 'Wiztest Manager'; $this->template = 'wiztestMgrList.html'; $this->_aActionsMapping = array( 'wizard' => array('wizard') ); } function validate($req, &$input) { SGL::logMessage(null, PEAR_LOG_DEBUG); $this->validated = true; $input->error = array(); $input->pageTitle = $this->pageTitle; $input->masterTemplate = $this->masterTemplate; $input->template = $this->template; $input->action = ($req->get('action')) ? $req->get('action') : 'list'; $input->aDelete = $req->get('frmDelete'); $input->submit = $req->get('submitted'); // if errors have occured if (isset($aErrors) && count($aErrors)) { SGL::raiseMsg('Please fill in the indicated fields'); $input->error = $aErrors; $this->validated = false; } } function _cmd_wizard(&$input, &$output) { SGL::logMessage(null, PEAR_LOG_DEBUG); $output->template = 'wizard.html'; $output->pageTitle = 'Add Client Wizard'; require_once SGL_LIB_DIR . '/SGL/WizardController.php'; require_once 'ClientWizard.php'; // Instantiate the Controller $controller =& new SGL_WizardController('clientWizard'); // Set defaults for the form elements $controller->setDefaults(array( 'first_name' => 'Thierry', 'last_name' => 'Henry' )); // Add pages to Controller $controller->addPage(new PageClientDetails('page1')); $controller->addPage(new PageServiceDetails('page2')); $controller->addPage(new PageSurveyDetails('page3')); // Add actions to controller $controller->addAction('display', new SGL_WizardControllerDisplay()); $controller->addAction('jump', new SGL_WizardControllerJump()); $controller->addAction('process', new SGL_WizardControllerProcess()); // Process the request $controller->run(); // Get the current page name list($pageName, $actionName) = $controller->getActionName(); $page = $controller->getPage($pageName); // Set page output vars $output->wizardOutput = $page->wizardOutput; $output->wizardData = $page->wizardData; } } ?>