Class: I2CE MagicDataTemplate: Difference between revisions

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


Line 20: Line 21:
Gets the metadata of this config file in storage
Gets the metadata of this config file in storage
*Signature: public function getConfigMetaData($storage)
*Signature: public function getConfigMetaData($storage)
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] true on sucess
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] true on sucess
Parameters:
Parameters:
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $storage
* [[Class: I2CE_MagicDataNode | I2CE_MagicDataNode]] $storage
Line 30: Line 31:
@param $node DOMElement
@param $node DOMElement
*Signature: protected function getConfigPath($node)
*Signature: protected function getConfigPath($node)
*Returns: [http://www.php.net/manual/en/language.types.string.php string] The full configuration path
*Returns: [http://www.php.net/manual/en/language.types.string.php string ] The full configuration path
Parameters:
Parameters:
*$node  
*$node  
Line 38: Line 39:
*Returns: mixed.  Null on failure, a string  (the content) on sucess
*Returns: mixed.  Null on failure, a string  (the content) on sucess
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $nodeName
* [http://www.php.net/manual/en/language.types.string.php string ] $nodeName
* [http://www.php.net/manual/en/class.domnode.php domnode] $node<br/>The node we wish to search under.  Defaults to null meaning we search from the top node.
* [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node<br/>The node we wish to search under.  Defaults to null meaning we search from the top node.
**Default Value: null
**Default Value: null
* [http://www.php.net/manual/en/language.types.integer.php int] $which<br/>Which result we want.  Defaults to zero
* [http://www.php.net/manual/en/language.types.integer.php int ] $which<br/>Which result we want.  Defaults to zero
**Default Value: 0
**Default Value: 0
===getDefaultStatus()===
===getDefaultStatus()===
Line 53: Line 54:
Get the text content of a node  specified by its tag name
Get the text content of a node  specified by its tag name
*Signature: public function getTextContent($name,$node,$which)
*Signature: public function getTextContent($name,$node,$which)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed] string on sucess, null on failure
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ] string on sucess, null on failure
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $name<br/>the name of the node we wish to find the text content for
* [http://www.php.net/manual/en/language.types.string.php string ] $name<br/>the name of the node we wish to find the text content for
* [http://www.php.net/manual/en/class.domnode.php domnode] $node<br/>The node we wish to search under.  Defaults to null meaning we search from the top node.
* [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node<br/>The node we wish to search under.  Defaults to null meaning we search from the top node.
**Default Value: null
**Default Value: null
* [http://www.php.net/manual/en/language.types.integer.php int] $which<br/>Which result we want.  Defaults to zero.
* [http://www.php.net/manual/en/language.types.integer.php int ] $which<br/>Which result we want.  Defaults to zero.
**Default Value: 0
**Default Value: 0
===processStatus()===
===processStatus()===
Line 65: Line 66:
*Signature: public function processStatus($configNode,$currentStatus,$vers)
*Signature: public function processStatus($configNode,$currentStatus,$vers)
Parameters:
Parameters:
* [http://www.php.net/manual/en/class.domnode.php domnode] $configNode<br/>A configuration or conigurationGroup node
* [http://www.php.net/manual/en/class.domnode.php DOMNode ] $configNode<br/>A configuration or conigurationGroup node
*$currentStatus  
*$currentStatus  
**Default Value: null
**Default Value: null
Line 78: Line 79:
*Returns: boolean. true on sucess
*Returns: boolean. true on sucess
Parameters:
Parameters:
* [http://www.php.net/manual/en/class.domnode.php domnode] $configNode
* [http://www.php.net/manual/en/class.domnode.php DOMNode ] $configNode
*$storage  
*$storage  
* [http://www.php.net/manual/en/language.types.array.php array] $status<br/>If null, it defaults to the array set by getDefaultStatus().  The current status (of parent node)
* [http://www.php.net/manual/en/language.types.array.php array ] $status<br/>If null, it defaults to the array set by getDefaultStatus().  The current status (of parent node)
**Default Value: null
**Default Value: null
*$vers  
*$vers  
Line 87: Line 88:
Process the value of a configuration of type boolean and single valued
Process the value of a configuration of type boolean and single valued
*Signature: protected function processValues_boolean_single($value,$status)
*Signature: protected function processValues_boolean_single($value,$status)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $value
* [http://www.php.net/manual/en/language.types.string.php string ] $value
* [http://www.php.net/manual/en/language.types.array.php array] $status
* [http://www.php.net/manual/en/language.types.array.php array ] $status
===processValues_delimited_many()===
===processValues_delimited_many()===
Process the value of a configuration of type delimited and many valued
Process the value of a configuration of type delimited and many valued
*Signature: protected function processValues_delimited_many($valueList,$status)
*Signature: protected function processValues_delimited_many($valueList,$status)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.array.php array] $valueList
* [http://www.php.net/manual/en/language.types.array.php array ] $valueList
* [http://www.php.net/manual/en/language.types.array.php array] $status
* [http://www.php.net/manual/en/language.types.array.php array ] $status
===processValues_delimited_single()===
===processValues_delimited_single()===
Process the value of a configuration of type delimited and single valued
Process the value of a configuration of type delimited and single valued
*Signature: protected function processValues_delimited_single($value,$status)
*Signature: protected function processValues_delimited_single($value,$status)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $value
* [http://www.php.net/manual/en/language.types.string.php string ] $value
* [http://www.php.net/manual/en/language.types.array.php array] $status
* [http://www.php.net/manual/en/language.types.array.php array ] $status
===processValues_list_many()===
===processValues_list_many()===
Process the value of a configuration of type list and many valued
Process the value of a configuration of type list and many valued
@param array $valueList
@param array $valueList
*Signature: protected function processValues_list_many($value,$status)
*Signature: protected function processValues_list_many($value,$status)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
Parameters:
Parameters:
*$value  
*$value  
* [http://www.php.net/manual/en/language.types.array.php array] $status
* [http://www.php.net/manual/en/language.types.array.php array ] $status
===processValues_list_single()===
===processValues_list_single()===
Process the value of a configuration of type list and single valued
Process the value of a configuration of type list and single valued
*Signature: protected function processValues_list_single($value,$status)
*Signature: protected function processValues_list_single($value,$status)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $value
* [http://www.php.net/manual/en/language.types.string.php string ] $value
* [http://www.php.net/manual/en/language.types.array.php array] $status
* [http://www.php.net/manual/en/language.types.array.php array ] $status
===processValues_string_many()===
===processValues_string_many()===
Process the value of a configuration of type string and many valued
Process the value of a configuration of type string and many valued
*Signature: protected function processValues_string_many($valueList,$status)
*Signature: protected function processValues_string_many($valueList,$status)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.array.php array] $valueList<br/>of string
* [http://www.php.net/manual/en/language.types.array.php array ] $valueList<br/>of string
* [http://www.php.net/manual/en/language.types.array.php array] $status
* [http://www.php.net/manual/en/language.types.array.php array ] $status
===processValues_string_single()===
===processValues_string_single()===
Process the value of a configuration of type string and single valued
Process the value of a configuration of type string and single valued
*Signature: protected function processValues_string_single($value,$status)
*Signature: protected function processValues_string_single($value,$status)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $value
* [http://www.php.net/manual/en/language.types.string.php string ] $value
* [http://www.php.net/manual/en/language.types.array.php array] $status
* [http://www.php.net/manual/en/language.types.array.php array ] $status
===setConfigValues()===
===setConfigValues()===
Sets the config values from the magic data template
Sets the config values from the magic data template
Line 142: Line 143:
needs to be set in the administration/configuration page.
needs to be set in the administration/configuration page.
Parameters:
Parameters:
* [http://www.php.net/manual/en/class.domnode.php domnode] $config_group<br/>DomNode of <configurationGroup>
* [http://www.php.net/manual/en/class.domnode.php DOMNode ] $config_group<br/>DomNode of <configurationGroup>
* [[Class: I2CE_MagicData | I2CE_MagicData]] $storage
* [[Class: I2CE_MagicData | I2CE_MagicData]] $storage
* [http://www.php.net/manual/en/language.types.array.php array] $status
* [http://www.php.net/manual/en/language.types.array.php array ] $status
*$vers  
*$vers  
**Default Value: '0'
**Default Value: '0'
Line 160: Line 161:
@param $module  string containing the short module name.
@param $module  string containing the short module name.
*Signature: protected function updateClassPath($storage,$module)
*Signature: protected function updateClassPath($storage,$module)
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] TRUE for success
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] TRUE for success
Parameters:
Parameters:
*$storage  
*$storage  
Line 177: Line 178:
@param $paths array of strings
@param $paths array of strings
*Signature: protected function updatePaths($node,$paths)
*Signature: protected function updatePaths($node,$paths)
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean] TRUE if no error.
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] TRUE if no error.
Parameters:
Parameters:
*$node  
*$node  
Line 188: Line 189:
Valiedates the value of a configuration of type string and single valued
Valiedates the value of a configuration of type string and single valued
*Signature: protected function validateValues_string_single($value,$status)
*Signature: protected function validateValues_string_single($value,$status)
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed]
*Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
Parameters:
Parameters:
* [http://www.php.net/manual/en/language.types.string.php string] $value
* [http://www.php.net/manual/en/language.types.string.php string ] $value
* [http://www.php.net/manual/en/language.types.array.php array] $status
* [http://www.php.net/manual/en/language.types.array.php array ] $status
==Inherited Variables==
==Inherited Variables==
===$doc===
===$doc===

Revision as of 22:25, 16 October 2009

This article desrcibes the class I2CE_MagicDataTemplate.

It is contained in the module I2CE in the package I2CE

The class is defined in the file: lib/I2CE_MagicDataTemplate.php

I2CE_MagicDataTemplate @todo Better documentation.

Variables

$merges

$var protected array $merges;

  • Type: protected $merges

Methods

__construct()

I2CE_Template constructor method.

This constructor sets up the basic variables for all I2CE_Template objects.

  • Signature: public function __construct()

getConfigMetaData()

Gets the metadata of this config file in storage

  • Signature: public function getConfigMetaData($storage)
  • Returns: boolean true on sucess

Parameters:

getConfigPath()

Get the path to the current node in the configuration file. Used for error reporting.

@param $node DOMElement

  • Signature: protected function getConfigPath($node)
  • Returns: string The full configuration path

Parameters:

  • $node

getConfigurationTextContent()

Get the value in the <value> tag of a subnode specfiied by the name attribute

  • Signature: public function getConfigurationTextContent($nodeName,$node,$which)
  • Returns: mixed. Null on failure, a string (the content) on sucess

Parameters:

  • string $nodeName
  • DOMNode $node
    The node we wish to search under. Defaults to null meaning we search from the top node.
    • Default Value: null
  • int $which
    Which result we want. Defaults to zero
    • Default Value: 0

getDefaultStatus()

Get the default status variables.

  • Signature: public function getDefaultStatus()

getMerges()

Get the magic data paths whose status we are tracking. $retrurns array. Keys are paths values are the mergetype

  • Signature: public function getMerges()

getTextContent()

Get the text content of a node specified by its tag name

  • Signature: public function getTextContent($name,$node,$which)
  • Returns: mixed string on sucess, null on failure

Parameters:

  • string $name
    the name of the node we wish to find the text content for
  • DOMNode $node
    The node we wish to search under. Defaults to null meaning we search from the top node.
    • Default Value: null
  • int $which
    Which result we want. Defaults to zero.
    • Default Value: 0

processStatus()

Assumes that the template is valid. Set the status variables according to this node

  • Signature: public function processStatus($configNode,$currentStatus,$vers)

Parameters:

  • DOMNode $configNode
    A configuration or conigurationGroup node
  • $currentStatus
    • Default Value: null
  • $vers
    • Default Value: '0'

processValues()

Process values for a config node @param I2CE_MagicDataNode $data @param string $version . Defaults to '0' . The version of the currently loaded data in $storage responsible for this XML @param array of string $paths -- the current path into the $storage that we are using. Defaults to the empty array().

  • Signature: public function processValues($configNode,$storage,$status,$vers,$paths)
  • Returns: boolean. true on sucess

Parameters:

  • DOMNode $configNode
  • $storage
  • array $status
    If null, it defaults to the array set by getDefaultStatus(). The current status (of parent node)
    • Default Value: null
  • $vers
  • $paths

processValues_boolean_single()

Process the value of a configuration of type boolean and single valued

  • Signature: protected function processValues_boolean_single($value,$status)
  • Returns: mixed

Parameters:

processValues_delimited_many()

Process the value of a configuration of type delimited and many valued

  • Signature: protected function processValues_delimited_many($valueList,$status)
  • Returns: mixed

Parameters:

processValues_delimited_single()

Process the value of a configuration of type delimited and single valued

  • Signature: protected function processValues_delimited_single($value,$status)
  • Returns: mixed

Parameters:

processValues_list_many()

Process the value of a configuration of type list and many valued @param array $valueList

  • Signature: protected function processValues_list_many($value,$status)
  • Returns: mixed

Parameters:

processValues_list_single()

Process the value of a configuration of type list and single valued

  • Signature: protected function processValues_list_single($value,$status)
  • Returns: mixed

Parameters:

processValues_string_many()

Process the value of a configuration of type string and many valued

  • Signature: protected function processValues_string_many($valueList,$status)
  • Returns: mixed

Parameters:

processValues_string_single()

Process the value of a configuration of type string and single valued

  • Signature: protected function processValues_string_single($value,$status)
  • Returns: mixed

Parameters:

setConfigValues()

Sets the config values from the magic data template @param string $version . Defaults to '0' . The version of the currently loaded data in $storage responsible for this XML @param array of string $paths -- the current path into the $storage that we are using. Defaults to the empty array().

  • Signature: public function setConfigValues($config_group,$storage,$status,$vers,$paths)
  • Returns: boolean. Returns true on sucess. False if there was some data that

needs to be set in the administration/configuration page. Parameters:

  • DOMNode $config_group
    DomNode of <configurationGroup>
  • I2CE_MagicData $storage
  • array $status
  • $vers
    • Default Value: '0'
  • $paths
    • Default Value: array()

traversePaths()

  • Signature: protected function traversePaths($storage,$paths)

Parameters:

  • $storage
  • $paths

updateClassPath()

Update the storage object with the classfile and default classpath.

@param $storage I2CE_MagicDataNode @param $module string containing the short module name.

  • Signature: protected function updateClassPath($storage,$module)
  • Returns: boolean TRUE for success

Parameters:

  • $storage
    • Default Value: NULL
  • $module
    • Default Value: NULL

updatePaths()

Update the list of path elements in MagicData based on attributes of the element passed in: path Contents of this attribute specify an explicit path name If no path element is used then the contents of the name attribute are added to the path.

@param $node DOMElement

@param $paths array of strings

  • Signature: protected function updatePaths($node,$paths)
  • Returns: boolean TRUE if no error.

Parameters:

  • $node
    • Default Value: NULL
  • &$paths
    • Default Value: NULL

validate()

  • Signature: public function validate()

validateValues_string_single()

Valiedates the value of a configuration of type string and single valued

  • Signature: protected function validateValues_string_single($value,$status)
  • Returns: mixed

Parameters:

Inherited Variables

$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

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()

Fuzzy Methods

processValues_color_triple_hex_single()

This method is implemented by I2CE_Module_ColorPicker->processValues_color_triple_hex_single()

processValues_color_triple_hex_many()

This method is implemented by I2CE_Module_ColorPicker->processValues_color_triple_hex_many()

processValues_color_triple_rgb_single()

This method is implemented by I2CE_Module_ColorPicker->processValues_color_triple_rgb_single()

processValues_color_triple_rgb_many()

This method is implemented by I2CE_Module_ColorPicker->processValues_color_triple_rgb_many()

processValues_color_hex_single()

This method is implemented by I2CE_Module_ColorPicker->processValues_color_hex_single()

processValues_color_hex_many()

This method is implemented by I2CE_Module_ColorPicker->processValues_color_hex_many()