# \CGExtensions\reportstemplate_report_generator

This class generates a report by first generating a series of structured data then passing the entire report output through to a single smarty template.

footers and headers can still be used to gather totals, etc.

## Summary

Methods
Properties
Constants
set_template()
get_output()
__construct()
generate()
No public properties found
No constants found
get_template()
before_line()
after_line()
before_group_footers()
after_group_footers()
before_group_headers()
after_group_headers()
draw_cell()
get_cell_contents()
get_group_cell_contents()
before_row()
after_row()
changed()
before_group_header()
after_group_header()
before_group_footer()
after_group_footer()
report()
start()
finish()
each_row()
No protected properties found
N/A
No private methods found
No private properties found
N/A

File
  lib/reports/class.template_report_generator.php
Class hierarchy
  \CGExtensions\reports\report_generator
  \CGExtensions\reports\tabular_report_generator
  \CGExtensions\reports\data_report_generator
  \CGExtensions\reports\template_report_generator

## Tags

todo |

## Methods

### set_template()

    set_template(string $tpl)

Set the template to use for formatting the report.

If a string ending with .tpl is provided then a file template for the current module is assumed. Otherwise, a database template for the current module is assumed. If no current module (i.e: the request is not for a module action) can be determined, then The smarty 'file' resource is assumed.

#### Parameters

string | $tpl |

#

## Tags

todo |

### get_output()

    get_output() : mixed

Get the generated output.

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

#### Returns

mixed

#

abstract

Inherited from
  \CGExtensions\reports\report_generator

## Tags

todo |

### __construct()

    __construct(\CGExtensions\reports\report_defn $rpt)

Constructor.

#### Parameters

\CGExtensions\reports\report_defn | $rpt |

#

Inherited from
  \CGExtensions\reports\report_generator

## Tags

todo |

### generate()

    generate() : void

Generate the report output.

#

Inherited from
  \CGExtensions\reports\report_generator

## Tags

todo |

### get_template()

    get_template() : string

Get the template to use for formatting the report.

#### Returns

string

#

## Tags

todo |

### before_line()

    before_line() : void

A callback function that is called before each and every line.

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### after_line()

    after_line() : void

A callback function that is called after each and every line.

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### before_group_footers()

    before_group_footers() : void

A callback function that is called before the start of outputing group footers.

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### after_group_footers()

    after_group_footers() : void

A callback function that is called after the outputing group footers.

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### before_group_headers()

    before_group_headers() : void

A callback function that is called before the outputing group headers.

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### after_group_headers()

    after_group_headers() : void

A callback function that is called after the outputing group headers.

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### draw_cell()

    draw_cell(\CGExtensions\reports\tabular_report_cellfmt $cell, string $contents)

A callback function to draw a cell.

#### Parameters

\CGExtensions\reports\tabular_report_cellfmt | $cell |
string | $contents | the cell contents.

#

abstract

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### get_cell_contents()

    get_cell_contents(string $col_key, string $tpl,  $row) : string

A function to get cell contents for the specified column of the current row.

#### Parameters

string | $col_key | The column key (must be a registered column)
string | $tpl | The cell template.
| $row |

#### Returns

string —

The formatted cell contents.

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### get_group_cell_contents()

    get_group_cell_contents(string $col_key, string $grp_key, string $tpl,  $row) : string

A function to get cell contents for a group header or footer cell.

#### Parameters

string | $col_key | The column key (must be a registered column)
string | $grp_key | The group key.
string | $tpl | The cell template.
| $row |

#### Returns

string —

The formatted cell contents.

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### before_row()

    before_row() : void

A callback function called before each row.

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### after_row()

    after_row() : void

A callback function called after each row.

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### changed()

    changed(\CGExtensions\reports\tabular_report_defn_group $grp, array $row) : bool

Test if the value for a specified group has changed.

#### Parameters

\CGExtensions\reports\tabular_report_defn_group | $grp | The group that references the watched column.
array | $row | The data row.

#### Returns

bool

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### before_group_header()

    before_group_header(\CGExtensions\reports\tabular_report_defn_group $grp) : void

A callback function that is called before a single group header is output.

#### Parameters

\CGExtensions\reports\tabular_report_defn_group | $grp |

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### after_group_header()

    after_group_header(\CGExtensions\reports\tabular_report_defn_group $grp) : void

A callback function that is called after a single group header is output.

#### Parameters

\CGExtensions\reports\tabular_report_defn_group | $grp |

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### before_group_footer()

    before_group_footer(\CGExtensions\reports\tabular_report_defn_group $grp) : void

A callback function that is called before a single group footer is generated.

#### Parameters

\CGExtensions\reports\tabular_report_defn_group | $grp |

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### after_group_footer()

    after_group_footer(\CGExtensions\reports\tabular_report_defn_group $grp) : void

A callback function that is called after a single group footer is generated.

#### Parameters

\CGExtensions\reports\tabular_report_defn_group | $grp |

#

Inherited from
  \CGExtensions\reports\tabular_report_generator

## Tags

todo |

### report()

    report() : \CGExtensions\reports\report_defn

Get the report definition.

#### Returns

\CGExtensions\reports\report_defn

#

Inherited from
  \CGExtensions\reports\report_generator

## Tags

todo |

### start()

    start() : void

A callback function when the report is started.

#

Inherited from
  \CGExtensions\reports\report_generator

## Tags

todo |

### finish()

    finish() : void

A callback function for when the report is finished.

#

Inherited from
  \CGExtensions\reports\report_generator

## Tags

todo |

### each_row()

    each_row(array $row)

A callback functon for each data row.

#### Parameters

array | $row | The row returned from the query.

#

abstract

Inherited from
  \CGExtensions\reports\report_generator

## Tags

todo |

### class.template_report_generator.php