QFC wizard - 'preview' page
| From: | Joerg Bruckmann | Date: | Thu, 25 Dec 2003 23:57:28 +0000 |
| Subject: | QFC wizard - 'preview' page | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-9823@lists.php.net to get a copy of this message | ||
Hello list,
with QFC and HTML_Template_Sigma as static renderer, I want to create a
'preview' of the entered data for a final check before the submission. How
can this be done best?
My approach is a class ActionPreview as a subclass of HTML_Quickform_Action
which outputs the entered data. This action is added to the wizard with
$wizard->addAction('preview', new ActionPreview());. The page
(HTML_QuickForm_Page) on which the data can be previewed buffers the output
of $this->handle('preview'); and passes it to the template engine.
Am I missing something or would that be the way to go?
class PageThird extends HTML_QuickForm_Page
{
function buildForm()
{
$this->_formBuilt = true;
global $tpl;
$tpl->setCurrentBlock('PAGE3');
ob_start();
$this->handle('preview');
$preview = ob_get_contents();
ob_end_clean();
$tpl->setVariable('PREVIEW', $preview);
}
}
class ActionPreview extends HTML_QuickForm_Action
{
function perform(&$page, $actionName)
{
$page->_formBuilt = true;
global $tpl;
$tpl->setCurrentBlock('PAGE4');
$tpl->setVariable('TITLE', 'Preview');
echo "Your data:<br>\n<pre>\n";
// currently just var_dump for testing
var_dump($page->controller->exportValues());
echo "\n</pre>\n";
}
}
Thanks for any tip. Great package btw.
Regards,
Joerg