Location: PHPKode > projects > AModules3 > amodules-3.0.1/samples/07-wizard/main.php
<?php
/*
 * Created on 10.03.2006 by *Camper*
 */
require "../../trunk/loader.php";

class TestApp extends ApiAdmin{
	function init(){
		$this->readConfig('config.php');
		parent::init();
		$this->template->del('Locator');
		$this->template->del('Menu');
		$this->template->del('LeftSidebar');
		$this->template->del('RightSidebar');
		$this->template->del('InfoWindow');
    }

    function page_Index($p){
    	$frame = $this
    		->frame('Content', 'Frame', $p);
		$wizard = $frame->add('Wizard', null, 'content')
			->addPage('Step 1: overview','Page1')
			->addPage('Step 2: Form sample','Page2')
			->addPage('Step 3: last page','Page3')
			;
    }
}
class Page1 extends Page{
	function defaultTemplate(){
		return array('page1','_top');
	}
}
class Page2 extends Page{
	function init(){
		parent::init();
		$this->owner->form=$this->add('Form',null,'Form',array('compact_form','form'));
		$this->owner->form
			->addField('line','line1','Enter value here. It should be not null<br>')
				->setNotNull('Line field cannot be empty')
			->addField('text','text1','<br>Enter a text here<br>')
		;
		if($this->owner->form->isSubmitted()){
			//redirecting to the next step. depending on the form input you could skip some steps
			echo $this->add('Ajax')
				->redirect(null, array('step'=>1+$_GET['step']))
				->getString();
			exit;
		}
	}
	function defaultTemplate(){
		return array('page2','_top');
	}
}
class Page3 extends Page{
	function defaultTemplate(){
		return array('page3','_top');
	}
}

$test = new TestApp("Test", 'kt2');
$test->main();
Return current item: AModules3