Class: I2CE CustomReport Template: Difference between revisions

From IHRIS Wiki
No edit summary
No edit summary
Line 1: Line 1:
This article desrcibes the class '''I2CE_CustomReport_Template''' which extends the class [[Class: I2CE_MagicDataTemplate | I2CE_MagicDataTemplate]]
This article desrcibes the class '''I2CE_CustomReport_Template'''.
*Extends the class: [[Class: I2CE_MagicDataTemplate | I2CE_MagicDataTemplate]].
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 39: Line 40:
Compares to arrays with keys 'display_name' to see which is "bigger"
Compares to arrays with keys 'display_name' to see which is "bigger"
*Signature: static public function compareByDisplayName($m,$n)
*Signature: static public function compareByDisplayName($m,$n)
*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.array.php array] $m
* [http://www.php.net/manual/en/language.types.array.php array ] $m
* [http://www.php.net/manual/en/language.types.array.php array] $n
* [http://www.php.net/manual/en/language.types.array.php array ] $n
===createExport()===
===createExport()===
Create an export node by appending on to the given configurationGroup node the values
Create an export node by appending on to the given configurationGroup node the values
Line 49: Line 50:
*Signature: public function createExport($configNode,$config,$pipe,$configType,$status)
*Signature: public function createExport($configNode,$config,$pipe,$configType,$status)
Parameters:
Parameters:
* [http://www.php.net/manual/en/class.domnode.php domnode] $configNode<br/>A configurationGroup node.
* [http://www.php.net/manual/en/class.domnode.php DOMNode ] $configNode<br/>A configurationGroup node.
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $config<br/>The data we wish to store at this node
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $config<br/>The data we wish to store at this node
* [http://www.php.net/manual/en/language.pseudo-types.php mixed] $pipe<br/>A path component or an array of path components relative to the $config. If the pipe is a non-empty array, we export only the
* [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $pipe<br/>A path component or an array of path components relative to the $config. If the pipe is a non-empty array, we export only the
**Default Value: null
**Default Value: null
* [http://www.php.net/manual/en/language.types.string.php string] $configType<br/>Defaults to the empty string.  The configuration type to give the configuration node.
* [http://www.php.net/manual/en/language.types.string.php string ] $configType<br/>Defaults to the empty string.  The configuration type to give the configuration node.
**Default Value: ''
**Default Value: ''
* [http://www.php.net/manual/en/language.types.array.php array] $status<br/>An array of status options we should set for this configuration node.  Defaults to the empty array
* [http://www.php.net/manual/en/language.types.array.php array ] $status<br/>An array of status options we should set for this configuration node.  Defaults to the empty array
**Default Value: array()
**Default Value: array()
===createExportNodeConfigurationGroup()===
===createExportNodeConfigurationGroup()===
Line 63: Line 64:
*Signature: public function createExportNodeConfigurationGroup($configNode,$config,$pipe,$key,$configType,$status)
*Signature: public function createExportNodeConfigurationGroup($configNode,$config,$pipe,$key,$configType,$status)
Parameters:
Parameters:
* [http://www.php.net/manual/en/class.domnode.php domnode] $configNode<br/>A configurationGroup node.
* [http://www.php.net/manual/en/class.domnode.php DOMNode ] $configNode<br/>A configurationGroup node.
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $config<br/>The data we wish to store at this node
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $config<br/>The data we wish to store at this node
* [http://www.php.net/manual/en/language.types.array.php array] $pipe<br/>An array of path components relative to the $config. If the pipe is a non-empty array, we export only the
* [http://www.php.net/manual/en/language.types.array.php array ] $pipe<br/>An array of path components relative to the $config. If the pipe is a non-empty array, we export only the
* [http://www.php.net/manual/en/language.types.string.php string] $key<br/>The key.  (Warning.  It assumes it exists in the magic data!)
* [http://www.php.net/manual/en/language.types.string.php string ] $key<br/>The key.  (Warning.  It assumes it exists in the magic data!)
* [http://www.php.net/manual/en/language.types.string.php string] $configType<br/>Defaults to the empty string.  The configuration type to give the configuration node.
* [http://www.php.net/manual/en/language.types.string.php string ] $configType<br/>Defaults to the empty string.  The configuration type to give the configuration node.
* [http://www.php.net/manual/en/language.types.array.php array] $status<br/>An array of status options we should set for this configuration node.  Defaults to the empty array
* [http://www.php.net/manual/en/language.types.array.php array ] $status<br/>An array of status options we should set for this configuration node.  Defaults to the empty array
===getFormFromReportForm()===
===getFormFromReportForm()===
Looks up the form associated to a reportform in the specified relationship
Looks up the form associated to a reportform in the specified relationship
Line 74: Line 75:
*Returns: string.  The false on failure
*Returns: string.  The false on failure
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $relationship
* [http://www.php.net/manual/en/language.types.string.php string ] $relationship
* [http://www.php.net/manual/en/language.types.string.php string] $reportform<br/>If $reportform == 'primary_form' or $relationship then we are looking up the primary form
* [http://www.php.net/manual/en/language.types.string.php string ] $reportform<br/>If $reportform == 'primary_form' or $relationship then we are looking up the primary form
===getRelationshipFromReport()===
===getRelationshipFromReport()===
Get the relationship associated to a report
Get the relationship associated to a report
Line 81: Line 82:
*Returns: strng.  The empty string on failure
*Returns: strng.  The empty string on failure
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
===getReportFields()===
===getReportFields()===
Get the reported fields for a report
Get the reported fields for a report
*Signature: static public function getReportFields($report,$get_disabled)
*Signature: static public function getReportFields($report,$get_disabled)
*Returns: [http://www.php.net/manual/en/language.types.array.php array] with keys the field name of the form "$form+$field" and values the header for the field
*Returns: [http://www.php.net/manual/en/language.types.array.php array ] with keys the field name of the form "$form+$field" and values the header for the field
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.boolean.php boolean] $get_disabled<br/>Defaults to false
* [http://www.php.net/manual/en/language.types.boolean.php boolean ] $get_disabled<br/>Defaults to false
**Default Value: false
**Default Value: false
===getReportNames()===
===getReportNames()===
Get a list of the existing reports
Get a list of the existing reports
*Signature: static public function getReportNames($cheat)
*Signature: static public function getReportNames($cheat)
*Returns: [http://www.php.net/manual/en/language.types.array.php array] with keys  report shortnames and values an array with indices 'display_name' and 'description' and 'category' and 'config_node'.  the last is
*Returns: [http://www.php.net/manual/en/language.types.array.php array ] with keys  report shortnames and values an array with indices 'display_name' and 'description' and 'category' and 'config_node'.  the last is
template config node for the report
template config node for the report
reports are sorted aplhpabeticaly by 'display_name'
reports are sorted aplhpabeticaly by 'display_name'
Line 102: Line 103:
Get a list of the existing report views
Get a list of the existing report views
*Signature: static public function getReportViews()
*Signature: static public function getReportViews()
*Returns: [http://www.php.net/manual/en/language.types.array.php array] with keys  report view names/index and values an array with indices 'display_name' and 'description' and 'report' and 'config_node',
*Returns: [http://www.php.net/manual/en/language.types.array.php array ] with keys  report view names/index and values an array with indices 'display_name' and 'description' and 'report' and 'config_node',
the last is the template confignode which contains the view
the last is the template confignode which contains the view
reports are sorted alhpabeticaly by 'display_name'
reports are sorted alhpabeticaly by 'display_name'
Line 115: Line 116:
Get the reports available by category
Get the reports available by category
*Signature: static public function getReportsByCategory($cheat)
*Signature: static public function getReportsByCategory($cheat)
*Returns: [http://www.php.net/manual/en/language.types.array.php array] a multi-dimensional array.  the first set of indices is the category sorted alphabetically
*Returns: [http://www.php.net/manual/en/language.types.array.php array ] a multi-dimensional array.  the first set of indices is the category sorted alphabetically
the second set of indices are the reports for that category.
the second set of indices are the reports for that category.
for each of these we have an array indexed by 'display_name' and 'description' and 'config_node'.  the last is
for each of these we have an array indexed by 'display_name' and 'description' and 'config_node'.  the last is
Line 128: Line 129:
*Returns: I2CE_CustomReportTemplate on sucess
*Returns: I2CE_CustomReportTemplate on sucess
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $type<br/>one of report, relationship or reportView.  Defaults to null meaning we get everything under /modules/CustomReports
* [http://www.php.net/manual/en/language.types.string.php string ] $type<br/>one of report, relationship or reportView.  Defaults to null meaning we get everything under /modules/CustomReports
**Default Value: null
**Default Value: null
* [http://www.php.net/manual/en/language.types.string.php string] $name<br/>Defaults to null meaning we get all the <$type>s of the specified name
* [http://www.php.net/manual/en/language.types.string.php string ] $name<br/>Defaults to null meaning we get all the <$type>s of the specified name
**Default Value: null
**Default Value: null
==Inherited Variables==
==Inherited Variables==

Revision as of 22:24, 16 October 2009

This article desrcibes the class I2CE_CustomReport_Template.

It is contained in the module CustomReports in the package I2CE

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

I2CE_CustomReport_Relationship_Template @subpackage Core

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

Variables

$templates

An array of requested relationships templates I2CE_CustomReport_Template indexed by the type and then by name @protected static array $templates

  • Type: static protected $templates

$types

An array index by configTypes. the values are arrays whose keys are fields with values the config types the fields are supposed to have

  • Type: static protected y $types

$blanket

An array with keys config types such that all sub-nodes of a node with this configType will have the configType specified by the value associated to the key

  • Type: static protected y $blanket

$required

an array with keys configTypes with values the required fields for that config type. will cause a failure if not present $var protecected static $required

  • Type: static protected $required

$ensure

  • Type: static protected $ensure

$permissions

  • Type: static protected $permissions

Methods

compareByDisplayName()

Compares to arrays with keys 'display_name' to see which is "bigger"

  • Signature: static public function compareByDisplayName($m,$n)
  • Returns: boolean

Parameters:

createExport()

Create an export node by appending on to the given configurationGroup node the values stored in the magic data. keys specifed by the lowest member of $pipe, if it exists. Otherwise, if the pipe is empty or null, we export all keys. Defaults to empty array

  • Signature: public function createExport($configNode,$config,$pipe,$configType,$status)

Parameters:

  • DOMNode $configNode
    A configurationGroup node.
  • I2CE_MagicDataNode $config
    The data we wish to store at this node
  • mixed $pipe
    A path component or an array of path components relative to the $config. If the pipe is a non-empty array, we export only the
    • Default Value: null
  • string $configType
    Defaults to the empty string. The configuration type to give the configuration node.
    • Default Value:
  • array $status
    An array of status options we should set for this configuration node. Defaults to the empty array
    • Default Value: array()

createExportNodeConfigurationGroup()

Create an configurationGroup node by appending on to the given configurationGroup node the values stored in the magic data at the specified $key. keys specifed by the lowest member of $pipe, if it exists. Otherwise, if the pipe is empty, we export all keys

  • Signature: public function createExportNodeConfigurationGroup($configNode,$config,$pipe,$key,$configType,$status)

Parameters:

  • DOMNode $configNode
    A configurationGroup node.
  • I2CE_MagicDataNode $config
    The data we wish to store at this node
  • array $pipe
    An array of path components relative to the $config. If the pipe is a non-empty array, we export only the
  • string $key
    The key. (Warning. It assumes it exists in the magic data!)
  • string $configType
    Defaults to the empty string. The configuration type to give the configuration node.
  • array $status
    An array of status options we should set for this configuration node. Defaults to the empty array

getFormFromReportForm()

Looks up the form associated to a reportform in the specified relationship

  • Signature: static public function getFormFromReportForm($relationship,$reportform)
  • Returns: string. The false on failure

Parameters:

  • string $relationship
  • string $reportform
    If $reportform == 'primary_form' or $relationship then we are looking up the primary form

getRelationshipFromReport()

Get the relationship associated to a report

  • Signature: static public function getRelationshipFromReport($report)
  • Returns: strng. The empty string on failure

Parameters:

getReportFields()

Get the reported fields for a report

  • Signature: static public function getReportFields($report,$get_disabled)
  • Returns: array with keys the field name of the form "$form+$field" and values the header for the field

Parameters:

getReportNames()

Get a list of the existing reports

  • Signature: static public function getReportNames($cheat)
  • Returns: array with keys report shortnames and values an array with indices 'display_name' and 'description' and 'category' and 'config_node'. the last is

template config node for the report reports are sorted aplhpabeticaly by 'display_name' Parameters:

  • $cheat
    • Default Value: false

getReportViews()

Get a list of the existing report views

  • Signature: static public function getReportViews()
  • Returns: array with keys report view names/index and values an array with indices 'display_name' and 'description' and 'report' and 'config_node',

the last is the template confignode which contains the view reports are sorted alhpabeticaly by 'display_name'

getReportViewsByReport()

Get the report view sorted by report

  • Signature: static public function getReportViewsByReport()
  • Returns: array. a multi-dimensional array. the first index is the short name of the report.

the second index is the name/index of the report view. This in turn refers to an array with keys 'display_name' and 'description' and 'config_node', the last is the template confignode which contains the view

getReportsByCategory()

Get the reports available by category

  • Signature: static public function getReportsByCategory($cheat)
  • Returns: array a multi-dimensional array. the first set of indices is the category sorted alphabetically

the second set of indices are the reports for that category. for each of these we have an array indexed by 'display_name' and 'description' and 'config_node'. the last is template config node for the report the second set of indices is sorted alphabetically by 'display_name' Parameters:

  • $cheat
    • Default Value: false

getTemplate()

Gets a template. Also caches the results

  • Signature: static public function getTemplate($type,$name)
  • Returns: I2CE_CustomReportTemplate on sucess

Parameters:

  • string $type
    one of report, relationship or reportView. Defaults to null meaning we get everything under /modules/CustomReports
    • Default Value: null
  • string $name
    Defaults to null meaning we get all the <$type>s of the specified name
    • Default Value: null

Inherited Variables

$merges

Theis protected variable is inherited from I2CE_MagicDataTemplate->$merges

$doc

Theis public variable is inherited from I2CE_TemplateMeister->$doc

$xpath

Theis protected variable is inherited from I2CE_TemplateMeister->$xpath

$user

Theis protected variable is inherited from I2CE_TemplateMeister->$user

$working_dir

Theis protected variable is inherited from I2CE_TemplateMeister->$working_dir

$loadOptions

Theis protected variable is inherited from I2CE_TemplateMeister->$loadOptions

$headers

Theis protected variable is inherited from I2CE_TemplateMeister->$headers

$verboseErrors

Theis protected variable is inherited from I2CE_TemplateMeister->$verboseErrors

Inherited Fuzzy Methods

processValues_color_triple_hex_single()

This method is inherited from I2CE_MagicDataTemplate->processValues_color_triple_hex_single()

processValues_color_triple_hex_many()

This method is inherited from I2CE_MagicDataTemplate->processValues_color_triple_hex_many()

processValues_color_triple_rgb_single()

This method is inherited from I2CE_MagicDataTemplate->processValues_color_triple_rgb_single()

processValues_color_triple_rgb_many()

This method is inherited from I2CE_MagicDataTemplate->processValues_color_triple_rgb_many()

processValues_color_hex_single()

This method is inherited from I2CE_MagicDataTemplate->processValues_color_hex_single()

processValues_color_hex_many()

This method is inherited from I2CE_MagicDataTemplate->processValues_color_hex_many()

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()