![]() |
CMS
Version 3.9
|
ReportManager provides a generic mechanism for implementing user configurable reports based on DataItem classes. More...
Public Member Functions | |
ReportManager () | |
Creates a new ReportManager instance. More... | |
__sleep () | |
Tidy up the request data and limit the fields returned when serializing a ReportManager. More... | |
table ($class, $title="", $useOutputFilter=false) | |
Add a table to the report. More... | |
drawForm () | |
Draw the configuration/search form. More... | |
getTable ($class) | |
Retrieve the ReportTable object for the specified DataItem class. More... | |
populateSelected () | |
setSelected ($table, $checkRequest=true) | |
Set the given table as selected. More... | |
generateConstraint () | |
Generate the search constraint for the current report configuration. More... | |
generateReport ($inlineScript=false) | |
isColumnSelected ($column) | |
writeResultsFormButtons ($excel) | |
preSaveReport () | |
Alternative implementation - presave version of report is stored in session with a. More... | |
save () | |
fromRequest () | |
Static Public Member Functions | |
static | deleteUser ($user) |
Respond to fired event DeleteUser. More... | |
static | load ($report_id, $mode="") |
Public Attributes | |
$report_id | |
ID of the saved report as persisted in the database. More... | |
$title | |
Title of the report. More... | |
$description | |
Longer description of the report. More... | |
$resultsPage = "custom_report_results" | |
The page used to display the search results. More... | |
$editorPage = "custom_report" | |
The page used to display the report editor. More... | |
$target | |
The target window for the form results. More... | |
$columnOrder | |
Override the default column order. More... | |
$tables | |
$join | |
$report | |
$request | |
$interstitialMessage = "" | |
Optional interstitial message to display while report is being generated. More... | |
$limit | |
Optional limit to number of records retrieved, depending on acceptable load times for results. More... | |
ReportManager provides a generic mechanism for implementing user configurable reports based on DataItem classes.
To use ReportManager:
1) create a component "report" in your application's components and create its manifest.inc file
2) create folder "pages" with a file for each type of report needed in the application with names such as "custom_xx_report" (e.g., custom_program_report)
3) The page or pages should contain this code:
Fakoli::using("report");
$report = new XXReportManager();
if ($method == "POST" || isset($_REQUEST["__excel"])) { $report->generateReport(); } else { $report->drawForm(); }
4) On the top level in the report component, add a php file xx_report_manager.inc with the code:
class XXReportManager extends ReportManager { function XXReportManager() { $this->ReportManager();
$this->table(MyDataItemClass, "MyTitle")
->column("My Field Label", "{my_field}", true, "") ... ; } }
the same way you would create a DataListView Before closing the column list with the semicolon, you can also add search fields with the search mode (equal if not provided):
->searchFields("contact_id", "name:like")
For fields that have values in a related table, create a RelatedItemSelectFieldRenderer for the search filter Example:
new RelatedItemSelectFieldRenderer($this->getTable(Program)->form, "affiliation_id", "Primary Program Type", Affiliation, "ORDER BY sort_order, affiliation", "affiliation", "affiliation_id");
If the field has a set of options defined in the DataItem class, create SelectFieldRenderer. Example:
new SelectFieldRenderer($this->getTable(Program)->form, "residency_requirement", "Residency Requirement", Program::$residencyTypes);
If you need to search on a field that is not in the table but is instead in an xref table, such as the obj is linked to a set of states through a item_state_xref table, then create the RelatedItemSelectFieldRenderer but set an additional or custom callback parameter handler:
new RelatedItemSelectFieldRenderer($this->getTable(Program)->form, "state", "State", State, "ORDER BY name", "name", "state_id");
$this->getTable(Program)->params->setParam("state", "equal", $_REQUEST["state:equal"]); $this->getTable(Program)->params->setHandler("state", array(ProgramReportManager, getStateConstraint));
Definition at line 118 of file report_manager.inc.
ReportManager::__sleep | ( | ) |
Tidy up the request data and limit the fields returned when serializing a ReportManager.
Definition at line 156 of file report_manager.inc.
|
static |
Respond to fired event DeleteUser.
Delete any records in this component that have dependencies on user object.
obj | $user | - class SiteUser or custom user class |
Definition at line 181 of file report_manager.inc.
ReportManager::drawForm | ( | ) |
Draw the configuration/search form.
Definition at line 197 of file report_manager.inc.
ReportManager::fromRequest | ( | ) |
Definition at line 521 of file report_manager.inc.
ReportManager::generateConstraint | ( | ) |
Generate the search constraint for the current report configuration.
Definition at line 307 of file report_manager.inc.
ReportManager::generateReport | ( | $inlineScript = false | ) |
Definition at line 325 of file report_manager.inc.
ReportManager::getTable | ( | $class | ) |
Retrieve the ReportTable object for the specified DataItem class.
string | $class | the class identifying the ReportTable to be retrieved. |
Definition at line 236 of file report_manager.inc.
ReportManager::isColumnSelected | ( | $column | ) |
Definition at line 431 of file report_manager.inc.
|
static |
Definition at line 482 of file report_manager.inc.
ReportManager::populateSelected | ( | ) |
Definition at line 253 of file report_manager.inc.
ReportManager::preSaveReport | ( | ) |
Alternative implementation - presave version of report is stored in session with a.
Definition at line 449 of file report_manager.inc.
ReportManager::ReportManager | ( | ) |
ReportManager::save | ( | ) |
Definition at line 464 of file report_manager.inc.
ReportManager::setSelected | ( | $table, | |
$checkRequest = true |
|||
) |
Set the given table as selected.
ReportTable | $table | the table to select |
boolean | $checkRequest | the check request flag |
Definition at line 280 of file report_manager.inc.
ReportManager::table | ( | $class, | |
$title = "" , |
|||
$useOutputFilter = false |
|||
) |
Add a table to the report.
string | $class | the DataItem class representing the table in the datamodel |
string | $title | (optional) the title to present to the user in the configuration interface |
Definition at line 167 of file report_manager.inc.
ReportManager::writeResultsFormButtons | ( | $excel | ) |
Definition at line 436 of file report_manager.inc.
ReportManager::$columnOrder |
Override the default column order.
Definition at line 126 of file report_manager.inc.
ReportManager::$description |
Longer description of the report.
Definition at line 122 of file report_manager.inc.
ReportManager::$editorPage = "custom_report" |
The page used to display the report editor.
Definition at line 124 of file report_manager.inc.
ReportManager::$interstitialMessage = "" |
Optional interstitial message to display while report is being generated.
Definition at line 131 of file report_manager.inc.
ReportManager::$join |
Definition at line 128 of file report_manager.inc.
ReportManager::$limit |
Optional limit to number of records retrieved, depending on acceptable load times for results.
Definition at line 132 of file report_manager.inc.
ReportManager::$report |
Definition at line 129 of file report_manager.inc.
ReportManager::$report_id |
ID of the saved report as persisted in the database.
Definition at line 120 of file report_manager.inc.
ReportManager::$request |
Definition at line 130 of file report_manager.inc.
ReportManager::$resultsPage = "custom_report_results" |
The page used to display the search results.
Definition at line 123 of file report_manager.inc.
ReportManager::$tables |
Definition at line 127 of file report_manager.inc.
ReportManager::$target |
The target window for the form results.
Definition at line 125 of file report_manager.inc.
ReportManager::$title |
Title of the report.
Definition at line 121 of file report_manager.inc.