<?php //////////////////////////////////////////////////////////////////////////////// // simple.php // 2005.10.10 作成 ////////////////////////////////////////////////////////////////////////////////
require_once './commonTips.php';
// 1ページ目 class FirstPage extends HTML_QuickForm_Page { function buildForm() { $this->_formBuilt = true; $this->addElement('static', 'lblPageNo', '', 'これは1ページです。'); $this->addElement('submit', $this->getButtonName('AShowFirst'), '1ページを表示'); $this->addElement('submit', $this->getButtonName('AShowSecond'), '2ページを表示'); $this->addElement('submit', $this->getButtonName('AShowLast'), '3ページを表示'); $this->setDefaultAction('next'); } }
// 2ページ目 class SecondPage extends HTML_QuickForm_Page { function buildForm() { $this->_formBuilt = true; $this->addElement('static', 'lblPageNo', '', 'これは2ページです。'); $this->addElement('submit', $this->getButtonName('AShowFirst'), '1ページを表示'); $this->addElement('submit', $this->getButtonName('AShowSecond'), '2ページを表示'); $this->addElement('submit', $this->getButtonName('AShowLast'), '3ページを表示'); $this->setDefaultAction('next'); } }
// 3ページ目 class LastPage extends HTML_QuickForm_Page { function buildForm() { $this->_formBuilt = true; $this->addElement('static', 'lblPageNo', '', 'これは3ページです。'); $this->addElement('submit', $this->getButtonName('AShowFirst'), '1ページを表示'); $this->addElement('submit', $this->getButtonName('AShowSecond'), '2ページを表示'); $this->addElement('submit', $this->getButtonName('AShowLast'), '3ページを表示'); $this->setDefaultAction('next'); } }
// 1ページを表示 class ActionShowFirst extends HTML_QuickForm_Action { function perform(&$page, $actionName) { $page->isFormBuilt() or $page->buildForm(); $next =& $page->controller->getPage('PFirst'); $next->handle('jump'); } }
// 2ページを表示 class ActionShowSecond extends HTML_QuickForm_Action { function perform(&$page, $actionName) { $page->isFormBuilt() or $page->buildForm(); $next =& $page->controller->getPage('PSecond'); $next->handle('jump'); } }
// 3ページを表示 class ActionShowLast extends HTML_QuickForm_Action { function perform(&$page, $actionName) { $page->isFormBuilt() or $page->buildForm(); $next =& $page->controller->getPage('PLast'); $next->handle('jump'); } }
class ActionDisplay extends HTML_QuickForm_Action_Display { function _renderForm(&$page) {
$smartyObj = new tipsSmarty();
$renderer =& new HTML_QuickForm_Renderer_ArraySmarty($smartyObj); $page->accept($renderer); $smartyObj->assign('page', $renderer->toArray()); $page_action = $page->controller->getActionName(); $smartyObj->tipsDisplay($page_action[0]); } }
session_start();
$controller =& new HTML_QuickForm_Controller('form', false);
// 必要なページをすべて追加 $controller->addPage(new FirstPage('PFirst')); $controller->addPage(new SecondPage('PSecond')); $controller->addPage(new LastPage('PLast'));
// ハンドラ設定 $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('AShowFirst', new ActionShowFirst()); $controller->addAction('AShowSecond', new ActionShowSecond()); $controller->addAction('AShowLast', new ActionShowLast()); $controller->addAction('display', new ActionDisplay());
// 実行 $controller->run();
?>
|
|