Generic Reporting
Contents
Overview
Generic reporting implemented to allow
- the customers to create new document/task list views
- us to easily customize document/task list views
Classes and Files
- Configuration file of all fields usable in generic reports
- app/config/Settings-Reports.php
- Smarty templates to display the output of a report
- app/tran/draw/list/DrawingListHeaderHeader.tpl - Drawing list view selection
- app/tran/genrep/GenericReportHeader.tpl - Report header row
- app/tran/genrep/GenericReportRecord.tpl - Report record rows
- app/tran/genrep/GenericReportPrintHeader.tpl - Report header row (print format)
- app/tran/genrep/GenericReportPrintRecord.tpl - Report record rows (print format)
- Administration
- app/form/ReportForm.php - PHP form class for generic reports
- app/js/report.js - backbone based javascript to add/remove/change report fields
- app/tran/report - directories of the transactions
- Usage
- app/lib/GenericReport.php - PHP class to instantiate generic report, read configuration, dereference object class
Database Model
ReportTypeRef - Report types, currently only one type: Document
- Reports - Configured reports
ReportFields - Report field configuration for reports in table Reports
Configuration
Configuration of report types and fields available for reports
All report types and report fields available in reports should be configured first in app/config/Settings-Reports.php in $_CFG['GenericReport'].
ReportTypeRef.define is the main index in $_CFG['GenericReport'] to access to the definition of a report type.
- The report type definition contains some generic settings and all field definitions
Note, that there are feature dependent settings at the end of the file, which can overwrite normal settings or add new fields
Generic Settings:
Index
Description
Example
setClass
PHP class the report based on
titleTag
message catalog tag for report header
documentList
displayClasses
array of HTML classes available for selection
align_left, align_center, align_right, nowrap, font_bold
fields
array of field definitions, the key is used as ReportFields.reportFieldConfigName
Field Definitions:
- Different type of fields can be defined:
Field Type
Description
direct
The field is an element of the class defined in "setClass" above
link
The field is a link to display the referenced element of the set "setClass".
The link is obtained by the getLink methodreference
The field is foreign key. Field(s) from referenced record can be displayed
file
The field contains a link to a file
derived
The field composed specially by a defined method
In the following table fieldKey is the key of the field configuration settings, what in most of the cases the appropriate database field name without table name.
Index
Field Type
Description
Notes, Examples
fieldType
ALL
Type of the field
Mandatory, see table above
fieldTag
ALL
Message catalog tag for the header
If neither fieldTag nor fieldName defined
the fieldKey is used as tagfieldName
ALL
Use instead of fieldTag in header
E.g. "#"
dispField
ALL
Displayed object field to be set
Default: fieldKey
sortField
ALL
Sort key in sort URL
Default: fieldKey with tablename, e.g.: Drawings.drawingCode,
in the case of reference type str_replace( '_', '.', dispField )class
ALL
Space separated list of HTML classes from displayClasses above
Default: align_center
classPriv
ALL
Set private class on private object
Default: false
extLink
link
Use external link (pointing from the internal to the external system) if exists
Default: false
extraPar
link
Field value as additional parameter calling the getLink method
getLink is called with $state, $depth, 'sho', $record.getValue( $fieldKey)
refTable
reference
Name of referenced table
Default e.g.: fieldKey = "projectPhaseId", refTable = "ProjectPhaseRef"
refField
reference
Referenced key value
Default from key and setClass, e.g.: "Drawings.projectPhaseId"
selField
reference
Field used from Referenced table
Default: "code"
hovField
reference
Field(s) used from Referenced table as hover
Default: "name", e.g: array( 'firstName', ' ', 'lastName' )
keyField
reference
Key field name in refTable
Default: fieldKey
refAlias
reference
Table alias to the Referenced table the to allow more joined records
E.g.: "Design" alias ti table Users
classFunc
derived
Class method to get value
Mandatory
getLink
file, link
Class method to get link
Mandatory for file type. E.g.: "getPublishFilenameLink"
Optional for link type, default: "getLink"thumbnail
file
Thumbnail file name field