|
The Report class is used to build a paged data set with total control of the
page links, and with a search tool that loads the filters from the XML specification file.
Below you can find some useful tips when using this module.
1) The empty block feature is used to fill cells that are left blank
when you have a "cell" report with more than one record per line.
For example: if you have a report with 2 records per line and the
total record count is 15, in the last line we'll have an empty block,
right? Well... if you design a cell that includes the field labels:
<!-- START BLOCK : loop_cell -->
<td>Name: {NAME}<br>Address: {ADDRESS}</td>
<!-- END BLOCK : loop_cell -->
You must agree that would be ugly to show the labels and not to fill
the placeholders, right? Well, the setEmptyBlock method is used to fix
that problem. You define a block ****inside loop_line's scope***, just
as loop_cell, that is used when the cell will be generated without any
data:
<!-- START BLOCK : empty_cell -->
<td> </td>
<!-- END BLOCK : empty_cell -->
$Report->setEmptyBlock('empty_cell');
2) If you are intending to use a block to tell the user that the report
has no data (empty data set) or the search returned no records (using
the bundled search tool), you must use the setEmptyTemplate method, that
receives a file name and a set of variables to assign as parameter.
// the first parameter is the path to the template file,
// and the second is a hash map of variables that must be assigned
$Report->setEmptyTemplate('templates/empty_report.tpl',
array('message'=>'The list is empty or your search query returned no results.'));
3) If the page that loads the report contains one or more GET parameters that
must be sent along with the links built by the Report class, the class offers 2 solutions:
1) using the $Report->setBaseUri($uri) method. This method defines the base address
that will be used to build all the links in the report: pagination, ordering, filtering.
2) using the $Report->setExtraVars($extraVars) method. This method receives a set of
extra parameters, in the form: var=value&var2=value (without initial "?" or "&" chars). This set
of parameters will be concatenated to every link build by the class.
|