Class: I2CE CustomReport: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 1: Line 1:
This article desrcibes the class '''I2CE_CustomReport''' which extends the class [[Class: I2CE_Fuzzy | I2CE_Fuzzy]]
This article desrcibes the class '''I2CE_CustomReport'''.
*Extends the class: [[Class: I2CE_Fuzzy | I2CE_Fuzzy]].
It is contained in the module [[iHRIS Module List#CustomReports|CustomReports]] in the package [https://launchpad.net/i2ce I2CE]
It is contained in the module [[iHRIS Module List#CustomReports|CustomReports]] in the package [https://launchpad.net/i2ce I2CE]


Line 50: Line 51:
*Signature: public function __construct($report)
*Signature: public function __construct($report)
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $report<br/>The report name
* [http://www.php.net/manual/en/language.types.string.php string ] $report<br/>The report name
===_generateCache()===
===_generateCache()===
*Signature: protected function _generateCache()
*Signature: protected function _generateCache()
Line 58: Line 59:
*Signature: public function generateCache($force,$cache_forms)
*Signature: public function generateCache($force,$cache_forms)
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $force<br/>Defaults to false.  If set to true, it will force the regeneration of the report if it is in_progress
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $force<br/>Defaults to false.  If set to true, it will force the regeneration of the report if it is in_progress
**Default Value: false
**Default Value: false
* [http://www.php.net/manual/en/language.types.boolean.php boolean] $cache_forms<br/>Defaults to True.  If set to true, it will cache the forms required by this report
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $cache_forms<br/>Defaults to True.  If set to true, it will cache the forms required by this report
**Default Value: true
**Default Value: true
===getCachedTableName()===
===getCachedTableName()===
Line 88: Line 89:
@param string $report
@param string $report
*Signature: public function getFormsRequiredByReport()
*Signature: public function getFormsRequiredByReport()
*Returns: [http://www.php.net/manual/en/language.types.array.php array] of string
*Returns: [http://www.php.net/manual/en/language.types.array.php array ] of string
===getLastGenerationTime()===
===getLastGenerationTime()===
*Signature: static public function getLastGenerationTime($report)
*Signature: static public function getLastGenerationTime($report)
*Returns: mixed.  False on failure, int the time the last report generation  on sucess
*Returns: mixed.  False on failure, int the time the last report generation  on sucess
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $report<br/>The shortname for the report
* [http://www.php.net/manual/en/language.types.string.php string ] $report<br/>The shortname for the report
===getReportedFunctions()===
===getReportedFunctions()===
*Signature: protected function getReportedFunctions()
*Signature: protected function getReportedFunctions()
Line 100: Line 101:
@param boolean hooman_readable defaults to false.
@param boolean hooman_readable defaults to false.
*Signature: static public function getStatus($report,$hooman_readable)
*Signature: static public function getStatus($report,$hooman_readable)
*Returns: [http://www.php.net/manual/en/language.types.string.php string] 'does_not_exist','not_generated','generated','failed','in_progress', 'stale' if it is not hooman readable
*Returns: [http://www.php.net/manual/en/language.types.string.php string ] 'does_not_exist','not_generated','generated','failed','in_progress', 'stale' if it is not hooman readable
*
*
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $report
* [http://www.php.net/manual/en/language.types.string.php string ] $report
*$hooman_readable  
*$hooman_readable  
**Default Value: false
**Default Value: false
Line 111: Line 112:
*Returns: mixed.  True if it has failed, false if it has not failed, null if the report does not exist.
*Returns: mixed.  True if it has failed, false if it has not failed, null if the report does not exist.
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $report
* [http://www.php.net/manual/en/language.types.string.php string ] $report
===isStale()===
===isStale()===
Check to see if a report is stale.
Check to see if a report is stale.
*Signature: static public function isStale($report)
*Signature: static public function isStale($report)
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] true/false
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] true/false
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $report
* [http://www.php.net/manual/en/language.types.string.php string ] $report
===processReportingFunctions()===
===processReportingFunctions()===
*Signature: protected function processReportingFunctions()
*Signature: protected function processReportingFunctions()
Line 123: Line 124:
Checks to see if a report exists
Checks to see if a report exists
*Signature: static public function reportExists($report)
*Signature: static public function reportExists($report)
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $report
* [http://www.php.net/manual/en/language.types.string.php string ] $report
===setStatus()===
===setStatus()===
Set the status us a report.
Set the status us a report.
*Signature: static public function setStatus($report,$status)
*Signature: static public function setStatus($report,$status)
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $report
* [http://www.php.net/manual/en/language.types.string.php string ] $report
* [http://www.php.net/manual/en/language.types.string.php string] $status
* [http://www.php.net/manual/en/language.types.string.php string ] $status
===setupQueries()===
===setupQueries()===
*Signature: protected function setupQueries()
*Signature: protected function setupQueries()

Revision as of 22:24, 16 October 2009

This article desrcibes the class I2CE_CustomReport.

It is contained in the module CustomReports in the package I2CE

The class is defined in the file: modules/CustomReports/lib/I2CE_CustomReport.php

I2CE_CustomReport @subpackage Core

  • Author: Carl Leitner <litlfred@ibiblio.org>

Variables

$config

The magic data node holding the configuration information for this report $var protected I2CE_MagicDataNode $config

  • Type: protected $config

$table

$var protected string $table the name of the cached table of the report

  • Type: protected $table

$tmp_table

$var protected string $tmp_table the temporary name of the cached table of the report

  • Type: protected $tmp_table

$db

The instance of the database to perform queries on.

  • Type: protected MDB2 $db

$populate_queries

an array of queries used to populate the cached reports table(s)

  • Type: protected y $populate_queries

$init_queries

an array of queries used to inialize the cached reports table(s)

  • Type: protected y $init_queries

$get_field_def

  • Type: protected MDB2_PreparedStatement $get_field_def

$report_table_cols

  • Type: static protected $report_table_cols

$hooman

  • Type: static protected $hooman

$reportedFunctions

  • Type: protected $reportedFunctions

Methods

__construct()

The constructor

  • Signature: public function __construct($report)

Parameters:

_generateCache()

  • Signature: protected function _generateCache()

generateCache()

Below is the code to actually handle generation of reports Generate the cached report

  • Signature: public function generateCache($force,$cache_forms)

Parameters:

  • boolean $force
    Defaults to false. If set to true, it will force the regeneration of the report if it is in_progress
    • Default Value: false
  • boolean $cache_forms
    Defaults to True. If set to true, it will cache the forms required by this report
    • Default Value: true

getCachedTableName()

Below is the static code to actually handle checking/setting the status of a cached report

  • Signature: static public function getCachedTableName($report,$withDB,$table_prefix)

Parameters:

  • $report
  • $withDB
    • Default Value: true
  • $table_prefix
    • Default Value:

getColumnsInReportTable()

Get the actual columns in the cached report table

  • Signature: static public function getColumnsInReportTable($report)

Parameters:

  • $report

getCreateField()

  • Signature: protected function getCreateField($form,$field,$name)

Parameters:

  • $form
  • $field
  • $name

getFormRelationship()

  • Signature: public function getFormRelationship()

getFormsRequiredByReport()

Gets the forms required by the report @param string $report

  • Signature: public function getFormsRequiredByReport()
  • Returns: array of string

getLastGenerationTime()

  • Signature: static public function getLastGenerationTime($report)
  • Returns: mixed. False on failure, int the time the last report generation on sucess

Parameters:

  • string $report
    The shortname for the report

getReportedFunctions()

  • Signature: protected function getReportedFunctions()

getStatus()

Get the status of the requested report @param boolean hooman_readable defaults to false.

  • Signature: static public function getStatus($report,$hooman_readable)
  • Returns: string 'does_not_exist','not_generated','generated','failed','in_progress', 'stale' if it is not hooman readable

Parameters:

  • string $report
  • $hooman_readable
    • Default Value: false

hasFailed()

Checks to see if a report has failed in its generation

  • Signature: static public function hasFailed($report)
  • Returns: mixed. True if it has failed, false if it has not failed, null if the report does not exist.

Parameters:

isStale()

Check to see if a report is stale.

  • Signature: static public function isStale($report)
  • Returns: boolean true/false

Parameters:

processReportingFunctions()

  • Signature: protected function processReportingFunctions()

reportExists()

Checks to see if a report exists

  • Signature: static public function reportExists($report)
  • Returns: boolean

Parameters:

setStatus()

Set the status us a report.

  • Signature: static public function setStatus($report,$status)

Parameters:

setupQueries()

  • Signature: protected function setupQueries()

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()