CustomReport extends Report
Custom Report
Table of Contents
Properties
| $statement |
Methods
| __construct() | Load language |
| errors() | Returns any errors |
| fetchAll() | Execute the report |
| getFormats() | Retrieves a list of formats supported by this report |
| getKeyInfo() | Retrieves a list of data keys included in the report and information about them |
| getName() | Retrieves the name of this report |
| getOptions() | Retrieves the view containing any additional fields to filter on for the report |
| filterQuery() | Protect users from themselves by (weakly) preventing destructive queries |
| getAllReports() | Fetches all custom reports |
| getReport() | Fetches a custom report |
Methods
__construct()
Load language
public
__construct() : mixed
errors()
Returns any errors
public
errors() : mixed
Return values
mixed —An array of errors, false if no errors set
fetchAll()
Execute the report
public
fetchAll(mixed $company_id, array<string|int, mixed> $vars) : Iterator
Parameters
- $company_id : mixed
-
The ID of the company to generate the report from
- $vars : array<string|int, mixed>
-
A list of fields as given as options to the view
Return values
Iterator —An iterable object containing the report data
getFormats()
Retrieves a list of formats supported by this report
public
getFormats() : string
Return values
string —The list of formats supported by this report
getKeyInfo()
Retrieves a list of data keys included in the report and information about them
public
getKeyInfo() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of key/value pairs indicating the field, its name, and any formatting to apply
getName()
Retrieves the name of this report
public
getName() : string
Return values
string —The name of the report
getOptions()
Retrieves the view containing any additional fields to filter on for the report
public
getOptions(mixed $company_id[, array<string|int, mixed> $vars = [] ]) : string
Parameters
- $company_id : mixed
-
The ID of the company to generate the report from
- $vars : array<string|int, mixed> = []
Return values
string —The view
filterQuery()
Protect users from themselves by (weakly) preventing destructive queries
protected
filterQuery(string $sql) : string
Parameters
- $sql : string
-
The user provided query
Return values
string —The filtered query
getAllReports()
Fetches all custom reports
protected
getAllReports() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of stdClass, each representing a report
getReport()
Fetches a custom report
protected
getReport(int $report_id) : stdClass
Parameters
- $report_id : int
Return values
stdClass —The report