Brimbox Logo Brimbox Version 2.3.4 Released

Report Array Parameters>>

The $main->output_report() method displays reports and takes three parameters.

$main->output_report($result, $current, $settings)

Report Parameters

The first parameter is the report query resultset $result. The first column of the resultset contains the $settings report_settings_key value (see below), usually 0 (zero) for non-aggregated reports (this integer can be omitted in a simple report resultset using the ignore report setting, see Report Settings section below).

The second is the array of report parameters from the form postback usually called $current. It contains data corresponding to the following keys:

button — the Brimbox button variable for passing
module_submit — the module where the report is submitted,
module_display — the module where the report is displayed
page — the current page of the report for pagination
order — for sorting, either ASC or DESC
sort — the column being sorted on from the data_table
module_submit and module_display can be the same

Note: the standard reports functionality use javascript submit functions which process some of the report variables stored in $current.

The third is the multidimensional array $settings which largely defines how the report is displayed. The settings array has this form:

$settings [report_type_key][report_settings_key] = array()

The report_type_key by default is:

0 — Empty
1 — Paged report
2 — Full report
3 — Textarea Report

There are some considerations about the $settings array:

First, even though the data_table data columns go from 1 to 50, the $settings array considers the columns of the resultset to go from 0 to 99. This makes sense since the first column contains the report_settings_key. If the resultset is created by:

SELECT 0, c01, create_date FROM data_table WHERE row_type = 1;

the c01 will correspond to the 1 column in settings, and likewise c02 will correspond to the create_date column in settings.

Second, there are two types of settings, settings for the whole report, and settings that apply to individual columns. The settings for individual columns go from 0 to 99. For instance the d setting to convert database timezone to user timezone goes from d00 to d99. So to convert create_date to the current day d02 would be set with a PHP date format string (like Y-m-d).

Finally Brimbox reports do not do aggregation on the resultset in PHP. In general, if users need aggregation exporting to a spreadsheet usually makes sense. However, you can do aggregation in a UNION query with Brimbox if necessary (see Group By Reports).

A paginated settings array with aggregation would look like this:

$settings[1][0] = array() — Data or lowest level to output for paginated report
$settings[1][1] = array() — Second level or first aggregation for paginated report
$settings[1][2] = array() — Third level or second aggregation for paginated report
……
$settings[1][n] = array() — Highest level or final aggregation for paginated report

Report Settings

Report Type 1 (Paginated) — Standard Parameters — $settings[1][0]

ignore => Whether or not to ignore the first column in result, if false first column should contain 0, the key for the $settings array, (boolean) default false
count => will count the number of data rows, or level 0 rows. This designed to get a data row count for aggregation queries and causes the reports class to read the data resultset twice. If ignore is true count is total rows returned and the this parameter is ignored. (boolean) default false
title => “Report Title” (string) default “”
title_class => title class, (string) default “bold larger spaced”
header => display header toggle parameter, (boolean) default true
ucfirst => capitalize first letter in column headers, (boolean) default false

page_selector_class => pagination selector class, (string) default “spaced colored bold”
page_link_class => pagination link class, (string) default “link bold colored”
return_rows_class => non pagination return information, (string) default “spaced colored bold”
limit => integer defining number of rows per page (integer) default 10

shade_rows => whether to use “shaded” class on alternating rows, (boolean) default false
start_column => 0 to n column to start outputting, 0 is the first column, (integer) default 0

table_class => table class, (string) default “spaced border”
row_header_class => header row class, (string) default “shaded bold”
row_class => row header class, (string) default “”
cell_header_class => cell header class (cells in a header row unless individual header cells set (h00-h99)), (string) default “extra”
cell_class => cell class (cells except header cells unless individual cells set (c00-c99)), (string) default “extra”

h00 to h99 => header cell class (string of class settings defining individual header cell), (string) default NULL
c00 to c99 => table cell class, (string of class settings defining individual cell), (string) default NULL
d00 to d99 => date convert, (string of PHP date format) will convert from database time to user time, (string) default NULL
s00 to s99 => column (c01 to c50) to sort on (‘s00’=>’c01′,’s01’=>’c02’), (string) default NULL

Report Type 2 (Full) — Standard Parameters — $settings[2][0]

ignore => Whether or not to ignore the first column in result, if false first column should contain 0, the key for the $settings array, (boolean) default false.
title => “Report Title” (string) default “”
title_class => title class, (string) default “bold larger spaced”
header => display header toggle parameter, (boolean) default true
return_rows_class => non pagination return information, (string) default “spaced colored bold”

shade_rows => Whether to use shaded class on alternating rows, (boolean) default false
start_column => 0 to n column to start outputting, 0 is the first column, (integer) default 0

table_class => table class, default “spaced border”
row_header_class => header row class, (string) default “shaded bold”
row_class => row header class, (string) default “”
cell_header_class => cell header class (cells in a header row unless individual header cells set (h00-h99)), (string) default “extra”
cell_class => cell class (cells except header cells unless individual cells set (c00-c99)), (string) default “extra”

h00 to h99 => header cell class (string of class settings defining individual header cell), (string) default NULL
c00 to c99 => table cell class, (string of class settings defining individual cell), (string) default NULL
d00 to d99 => date convert, (string of PHP date format) will convert from database time to user time, (string) default NULL
s00 to s99 => column (c01 to c50) to sort on (‘s00’=>’c01′,’s01’=>’c02’), (string) default NULL

Report Type 3 (Text Area) — Standard Parameters — $settings[3][0]

title => “Report Title”, (string) default “”
title_class => title class, (string) default “bold larger spaced”
header => (string) display header toggle parameter, (boolean) default true
return_rows_class => non pagination return information, (string) default “spaced colored bold”

rows => number of rows in textarea, (integer) default 40
columns => number of columns in textarea, (integer) default 120
start_column => 0 to n column to start outputting, 0 is the first column, (integer) default 0

d00 to d99 => date convert, (string of PHP date format) will convert from database time to user time, (string) default NULL

Higher Level or Aggregation Rows (Paged/Full) — $settings[1][n] or $settings[2][n]

cell_class => standard aggregation cell class, default “bold shaded”

c00 to c99 => individual cell class, (string) default NULL
m00 to m99 => c01 to c99, move cell column mXX to cell column cXX (example ‘m03’=>’c01’), (string) default NULL
t00 to t99 => “Text”, put text in cell, executes after move (‘t04’=>’Total’), (string) default NULL
d00 to d99 => date convert, (string of PHP date format) will convert from database time to user time, (string) default NULL

Updated: 2016-07-03

Documents

Definitions