RE: FW: [PEAR] FormBuilder with SDG export
| From: | Prue | Date: | Tue, 22 Nov 2005 21:02:16 +0000 |
| Subject: | RE: FW: [PEAR] FormBuilder with SDG export | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22061@lists.php.net to get a copy of this message | ||
> What I want to achieve is that regardless of the renderer, the link
> field from the originating DO outputs the nominated data from the
> linked DO for each record.
> If you get different results with different renderers, then there is
> either a problem in the way you use the renderers (how do you choose
> which one is used?) or there is really a bug in the renderers.
When you navigate to the page, the HTML render is used. There are two
'mini' forms on the page, each with only a submit button - one named xls and
the other pdf. In the script:
// Create a new SDG object
if (isset($_POST['xls'])){
$dg =& new Structures_DataGrid(null, null, DATAGRID_RENDER_XLS);
} else {
$dg =& new Structures_DataGrid($page);
}
[... other stuff ..]
if (isset($_POST['xls'])){
$dg->bind($do);
$renderer =& $dg->getRenderer();
$dg->renderer->setFilename('datagrid.xls');
$dg->render();
return;
} else
if (isset($_POST['pdf'])){
require_once ('include/classes/pdf/class.ezpdf.php');
$dg->setRenderer("Array");
$dg->bind($do);
$data = $dg->renderer->toArray();
$pdf =& new Cezpdf();
$pdf->selectFont('include/classes/pdf/fonts/Helvetica.afm');
$pdf->ezTable($data[Data]);
$pdf->ezStream();
return;
} else {
$dg->bind($do, $options);
$renderer =& $dg->getRenderer();
$dg->renderer->toHtml();
return;
}
That all seems to work fine.