Пример #1
0
</html>
<?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();