RE: [PEAR] Structures_DataGrid question - do I need to use DB_DataObject?
| From: | Prue | Date: | Sun, 20 Nov 2005 08:13:37 +0000 |
| Subject: | RE: [PEAR] Structures_DataGrid question - do I need to use DB_DataObject? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-22017@lists.php.net to get a copy of this message | ||
Thanks Arnaud
While I decided keep the SDD to Smarty arrangement as I had before, I found
your SDG to Array very useful! Using it and EZPDF I am now able to output my
SDG to PDF. So from the one datagrid I can output to HTML, xls or pdf
depending on which (if any) submit button the end-user pushes.
To output a simple datagrid to pdf, I used:
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();
EZPDF will allow for much for sophisticated formatting but this is fine for
starters. :)
I know that PEAR has a File/PDF application but there's no end-user
documentation and the API looks confusing. EZPDF is a breeze, well
documented and available from Sourceforge at:
http://sourceforge.net/projects/pdf-php
Cheers
Prue
-----Original Message-----
From: arnaud sellenet bodin [mailto:demental@free.fr]
Sent: Saturday, 19 November 2005 12:41 AM
To:
pear-general@lists.php.netpear-general@lists.php.netpear-general@lists.php.n
et
Subject: Re: [PEAR] Structures_DataGrid question - do I need to use
DB_DataObject?
Interesting indeed, I didn't know that you could assign object to
smarty and call their method right from the template. What I did could
be merged with yours as I did not make much for the pager. Here's the Array
renderer I wrote and how I use it. The main limitation is you can't use
columns that have an empty or null
'name' property
Sorry if some comments mismatch the context, most of them come from
Structures_DataGrid_Renderer_HTML_Table