|
|
| $required = True |
| |
| | $description |
| |
|
| $page_set = 'Reports' |
| |
| | $report_set = '' |
| |
|
| $discoverable = true |
| |
| const | META_BOLD = 1 |
| |
|
const | META_BLANK = 2 |
| |
|
const | META_REPEAT_HEADERS = 4 |
| |
|
const | META_CHART_DATA = 8 |
| |
|
const | META_COLOR = 16 |
| |
| FannieReportPage::assign_headers |
( |
) | |
|
Assign new values to $report_headers, which is intially assigned in the report, usually for 2nd+ reports in multi_report_mode.
| FannieReportPage::both_content |
( |
) | |
|
Displays both form_content and report_content
- Returns
- html string
| FannieReportPage::calculate_footers |
( |
|
$data) | |
|
Calculate a footer row
- Parameters
-
| $data | an two-dimensional array of data |
- Returns
- array of footer values
Principally, footers are separate from data so they can be marked in such in HTML rendering and stay at the bottom when data sorting changes.
This function may also be used to set values for headers or default sorting. On more elaborate reports, the number of columns may vary depending on what options are selected. This function is always called so those values will be set reliably even if caching is enabled.
| FannieReportPage::checkDataCache |
( |
) | |
|
|
protected |
Look for cached SQL data
Data is stored in the archive database, reportDataCache table.
The key column is an MD5 hash of the current URL (minus the excel parameter, if present). This means your forms should use type GET if caching is enabled.
The data is stored as a serialized, gzcompressed string.
| FannieReportPage::csvLine |
( |
|
$row) | |
|
Turn array into CSV line
- Parameters
-
- Returns
- CSV string
| FannieReportPage::defaultDescriptionContent |
( |
|
$datefields = array()) | |
|
|
protected |
Standard lines to include above report data
- Parameters
-
| $datefields | [array] names of one or two date fields in the GET/POST data. The fields "date", "date1", and "date2" are detected automatically. |
- Returns
- array of description lines
| FannieReportPage::dekey_array |
( |
|
$arr) | |
|
Convert keyed array to numerical indexes and maintain order
| FannieReportPage::drawPage |
( |
) | |
|
Check for input and display the page
Use FanniePage::drawPage for the plain old html version of the page
Global setting overrides default behavior to force the menu to appear. Unlike normal pages, the override is only applied when the output format is HTML.
| FannieReportPage::excelFormat |
( |
|
$item, |
|
|
|
$style = '' |
|
) |
| |
Remove formatting from cell contents for Excel formats
| FannieReportPage::fetch_report_data |
( |
) | |
|
Get the report data
- Returns
- a two dimensional array
Actual SQL queries go here!
If using multi_report_mode, this should return an array of two dimensional arrays where each two dimensional arrays contains a report's data.
| FannieReportPage::form_content |
( |
) | |
|
Define the data input form
- Returns
- An HTML string
| FannieReportPage::format |
( |
|
$data) | |
|
|
protected |
Apply formatting to data. This method can be used to add markup to records - e.g., links to other content.
- Parameters
-
| $data | two-dimensional array of report data |
- Returns
- two-dimensional array of report data
| FannieReportPage::formatCheck |
( |
) | |
|
|
protected |
Helper: check default export args
Verify whether PEAR is available. If it is not, fall back to CSV output. Should probably generate some kind of log message or notification.
| FannieReportPage::freshenCache |
( |
|
$data) | |
|
|
protected |
Store SQL data in the cache
- Parameters
-
- Returns
- True or False based on success
See checkDataCache for details
| FannieReportPage::htmlLine |
( |
|
$row, |
|
|
|
$header = False |
|
) |
| |
Turn array into HTML table row
- Parameters
-
| $row | an array of data |
| $header | True means |
tags, False means
tags
- Returns
- HTML string
Javascript sorting utility requires header rows to be
tags
| FannieReportPage::preprocess |
( |
) | |
|
Handle pre-display tasks such as input processing
- Returns
- True if the page should be displayed
- False to stop here
The default version will check required_fields to determine whether the form_content or report_content method should be called. It also the value of "excel" for the request and sets necessary output options.
| FannieReportPage::render_data |
( |
|
$data, |
|
|
|
$headers = array(), |
|
|
|
$footers = array(), |
|
|
|
$format = 'html' |
|
) |
| |
Format data for display
- Parameters
-
| $data | a two dimensional array of data |
| $headers | a header row (optional) |
| $format | output format (html | xls | csv) |
- Returns
- formatted string
Detect PEAR and only offer XLS if the system is capable.
| FannieReportPage::report_content |
( |
) | |
|
Define the report display
- Returns
- An HTML string
Generally this function is not overriden.
This will first check the cache to see if data for this report has been saved. If not, it will look up the data by calling the fetch_report_data function. That function should be overriden.
Once the data is retrieved, this will call the calculate_footers function on the data. Footers are not required, but it's useful for some final calculations.
Finally, the render_data function is called. Overriding that is not recommended.
Use CoreWarehouse data source if requested & available Fail back to FannieReportPage::fetch_report_data() if a data source cannot be found or data source fails to handle the request
For XLS multi-report ouput, re-assemble the reports into a single long array of rows (dataset).
| FannieReportPage::report_description_content |
( |
) | |
|
Extra, non-tabular information prepended to reports
- Returns
- array of strings
| FannieReportPage::report_end_content |
( |
) | |
|
Extra, non-tabular information appended to reports
- Returns
- array of strings
| FannieReportPage::select_headers |
( |
|
$incrIndex = False) | |
|
Return a single-dimension array of headers (column-heads).
- Parameters
-
| @return | array of header values |
Allow for but not require different headers on each report. Input may be one- or two-dimensional. If the latter, index is header_index. If headers[x] doesn't exist use the last one that does exist or empty if none exists.
| FannieReportPage::xlsMeta |
( |
|
$data) | |
|
Apply meta rules to XLS data
| FannieReportPage::$chart_data_columns = array() |
|
protected |
Column(s) containing chart data values. An empty array signifies means every column except the label contains data.
| FannieReportPage::$chart_label_column = 0 |
|
protected |
Column containing chart labels.
| FannieReportPage::$content_function = "form_content" |
|
protected |
Function for drawing page content. form_content and report_content are provided by default.
| FannieReportPage::$description |
Initial value:= "
Base class for creating reports.
"
Description of the report
| FannieReportPage::$multi_report_mode = False |
|
protected |
Allow for reports that contain multiple separate tables of data. If all the reports are the same width, using META_BLANK and/or META_REPEAT_HEADERS may be preferrable.
| FannieReportPage::$no_jquery = false |
|
protected |
Disable inclusion of jquery. In rare cases the report content may be embedded in a page that already included jquery and multiple copies included can cause problems.
| FannieReportPage::$no_sort_but_style = false |
|
protected |
Apply CSS to table but not sorting JS. May become default behavior if it does not mess up current unsorted reports
| FannieReportPage::$report_cache = 'none' |
|
protected |
Enable caching of SQL data. Valid values are: none, day, month
| FannieReportPage::$report_format = 'html' |
|
protected |
Define report format. Valid values are: html, xls, csv
| FannieReportPage::$report_headers = array() |
|
protected |
Define report headers. Headers are necessary if sorting is desired
| FannieReportPage::$report_set = '' |
Assign report to a "set" of reports
| FannieReportPage::$required_fields = array() |
|
protected |
If fields are present in the request, the form has been submitted and report can be displayed
| FannieReportPage::$sort_column = 0 |
|
protected |
Which column to sort by default
| FannieReportPage::$sort_direction = 0 |
|
protected |
Sort direction. 0 is ascending, 1 is descending
| FannieReportPage::$sortable = true |
|
protected |
Option to enable/disable javascript sorting
| const FannieReportPage::META_BOLD = 1 |
Assign meta constant(s) to a row's "meta" field for special behavior.
Bold is self-explanatory. Blank will insert a blank line and repeat headers will repeat the report_headers. The latter two will terminate the current <tbody> and start a new one. This breaks the report into separately sortable chunks.
The documentation for this class was generated from the following file:
- fannie/classlib2.0/FannieReportPage.php