\CGExtensions\reportsformatted_report_generator

A class to generate a report using a special template for each row or item.

Summary

Methods
Properties
Constants
__construct()
generate()
get_output()
set_template()
No public properties found
No constants found
report()
start()
finish()
each_row()
get_template()
process_template()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

generate()

generate() : void

Generate the output of this report.

get_output()

get_output() : mixed

Get the output of the report, after generation.

This method may return textual data suitable for echoing/displaying. Or it it may generate a static file and return nothing.

Returns

mixed —

The output of this class depends upon the content of the report, and item templates passed to this object.

set_template()

set_template(string  $tpl) 

Set the template to be used for formatting the document.

The document template is a smarty template that should at the minimum consist of a {foreach $items as $item}...{/foreach} loop. Each item in the loop will be an HTML string representing each formatted item.

Parameters

string $tpl

The template contents.

start()

start() : void

A callback function when the report is started.

finish()

finish() : void

A callback function for when the report is finished.

each_row()

each_row(mixed  $item) : void

A callback method for processing each row.

By default, this method gives the item/row to smarty and calls the item template specified in the report definition.

Parameters

mixed $item

The item to be processed.

get_template()

get_template() : string

Get the document template.

Returns

string

process_template()

process_template(string  $tpl) 

Process the specififed template through smarty.

This method will attempt to find the current action module, and given that and the name of the template find the template contents. if the template name ends with .tpl a module file template is assumed. Otherwise, a module database template will be assumed. If a module cannot be determined, then a file template is assumed, using the 'file' smarty resource.

Parameters

string $tpl

The name of the template to process.