function indexAction() { $controller = new HTML_QuickForm2_Controller('plugin_maker'); $controller->addPage(new Am_Form_Controller_Page_PluginMaker_Mysql(new Am_Form('mysql'))); $controller->addPage(new Am_Form_Controller_Page_PluginMaker_Plugin(new Am_Form('plugin'))); $controller->addPage(new Am_Form_Controller_Page_PluginMaker_Tables(new Am_Form('tables'))); $controller->addPage(new Am_Form_Controller_Page_PluginMaker_Columns(new Am_Form('columns'))); $controller->addPage(new Am_Form_Controller_Page_PluginMaker_Display(new Am_Form('display'))); $controller->addHandler('next', new HTML_QuickForm2_Controller_Action_Next()); $controller->addHandler('back', new HTML_QuickForm2_Controller_Action_Back()); $controller->addHandler('jump', new HTML_QuickForm2_Controller_Action_Jump()); ob_start(); $controller->run(); $this->view->content = ob_get_clean(); $this->view->title = "Integration Plugin Maker"; $this->view->display('admin/layout.phtml'); }
<?php } } class TabbedProcess implements HTML_QuickForm2_Controller_Action { public function perform(HTML_QuickForm2_Controller_Page $page, $name) { echo "Submit successful!<br>\n<pre>\n"; var_dump($page->getController()->getValue()); echo "\n</pre>\n"; } } $tabbed = new HTML_QuickForm2_Controller('Tabbed', false); $tabbed->addPage(new PageFoo(new HTML_QuickForm2('foo'))); $tabbed->addPage(new PageBar(new HTML_QuickForm2('bar'))); $tabbed->addPage(new PageBaz(new HTML_QuickForm2('baz'))); // These actions manage going directly to the pages with the same name $tabbed->addHandler('foo', new HTML_QuickForm2_Controller_Action_Direct()); $tabbed->addHandler('bar', new HTML_QuickForm2_Controller_Action_Direct()); $tabbed->addHandler('baz', new HTML_QuickForm2_Controller_Action_Direct()); // We actually add these handlers here for the sake of example // They can be automatically loaded and added by the controller $tabbed->addHandler('submit', new HTML_QuickForm2_Controller_Action_Submit()); $tabbed->addHandler('jump', new HTML_QuickForm2_Controller_Action_Jump()); // This is the action we should always define ourselves $tabbed->addHandler('process', new TabbedProcess()); // We redefine 'display' handler to use the proper stylesheets $tabbed->addHandler('display', new TabbedDisplay()); $tabbed->addDatasource(new HTML_QuickForm2_DataSource_Array(array('iradYesNoMaybe' => 'M', 'favLetter' => array('A' => true, 'Z' => true), 'favDate' => array('d' => 1, 'M' => 1, 'Y' => 2001), 'textOpinion' => 'Yes, it rocks!'))); $tabbed->run();
} /* Use default styles included with the package */ <?php if ('@data_dir@' != '@' . 'data_dir@') { $filename = '@data_dir@/HTML_QuickForm2/quickform.css'; } else { $filename = dirname(dirname(dirname(__FILE__))) . '/data/quickform.css'; } readfile($filename); ?> </style> <title>HTML_QuickForm2 simple controller example</title> </head> <body> <?php echo $form; ?> </body> </html> <?php } } $page = new SimplePage(new HTML_QuickForm2('page1')); $page->addHandler('process', new SimpleProcess()); $page->addHandler('display', new SimpleDisplay()); $controller = new HTML_QuickForm2_Controller('Simple'); $controller->addPage($page); $controller->run();
echo $form->render($renderer); ?> </body> </html> <?php } } class WizardProcess implements HTML_QuickForm2_Controller_Action { public function perform(HTML_QuickForm2_Controller_Page $page, $name) { echo "Submit successful!<br>\n<pre>\n"; var_dump($page->getController()->getValue()); echo "\n</pre>\n"; } } $wizard = new HTML_QuickForm2_Controller('Wizard'); $wizard->addPage(new PageFirst(new HTML_QuickForm2('page1'))); $wizard->addPage(new PageSecond(new HTML_QuickForm2('page2'))); $wizard->addPage(new PageThird(new HTML_QuickForm2('page3'))); // We actually add these handlers here for the sake of example // They can be automatically loaded and added by the controller $wizard->addHandler('next', new HTML_QuickForm2_Controller_Action_Next()); $wizard->addHandler('back', new HTML_QuickForm2_Controller_Action_Back()); $wizard->addHandler('jump', new HTML_QuickForm2_Controller_Action_Jump()); // This is the action we should always define ourselves $wizard->addHandler('process', new WizardProcess()); // We redefine 'display' handler to use the proper stylesheets $wizard->addHandler('display', new WizardDisplay()); $wizard->run();