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
| <?php
require_once 'HTML/QuickForm/Controller.php';
require_once 'HTML/QuickForm/Action/Next.php';
require_once 'HTML/QuickForm/Action/Back.php';
require_once 'HTML/QuickForm/Action/Jump.php';
require_once 'HTML/QuickForm/Action/Display.php';
class monForm extends HTML_QuickForm_Page { //page 1
function buildForm(){
$this->_formBuilt = true;
$this->addElement('text', 'test', 'Test');
$buttons[] = &HTML_QuickForm::createElement('reset', null, 'Effacer');
$buttons[] = &HTML_QuickForm::createElement('submit', 'next', 'Continuer >>');
$this->addGroup($buttons, 'validButtons', '', ' ', false);
$this->setDefaultAction('next');
}
}
class maPreview extends HTML_QuickForm_Page { //page preview
function buildForm(){
$this->_formBuilt = true;//constructeur
$prev =& $this->controller->getPage($this->controller->getPrevName($this->getAttribute('id')));//recupération de la page précédente
$mesDatas = $this->controller->exportValues ($prev->getAttribute('id'));//et des datas
$this->addElement('static', 'recuptest', 'Test récupéré',$mesDatas['test']);//affichage de la saisie effectué en page 1 dans champs test
$buttons[] =& $this->createElement('submit', $this->getButtonName('back'), '<< Modifier');
$buttons[] = &HTML_QuickForm::createElement('submit', 'next', 'Valider >>');
$this->addGroup($buttons, 'validButtons', '', ' ', false);
$this->setDefaultAction('next');
}
}
$page1 = new monForm ('page1');
$page1Preview = new maPreview ('page1Preview');
//construction du controller
$controller = new HTML_QuickForm_Controller('cmd');
//ajout des pages
$controller->addPage($page1);
$controller->addPage($page1Preview);
//affectation des actions
$controller->addAction('display', new HTML_QuickForm_Action_Display());
$controller->addAction('next', new HTML_QuickForm_Action_Next());
$controller->addAction('back', new HTML_QuickForm_Action_Back());
$controller->addAction('jump', new HTML_QuickForm_Action_Jump());
$controller->addAction('process', new ActionProcess());
//lancement du controller
$controller->run();
?> |
Partager