RE: FW: [PEAR] FormBuilder with SDG export
| From: | Prue | Date: | Tue, 22 Nov 2005 21:18:30 +0000 |
| Subject: | RE: FW: [PEAR] FormBuilder with SDG export | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-22062@lists.php.net to get a copy of this message | ||
Oh dear, apologies all round (again). I'd stared at the problem for too
long.
The bug as expected was in my code. There was no $options in the
$dg->bind($do) statement for the alternate renderers.
-----Original Message-----
From: Prue [mailto:prue@clipmagic.com.au]
Sent: Wednesday, 23 November 2005 8:02 AM
To: 'pear-general@lists.php.net'
Subject: RE: FW: [PEAR] FormBuilder with SDG export
> 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.