Class: I2CE TemplateMeister (Development): Difference between revisions

From IHRIS Wiki
(Created page with '{{otherversions|Class: I2CE_TemplateMeister}} This article describes the class ''I2CE_TemplateMeister'' . *Extends the class: I2CE_Fuzzy. *C…')
 
No edit summary
 
Line 9: Line 9:
*** [[Class: I2CE_MagicDataExport_Template (Development) | I2CE_MagicDataExport_Template]]
*** [[Class: I2CE_MagicDataExport_Template (Development) | I2CE_MagicDataExport_Template]]
** [[Class: I2CE_Template (Development) | I2CE_Template]]
** [[Class: I2CE_Template (Development) | I2CE_Template]]
*Location: Part of the module [[I2CE Module List (Development)#I2CE|I2CE]] in the package [https://launchpad.net/i2ce I2CE] 4.0-dev
*Location: Part of the module [[I2CE Module List (Development)#I2CE|I2CE]] in the package [https://launchpad.net/i2ce I2CE] 4.1-dev
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L33 lib/I2CE_TemplateMeister.php] on line 33
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L33 lib/I2CE_TemplateMeister.php] on line 33
The I2CE_Template class that all display pages use.
The I2CE_Template class that all display pages use.
==Variables==
==Variables==
===$doc===
===$doc===
The top level DOM document that all methods work with.
The top level DOM document that all methods work with.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L38 i2ce/lib/I2CE_TemplateMeister.php] on line 38
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L38 i2ce/lib/I2CE_TemplateMeister.php] on line 38
*Type: public [http://www.php.net/manual/en/class.domdocument.php DOMDocument ] $doc
*Type: public [http://www.php.net/manual/en/class.domdocument.php DOMDocument ] $doc


===$xpath===
===$xpath===
The XPath object used for search for DOM nodes in the document.
The XPath object used for search for DOM nodes in the document.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L43 i2ce/lib/I2CE_TemplateMeister.php] on line 43
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L43 i2ce/lib/I2CE_TemplateMeister.php] on line 43
*Type: protected [http://www.php.net/manual/en/class.domxpath.php DOMXPath ] $xpath
*Type: protected [http://www.php.net/manual/en/class.domxpath.php DOMXPath ] $xpath


===$user===
===$user===
The user who is accessing this template
The user who is accessing this template
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L49 i2ce/lib/I2CE_TemplateMeister.php] on line 49
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L49 i2ce/lib/I2CE_TemplateMeister.php] on line 49
*Type: protected [[Class: I2CE_User (Development) | I2CE_User]] $user
*Type: protected [[Class: I2CE_User (Development) | I2CE_User]] $user


===$working_dir===
===$working_dir===
The working directory for the document.  Used for validation and document creation.
The working directory for the document.  Used for validation and document creation.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L55 i2ce/lib/I2CE_TemplateMeister.php] on line 55
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L55 i2ce/lib/I2CE_TemplateMeister.php] on line 55
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $working_dir
*Type: protected [http://www.php.net/manual/en/language.types.string.php string ] $working_dir


===$loadOptions===
===$loadOptions===
the load options used when loading XML templates
the load options used when loading XML templates
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L192 i2ce/lib/I2CE_TemplateMeister.php] on line 192
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L192 i2ce/lib/I2CE_TemplateMeister.php] on line 192
*Type: protected integer $loadOptions
*Type: protected integer $loadOptions


===$headers===
===$headers===
@var protected array $header of string.  The header strings.
@var protected array $header of string.  The header strings.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L227 i2ce/lib/I2CE_TemplateMeister.php] on line 227
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L227 i2ce/lib/I2CE_TemplateMeister.php] on line 227
*Type: protected $headers
*Type: protected $headers


===$verboseErrors===
===$verboseErrors===
the verbosity of errors for validation
the verbosity of errors for validation
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L822 i2ce/lib/I2CE_TemplateMeister.php] on line 822
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L847 i2ce/lib/I2CE_TemplateMeister.php] on line 847
*Type: protected [http://www.php.net/manual/en/language.types.boolean.php boolean ] $verboseErrors
*Type: protected [http://www.php.net/manual/en/language.types.boolean.php boolean ] $verboseErrors


Line 51: Line 51:
===__construct()===
===__construct()===
I2CE_Template constructor method. This constructor sets up the basic variables for all I2CE_Template objects.
I2CE_Template constructor method. This constructor sets up the basic variables for all I2CE_Template objects.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L108 i2ce/lib/I2CE_TemplateMeister.php] on line 108
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L108 i2ce/lib/I2CE_TemplateMeister.php] on line 108
*Signature: public function __construct()
*Signature: public function __construct()
===_loadFile()===
===_loadFile()===
Helper method.  Load a file into the spectified document as XML
Helper method.  Load a file into the spectified document as XML
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L572 i2ce/lib/I2CE_TemplateMeister.php] on line 572
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L577 i2ce/lib/I2CE_TemplateMeister.php] on line 577
*Signature: protected function _loadFile($doc,$contentfile)
*Signature: protected function _loadFile($doc,$contentfile)
*Parameters:
*Parameters:
Line 63: Line 63:
===_loadText()===
===_loadText()===
Helper method.  Load text into the spectified document as XML @param string $contentfile the file to load
Helper method.  Load text into the spectified document as XML @param string $contentfile the file to load
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L595 i2ce/lib/I2CE_TemplateMeister.php] on line 595
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L600 i2ce/lib/I2CE_TemplateMeister.php] on line 600
*Signature: protected function _loadText($doc,$text,$setEncoding)
*Signature: protected function _loadText($doc,$text,$setEncoding)
*Parameters:
*Parameters:
Line 71: Line 71:
***Default Value: true
***Default Value: true
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>False on failure,
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>False on failure,
===addAnchorIdByName()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L1068 i2ce/lib/I2CE_TemplateMeister.php] on line 1068
*Signature: public function addAnchorIdByName($name,$id,$node)
*Parameters:
**$name
**$id
**$node
***Default Value: null
===addFile()===
===addFile()===
Load and add the  template file to the document
Load and add the  template file to the document
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L672 i2ce/lib/I2CE_TemplateMeister.php] on line 672
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L696 i2ce/lib/I2CE_TemplateMeister.php] on line 696
*Signature: public function addFile($contentfile,$tag,$relative_node)
*Signature: public function addFile($contentfile,$tag,$relative_node)
*Parameters:
*Parameters:
Line 84: Line 92:
===addHeader()===
===addHeader()===
Add a header for this tempalte.  If not set we user 'Content-type: text/xml; charset=utf-8'
Add a header for this tempalte.  If not set we user 'Content-type: text/xml; charset=utf-8'
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L207 i2ce/lib/I2CE_TemplateMeister.php] on line 207
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L207 i2ce/lib/I2CE_TemplateMeister.php] on line 207
*Signature: public function addHeader($header)
*Signature: public function addHeader($header)
*Parameters:
*Parameters:
Line 90: Line 98:
===addText()===
===addText()===
Add a string of text to the document and replace the node with the same id attribute.
Add a string of text to the document and replace the node with the same id attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L911 i2ce/lib/I2CE_TemplateMeister.php] on line 911
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L936 i2ce/lib/I2CE_TemplateMeister.php] on line 936
*Signature: public function addText($text,$tag,$relative_node)
*Signature: public function addText($text,$tag,$relative_node)
*Parameters:
*Parameters:
Line 101: Line 109:
===addTextNode()===
===addTextNode()===
Add a string of text to the node with the given id attribute.
Add a string of text to the node with the given id attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L771 i2ce/lib/I2CE_TemplateMeister.php] on line 771
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L796 i2ce/lib/I2CE_TemplateMeister.php] on line 796
*Signature: public function addTextNode($id,$text,$node)
*Signature: public function addTextNode($id,$text,$node)
*Parameters:
*Parameters:
Line 111: Line 119:
===appendElementById()===
===appendElementById()===
Create and append an element to the given node by id. @param DOMNode $parent
Create and append an element to the given node by id. @param DOMNode $parent
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L745 i2ce/lib/I2CE_TemplateMeister.php] on line 745
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L770 i2ce/lib/I2CE_TemplateMeister.php] on line 770
*Signature: public function appendElementById($parent_id,$tag,$attr,$value,$node)
*Signature: public function appendElementById($parent_id,$tag,$attr,$value,$node)
*Parameters:
*Parameters:
Line 125: Line 133:
===appendElementByNode()===
===appendElementByNode()===
Create and append an element to the given node by id.
Create and append an element to the given node by id.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L758 i2ce/lib/I2CE_TemplateMeister.php] on line 758
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L783 i2ce/lib/I2CE_TemplateMeister.php] on line 783
*Signature: public function appendElementByNode($parent,$tag,$attr,$value,$before)
*Signature: public function appendElementByNode($parent,$tag,$attr,$value,$before)
*Parameters:
*Parameters:
Line 139: Line 147:
===appendFileById()===
===appendFileById()===
This will load the given template and append it to the node with the given id attribute.
This will load the given template and append it to the node with the given id attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L692 i2ce/lib/I2CE_TemplateMeister.php] on line 692
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L716 i2ce/lib/I2CE_TemplateMeister.php] on line 716
*Signature: public function appendFileById($contentfile,$tag,$parent_id,$before,$node)
*Signature: public function appendFileById($contentfile,$tag,$parent_id,$before,$node)
*Parameters:
*Parameters:
Line 152: Line 160:
===appendFileByName()===
===appendFileByName()===
This will load the given  template and append it to the node with the given name attribute at the given occurrence.
This will load the given  template and append it to the node with the given name attribute at the given occurrence.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L708 i2ce/lib/I2CE_TemplateMeister.php] on line 708
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L733 i2ce/lib/I2CE_TemplateMeister.php] on line 733
*Signature: public function appendFileByName($contentfile,$tag,$parent_name,$occurrence,$node)
*Signature: public function appendFileByName($contentfile,$tag,$parent_name,$occurrence,$node,$before)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $contentfile
** [http://www.php.net/manual/en/language.types.string.php string ] $contentfile
Line 161: Line 169:
***Default Value: 0
***Default Value: 0
**$node  
**$node  
***Default Value: null  
***Default Value: null
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $before <br/>If set then the node will be appended as the first child instead of the last.
***Default Value: false
*Returns: [http://www.php.net/manual/en/class.domnode.php DOMNode ]@see loadFile @see appendNodeByName
*Returns: [http://www.php.net/manual/en/class.domnode.php DOMNode ]@see loadFile @see appendNodeByName
===appendFileByNode()===
===appendFileByNode()===
This will load the given  Template and append it to the given node.
This will load the given  Template and append it to the given node.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L719 i2ce/lib/I2CE_TemplateMeister.php] on line 719
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L744 i2ce/lib/I2CE_TemplateMeister.php] on line 744
*Signature: public function appendFileByNode($contentfile,$tag,$parent)
*Signature: public function appendFileByNode($contentfile,$tag,$parent)
*Parameters:
*Parameters:
Line 174: Line 184:
===appendNode()===
===appendNode()===
Append a node to the given parent node if it exists.
Append a node to the given parent node if it exists.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L514 i2ce/lib/I2CE_TemplateMeister.php] on line 514
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L517 i2ce/lib/I2CE_TemplateMeister.php] on line 517
*Signature: public function appendNode($node,$parent,$before)
*Signature: public function appendNode($node,$parent,$before)
*Parameters:
*Parameters:
Line 183: Line 193:
===appendNodeById()===
===appendNodeById()===
Append a node to the node with the given id attribute.
Append a node to the node with the given id attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L451 i2ce/lib/I2CE_TemplateMeister.php] on line 451
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L453 i2ce/lib/I2CE_TemplateMeister.php] on line 453
*Signature: public function appendNodeById($node,$id,$before,$relative_node)
*Signature: public function appendNodeById($node,$id,$before,$relative_node)
*Parameters:
*Parameters:
Line 194: Line 204:
===appendNodeByName()===
===appendNodeByName()===
Append a node to the give occurrence of the node with the given name attribute.
Append a node to the give occurrence of the node with the given name attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L464 i2ce/lib/I2CE_TemplateMeister.php] on line 464
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L467 i2ce/lib/I2CE_TemplateMeister.php] on line 467
*Signature: public function appendNodeByName($node,$name,$occurrence,$relative_node)
*Signature: public function appendNodeByName($node,$name,$occurrence,$relative_node,$before)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node
** [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node
Line 201: Line 211:
** integer $occurrence @param $relative_node if non null gets the element relative to that node.  Defaults to null
** integer $occurrence @param $relative_node if non null gets the element relative to that node.  Defaults to null
**$relative_node  
**$relative_node  
***Default Value: null  
***Default Value: null
** [http://www.php.net/manual/en/language.types.boolean.php boolean ] $before <br/>If set then the node will be appended as the first child instead of the last.
***Default Value: false
===appendNodesByName()===
===appendNodesByName()===
Append a node to the give occurrence of the node with the given name attribute.
Append a node to the give occurrence of the node with the given name attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L481 i2ce/lib/I2CE_TemplateMeister.php] on line 481
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L484 i2ce/lib/I2CE_TemplateMeister.php] on line 484
*Signature: public function appendNodesByName($nodes,$name,$occurrence,$before,$node)
*Signature: public function appendNodesByName($nodes,$name,$occurrence,$before,$node)
*Parameters:
*Parameters:
Line 216: Line 228:
===appendTextById()===
===appendTextById()===
Add a string of  text to the document and append it to the node with the given id attribute.
Add a string of  text to the document and append it to the node with the given id attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L923 i2ce/lib/I2CE_TemplateMeister.php] on line 923
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L948 i2ce/lib/I2CE_TemplateMeister.php] on line 948
*Signature: public function appendTextById($text,$tag,$parent_id,$node)
*Signature: public function appendTextById($text,$tag,$parent_id,$node)
*Parameters:
*Parameters:
Line 227: Line 239:
===appendTextByName()===
===appendTextByName()===
Add a string of  text to the document and append it to the node with the given name attribute of the given occurrence.
Add a string of  text to the document and append it to the node with the given name attribute of the given occurrence.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L937 i2ce/lib/I2CE_TemplateMeister.php] on line 937
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L962 i2ce/lib/I2CE_TemplateMeister.php] on line 962
*Signature: public function appendTextByName($text,$tag,$parent_name,$occurrence,$node)
*Signature: public function appendTextByName($text,$tag,$parent_name,$occurrence,$node)
*Parameters:
*Parameters:
Line 238: Line 250:
*Returns: [http://www.php.net/manual/en/class.domnode.php DOMNode ]<br/>the node just created
*Returns: [http://www.php.net/manual/en/class.domnode.php DOMNode ]<br/>the node just created
===changeAttributesOnNodes()===
===changeAttributesOnNodes()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L1044 i2ce/lib/I2CE_TemplateMeister.php] on line 1044
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L1080 i2ce/lib/I2CE_TemplateMeister.php] on line 1080
*Signature: public function changeAttributesOnNodes($old,$new,$node)
*Signature: public function changeAttributesOnNodes($old,$new,$node)
*Parameters:
*Parameters:
Line 247: Line 259:
===clearHeaders()===
===clearHeaders()===
Clear all headers currently set for this template.
Clear all headers currently set for this template.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L213 i2ce/lib/I2CE_TemplateMeister.php] on line 213
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L213 i2ce/lib/I2CE_TemplateMeister.php] on line 213
*Signature: public function clearHeaders()
*Signature: public function clearHeaders()
===createElement()===
===createElement()===
Create an element to be added to this page. Create a new element in the document with the given attributes and return the node to be added where needed.
Create an element to be added to this page. Create a new element in the document with the given attributes and return the node to be added where needed.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L367 i2ce/lib/I2CE_TemplateMeister.php] on line 367
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L367 i2ce/lib/I2CE_TemplateMeister.php] on line 367
*Signature: public function createElement($element_name,$attributes,$value)
*Signature: public function createElement($element_name,$attributes,$value)
*Parameters:
*Parameters:
Line 261: Line 273:
===createTextNode()===
===createTextNode()===
Create a text node
Create a text node
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L952 i2ce/lib/I2CE_TemplateMeister.php] on line 952
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L977 i2ce/lib/I2CE_TemplateMeister.php] on line 977
*Signature: public function createTextNode($text)
*Signature: public function createTextNode($text)
*Parameters:
*Parameters:
Line 267: Line 279:
===evaluate()===
===evaluate()===
evaluates an Xpath expression on the document
evaluates an Xpath expression on the document
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L962 i2ce/lib/I2CE_TemplateMeister.php] on line 962
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L987 i2ce/lib/I2CE_TemplateMeister.php] on line 987
*Signature: public function evaluate($qry,$node)
*Signature: public function evaluate($qry,$node)
*Parameters:
*Parameters:
Line 276: Line 288:
===findAndRemoveNodes()===
===findAndRemoveNodes()===
Find and remove nodes. Search the document xpath for any matching nodes and remove them from the document.
Find and remove nodes. Search the document xpath for any matching nodes and remove them from the document.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L552 i2ce/lib/I2CE_TemplateMeister.php] on line 552
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L555 i2ce/lib/I2CE_TemplateMeister.php] on line 555
*Signature: public function findAndRemoveNodes($xpath,$node)
*Signature: public function findAndRemoveNodes($xpath,$node)
*Parameters:
*Parameters:
Line 284: Line 296:
===findTemplate()===
===findTemplate()===
This method finds the location of a template file.If the file is not an absolute file path, it searches the class path 'XML' This method searches the template directory path from the global configuration array for the given template.  If it exists it returns the full path to the file and if not it returns false.  It seaches the path backwards so that later directories can override package versions of files.
This method finds the location of a template file.If the file is not an absolute file path, it searches the class path 'XML' This method searches the template directory path from the global configuration array for the given template.  If it exists it returns the full path to the file and if not it returns false.  It seaches the path backwards so that later directories can override package versions of files.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L85 i2ce/lib/I2CE_TemplateMeister.php] on line 85
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L85 i2ce/lib/I2CE_TemplateMeister.php] on line 85
*Signature: public function findTemplate($template,$raise_error)
*Signature: public function findTemplate($template,$raise_error)
*Parameters:
*Parameters:
Line 293: Line 305:
===getDisplay()===
===getDisplay()===
Returns the displayed page as a (tidy!) string
Returns the displayed page as a (tidy!) string
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L242 i2ce/lib/I2CE_TemplateMeister.php] on line 242
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L242 i2ce/lib/I2CE_TemplateMeister.php] on line 242
*Signature: public function getDisplay()
*Signature: public function getDisplay()
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
*Returns: [http://www.php.net/manual/en/language.types.string.php string ]
===getDoc()===
===getDoc()===
Get the DOM for the template
Get the DOM for the template
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L354 i2ce/lib/I2CE_TemplateMeister.php] on line 354
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L354 i2ce/lib/I2CE_TemplateMeister.php] on line 354
*Signature: public function getDoc()
*Signature: public function getDoc()
*Returns: [http://www.php.net/manual/en/class.domdocument.php DOMDocument ]
*Returns: [http://www.php.net/manual/en/class.domdocument.php DOMDocument ]
===getElementById()===
===getElementById()===
Searches the DOM XPath for the given id. returns the first match found.
Searches the DOM XPath for the given id. returns the first match found.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L268 i2ce/lib/I2CE_TemplateMeister.php] on line 268
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L268 i2ce/lib/I2CE_TemplateMeister.php] on line 268
*Signature: public function getElementById($id,$node)
*Signature: public function getElementById($id,$node)
*Parameters:
*Parameters:
Line 312: Line 324:
===getElementByName()===
===getElementByName()===
Searches the DOM XPath for the given name attribute. This searches the document for the given name attribute.  It returns whatever occurrence is requested. If $occurrence is negative then it will return the occurence offset from the end. Example: -1 returns the last occurence.  If $occurence is null it returns a DOMNodeList
Searches the DOM XPath for the given name attribute. This searches the document for the given name attribute.  It returns whatever occurrence is requested. If $occurrence is negative then it will return the occurence offset from the end. Example: -1 returns the last occurence.  If $occurence is null it returns a DOMNodeList
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L295 i2ce/lib/I2CE_TemplateMeister.php] on line 295
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L295 i2ce/lib/I2CE_TemplateMeister.php] on line 295
*Signature: public function getElementByName($name,$occurrence,$node)
*Signature: public function getElementByName($name,$occurrence,$node)
*Parameters:
*Parameters:
Line 322: Line 334:
===getElementByTagName()===
===getElementByTagName()===
Searches the DOM XPath for the given tag name This searches the document for the given tagname .  It returns whatever occurrence is requested.  If $occurrence is negative then it will return the occurence offset from the end. Example: -1 returns the last occurence.  If $occurence is null it returns a DOMNodeList
Searches the DOM XPath for the given tag name This searches the document for the given tagname .  It returns whatever occurrence is requested.  If $occurrence is negative then it will return the occurence offset from the end. Example: -1 returns the last occurence.  If $occurence is null it returns a DOMNodeList
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L330 i2ce/lib/I2CE_TemplateMeister.php] on line 330
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L330 i2ce/lib/I2CE_TemplateMeister.php] on line 330
*Signature: public function getElementByTagName($tagname,$occurrence,$node)
*Signature: public function getElementByTagName($tagname,$occurrence,$node)
*Parameters:
*Parameters:
Line 332: Line 344:
===getHeaders()===
===getHeaders()===
Get the headers for this page.
Get the headers for this page.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L221 i2ce/lib/I2CE_TemplateMeister.php] on line 221
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L221 i2ce/lib/I2CE_TemplateMeister.php] on line 221
*Signature: public function getHeaders()
*Signature: public function getHeaders()
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string
*Returns: [http://www.php.net/manual/en/language.types.array.php array ]<br/>of string
===getUser()===
===getUser()===
Get the user for this template
Get the user for this template
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L68 i2ce/lib/I2CE_TemplateMeister.php] on line 68
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L68 i2ce/lib/I2CE_TemplateMeister.php] on line 68
*Signature: public function getUser()
*Signature: public function getUser()
*Returns: [[Class: I2CE_User (Development) | I2CE_User]]<br/>$user or false if non has been set
*Returns: [[Class: I2CE_User (Development) | I2CE_User]]<br/>$user or false if non has been set
===importText()===
===importText()===
Add a string of text to the document.
Add a string of text to the document.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L786 i2ce/lib/I2CE_TemplateMeister.php] on line 786
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L811 i2ce/lib/I2CE_TemplateMeister.php] on line 811
*Signature: public function importText($text,$tag)
*Signature: public function importText($text,$tag)
*Parameters:
*Parameters:
Line 351: Line 363:
===loadFile()===
===loadFile()===
Load a template file into the current document. This will load the given template file into the current document.  It will only load based on the surrounding tag name given.  It doesn't place the given node into the document yet, just makes it available for use.
Load a template file into the current document. This will load the given template file into the current document.  It will only load based on the surrounding tag name given.  It doesn't place the given node into the document yet, just makes it available for use.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L642 i2ce/lib/I2CE_TemplateMeister.php] on line 642
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L647 i2ce/lib/I2CE_TemplateMeister.php] on line 647
*Signature: public function loadFile($contentfile,$tag)
*Signature: public function loadFile($contentfile,$tag)
*Parameters:
*Parameters:
Line 360: Line 372:
===loadRootFile()===
===loadRootFile()===
Creates a new document and loads the root file used for this template.
Creates a new document and loads the root file used for this template.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L130 i2ce/lib/I2CE_TemplateMeister.php] on line 130
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L130 i2ce/lib/I2CE_TemplateMeister.php] on line 130
*Signature: public function loadRootFile($root_file)
*Signature: public function loadRootFile($root_file)
*Parameters:
*Parameters:
Line 367: Line 379:
===loadRootText()===
===loadRootText()===
Creates a new document and loads the input text
Creates a new document and loads the input text
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L164 i2ce/lib/I2CE_TemplateMeister.php] on line 164
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L164 i2ce/lib/I2CE_TemplateMeister.php] on line 164
*Signature: public function loadRootText($text)
*Signature: public function loadRootText($text)
*Parameters:
*Parameters:
Line 374: Line 386:
===prepareDisplay()===
===prepareDisplay()===
Called to prepare the display.
Called to prepare the display.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L234 i2ce/lib/I2CE_TemplateMeister.php] on line 234
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L234 i2ce/lib/I2CE_TemplateMeister.php] on line 234
*Signature: public function prepareDisplay()
*Signature: public function prepareDisplay()
===processArgs()===
===processArgs()===
Process any arguments sent to the page
Process any arguments sent to the page
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L155 i2ce/lib/I2CE_TemplateMeister.php] on line 155
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L155 i2ce/lib/I2CE_TemplateMeister.php] on line 155
*Signature: public function processArgs($args)
*Signature: public function processArgs($args)
*Parameters:
*Parameters:
Line 385: Line 397:
===query()===
===query()===
Run an Xpath query on the document
Run an Xpath query on the document
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L978 i2ce/lib/I2CE_TemplateMeister.php] on line 978
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L1003 i2ce/lib/I2CE_TemplateMeister.php] on line 1003
*Signature: public function query($qry,$node)
*Signature: public function query($qry,$node)
*Parameters:
*Parameters:
Line 394: Line 406:
===raiseError()===
===raiseError()===
A raise error method for template that behaves like I2CE::raiseError, except it also displays what is calling the I2CE_Template methods. Raises an error and redirect the user for any critical errors. The default redirect will go to the home page for the site. @param string/mixed $message The error message.
A raise error method for template that behaves like I2CE::raiseError, except it also displays what is calling the I2CE_Template methods. Raises an error and redirect the user for any critical errors. The default redirect will go to the home page for the site. @param string/mixed $message The error message.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L1003 i2ce/lib/I2CE_TemplateMeister.php] on line 1003
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L1028 i2ce/lib/I2CE_TemplateMeister.php] on line 1028
*Signature: protected function raiseError($message,$type,$redirect)
*Signature: protected function raiseError($message,$type,$redirect)
*Parameters:
*Parameters:
Line 403: Line 415:
***Default Value: ""  
***Default Value: ""  
===reIdNodes()===
===reIdNodes()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L1039 i2ce/lib/I2CE_TemplateMeister.php] on line 1039
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L1064 i2ce/lib/I2CE_TemplateMeister.php] on line 1064
*Signature: public function reIdNodes($old_name,$new_name,$node)
*Signature: public function reIdNodes($old_name,$new_name,$node)
*Parameters:
*Parameters:
Line 412: Line 424:
===removeNode()===
===removeNode()===
Remove the given node from the document.
Remove the given node from the document.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L538 i2ce/lib/I2CE_TemplateMeister.php] on line 538
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L541 i2ce/lib/I2CE_TemplateMeister.php] on line 541
*Signature: public function removeNode($node)
*Signature: public function removeNode($node)
*Parameters:
*Parameters:
Line 418: Line 430:
===removeNodeById()===
===removeNodeById()===
Remove a node with the given id attribute.
Remove a node with the given id attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L530 i2ce/lib/I2CE_TemplateMeister.php] on line 530
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L533 i2ce/lib/I2CE_TemplateMeister.php] on line 533
*Signature: public function removeNodeById($id,$node)
*Signature: public function removeNodeById($id,$node)
*Parameters:
*Parameters:
Line 425: Line 437:
***Default Value: null  
***Default Value: null  
===renameNodes()===
===renameNodes()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L1035 i2ce/lib/I2CE_TemplateMeister.php] on line 1035
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L1060 i2ce/lib/I2CE_TemplateMeister.php] on line 1060
*Signature: public function renameNodes($old_name,$new_name,$node)
*Signature: public function renameNodes($old_name,$new_name,$node)
*Parameters:
*Parameters:
Line 434: Line 446:
===replaceNode()===
===replaceNode()===
Replace a node based on the id attribute. Finds a node with the same id attribute as the one in the node passed to this method and replaces it.
Replace a node based on the id attribute. Finds a node with the same id attribute as the one in the node passed to this method and replaces it.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L435 i2ce/lib/I2CE_TemplateMeister.php] on line 435
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L437 i2ce/lib/I2CE_TemplateMeister.php] on line 437
*Signature: public function replaceNode($node,$relative_node)
*Signature: public function replaceNode($node,$relative_node)
*Parameters:
*Parameters:
Line 442: Line 454:
===setAttribute()===
===setAttribute()===
Sets an attribute on the given node ID and xpath. Finds a given node by ID and then searches the given xpath and then adds or replaces the given attribute.
Sets an attribute on the given node ID and xpath. Finds a given node by ID and then searches the given xpath and then adds or replaces the given attribute.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L396 i2ce/lib/I2CE_TemplateMeister.php] on line 396
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L396 i2ce/lib/I2CE_TemplateMeister.php] on line 396
*Signature: public function setAttribute($attr,$value,$id,$xpath,$node)
*Signature: public function setAttribute($attr,$value,$id,$xpath,$node)
*Parameters:
*Parameters:
Line 448: Line 460:
** [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.string.php string ] $id <br/>If non-null we perform our xpath query relative to the node with this id
** [http://www.php.net/manual/en/language.types.string.php string ] $id <br/>If non-null we perform our xpath query relative to the node with this id
** [http://www.php.net/manual/en/language.types.string.php string ] $xpath <br/>Defaults to null, in which case we set the attribute of the node by id. If non-null, we change the attribute of every node found by the xpath query which is searched relative to the the node with the given id. @param $node if non null gets the element by id relative to that node.  Defaults to null
** [http://www.php.net/manual/en/language.types.string.php string ] $xpath <br/>Defaults to null, in which case we set the attribute of the node by id. If non-null, we change the attribute of every node found by the xpath query which is searched relative to the the node with the given id. @param $node Defaults to null. if non null gets the element by id relative to that node if id is not nullIf id is null, tand xpath is not null, then we get query with respect to that node
***Default Value: null
***Default Value: null
**$node  
**$node  
Line 454: Line 466:
===setLoadOptions()===
===setLoadOptions()===
Set the load options used when loading XML templates.  If not called, we use the load options = LIBXML_DTDVALID &  & LIBXML_DTDATTR @param integer options.
Set the load options used when loading XML templates.  If not called, we use the load options = LIBXML_DTDVALID &  & LIBXML_DTDATTR @param integer options.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L199 i2ce/lib/I2CE_TemplateMeister.php] on line 199
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L199 i2ce/lib/I2CE_TemplateMeister.php] on line 199
*Signature: public function setLoadOptions($options)
*Signature: public function setLoadOptions($options)
*Parameters:
*Parameters:
Line 460: Line 472:
===setNodeAttribute()===
===setNodeAttribute()===
Sets an attribute on the given node.
Sets an attribute on the given node.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L419 i2ce/lib/I2CE_TemplateMeister.php] on line 419
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L421 i2ce/lib/I2CE_TemplateMeister.php] on line 421
*Signature: public function setNodeAttribute($attr,$value,$node)
*Signature: public function setNodeAttribute($attr,$value,$node)
*Parameters:
*Parameters:
Line 468: Line 480:
===setUser()===
===setUser()===
Set the user for this template
Set the user for this template
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L60 i2ce/lib/I2CE_TemplateMeister.php] on line 60
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L60 i2ce/lib/I2CE_TemplateMeister.php] on line 60
*Signature: public function setUser($user)
*Signature: public function setUser($user)
*Parameters:
*Parameters:
Line 475: Line 487:
===setVerboseErrors()===
===setVerboseErrors()===
Set the verbosity of errors for validation
Set the verbosity of errors for validation
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L814 i2ce/lib/I2CE_TemplateMeister.php] on line 814
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L839 i2ce/lib/I2CE_TemplateMeister.php] on line 839
*Signature: public function setVerboseErrors($verbose)
*Signature: public function setVerboseErrors($verbose)
*Parameters:
*Parameters:
Line 481: Line 493:
===setWorkingDir()===
===setWorkingDir()===
Set the working directory for the document.  Used for validation and document creation.
Set the working directory for the document.  Used for validation and document creation.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L121 i2ce/lib/I2CE_TemplateMeister.php] on line 121
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L121 i2ce/lib/I2CE_TemplateMeister.php] on line 121
*Signature: public function setWorkingDir($working_dir)
*Signature: public function setWorkingDir($working_dir)
*Parameters:
*Parameters:
Line 487: Line 499:
===validate()===
===validate()===
Validates the XML of this template.
Validates the XML of this template.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L827 i2ce/lib/I2CE_TemplateMeister.php] on line 827
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L852 i2ce/lib/I2CE_TemplateMeister.php] on line 852
*Signature: public function validate()
*Signature: public function validate()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>true on sucess
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]<br/>true on sucess
===xmlError()===
===xmlError()===
Prints an XML error nicely.  Based on http://us3.php.net/manual/en/function.libxml-get-errors.php
Prints an XML error nicely.  Based on http://us3.php.net/manual/en/function.libxml-get-errors.php
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L861 i2ce/lib/I2CE_TemplateMeister.php] on line 861
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/lib/I2CE_TemplateMeister.php#L886 i2ce/lib/I2CE_TemplateMeister.php] on line 886
*Signature: public function xmlError($error,$ret_string)
*Signature: public function xmlError($error,$ret_string)
*Parameters:
*Parameters:

Latest revision as of 08:19, 6 May 2015


This article describes the class I2CE_TemplateMeister .

The I2CE_Template class that all display pages use.

Variables

$doc

The top level DOM document that all methods work with.

$xpath

The XPath object used for search for DOM nodes in the document.

$user

The user who is accessing this template

$working_dir

The working directory for the document. Used for validation and document creation.

$loadOptions

the load options used when loading XML templates

$headers

@var protected array $header of string. The header strings.

$verboseErrors

the verbosity of errors for validation

Methods

__construct()

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

_loadFile()

Helper method. Load a file into the spectified document as XML

_loadText()

Helper method. Load text into the spectified document as XML @param string $contentfile the file to load

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 600
  • Signature: protected function _loadText($doc,$text,$setEncoding)
  • Parameters:
    • DOMDocument $doc
    • $text
    • string $setEncoding
      Defaults to true. If true, set the encoding to be that of the docuemnt. Only useful as false for loading root template files
      • Default Value: true
  • Returns: boolean
    False on failure,

addAnchorIdByName()

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 1068
  • Signature: public function addAnchorIdByName($name,$id,$node)
  • Parameters:
    • $name
    • $id
    • $node
      • Default Value: null

addFile()

Load and add the template file to the document

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 696
  • Signature: public function addFile($contentfile,$tag,$relative_node)
  • Parameters:
    • string $contentfile
    • string $tag
      • Default Value: "div"
    • DOMNode $relative_node
      if non null gets the element relative to that node. Defaults to null
      • Default Value: null
  • Returns: DOMNode
    the node just created @see loadFile @see replaceNode

addHeader()

Add a header for this tempalte. If not set we user 'Content-type: text/xml; charset=utf-8'

addText()

Add a string of text to the document and replace the node with the same id attribute.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 936
  • Signature: public function addText($text,$tag,$relative_node)
  • Parameters:
    • string $text
    • string $tag
      Defaults to "div."
      • Default Value: "div"
    • DOMNode $relative_node
      if non null gets the element relative to that node. Defaults to null
      • Default Value: null
  • Returns: DOMNode
    the node created

addTextNode()

Add a string of text to the node with the given id attribute.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 796
  • Signature: public function addTextNode($id,$text,$node)
  • Parameters:
    • mixed $id
      string an id, or a DOMNode
    • string $text @param $node if non null gets the element relative to that node. Defaults to null
    • $node
      • Default Value: null
  • Returns: DOMNode
    the node just created

appendElementById()

Create and append an element to the given node by id. @param DOMNode $parent

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 770
  • Signature: public function appendElementById($parent_id,$tag,$attr,$value,$node)
  • Parameters:
    • $parent_id
    • string $tag
    • array $attr
      • Default Value: array()
    • string $value @param $node if non null gets the element relative to that node. Defaults to null
      • Default Value: ""
    • $node
      • Default Value: null
  • Returns: DOMNode

appendElementByNode()

Create and append an element to the given node by id.

appendFileById()

This will load the given template and append it to the node with the given id attribute.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 716
  • Signature: public function appendFileById($contentfile,$tag,$parent_id,$before,$node)
  • Parameters:
    • string $contentfile
    • string $tag
    • string $parent_id
    • boolean $before
      If set the file will be appended as the first child instead of the last. @param $node if non null gets the element relative to that node. Defaults to null @see loadFile @see appendNodeById
      • Default Value: false
    • $node
      • Default Value: null
  • Returns: DOMNode

appendFileByName()

This will load the given template and append it to the node with the given name attribute at the given occurrence.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 733
  • Signature: public function appendFileByName($contentfile,$tag,$parent_name,$occurrence,$node,$before)
  • Parameters:
    • string $contentfile
    • string $tag
    • string $parent_name
    • integer $occurrence @param $node if non null gets the element relative to that node. Defaults to null
      • Default Value: 0
    • $node
      • Default Value: null
    • boolean $before
      If set then the node will be appended as the first child instead of the last.
      • Default Value: false
  • Returns: DOMNode @see loadFile @see appendNodeByName

appendFileByNode()

This will load the given Template and append it to the given node.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 744
  • Signature: public function appendFileByNode($contentfile,$tag,$parent)
  • Parameters:
    • string $contentfile
    • string $tag
      The tagname we of the top-level imported node we wish to append. if null, we import all nodes
    • DOMNode $parent
  • Returns: DOMNode
    if $tag is non-null, then it is the appended node, otherwise it is the parent node

appendNode()

Append a node to the given parent node if it exists.

appendNodeById()

Append a node to the node with the given id attribute.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 453
  • Signature: public function appendNodeById($node,$id,$before,$relative_node)
  • Parameters:
    • DOMNode $node
    • string $id
    • boolean $before
      If set then the node will be appended as the first child instead of the last.
      • Default Value: false
    • DOMNode $relative_node
      if non null gets the element relative to that node. Defaults to null
      • Default Value: null

appendNodeByName()

Append a node to the give occurrence of the node with the given name attribute.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 467
  • Signature: public function appendNodeByName($node,$name,$occurrence,$relative_node,$before)
  • Parameters:
    • DOMNode $node
    • string $name
    • integer $occurrence @param $relative_node if non null gets the element relative to that node. Defaults to null
    • $relative_node
      • Default Value: null
    • boolean $before
      If set then the node will be appended as the first child instead of the last.
      • Default Value: false

appendNodesByName()

Append a node to the give occurrence of the node with the given name attribute.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 484
  • Signature: public function appendNodesByName($nodes,$name,$occurrence,$before,$node)
  • Parameters:
    • mixed $nodes
      array of DOMNode or a DOMNodeList
    • string $name
    • integer $occurrence
      which occurence of $name to use. If $occurrence is negative then it will return the occurence offset from the end. Example: -1 returns the last occurence.
    • boolean $before
      If set then the node will be appended as the first child instead of the last. @param $node if non null gets the element relative to that node. Defaults to null
      • Default Value: false
    • $node
      • Default Value: null

appendTextById()

Add a string of text to the document and append it to the node with the given id attribute.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 948
  • Signature: public function appendTextById($text,$tag,$parent_id,$node)
  • Parameters:
    • string $text
    • string $tag
    • string $parent_id @param $node if non null gets the element relative to that node. Defaults to null
    • $node
      • Default Value: null
  • Returns: DOMNode
    the node just created

appendTextByName()

Add a string of text to the document and append it to the node with the given name attribute of the given occurrence.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 962
  • Signature: public function appendTextByName($text,$tag,$parent_name,$occurrence,$node)
  • Parameters:
    • string $text
    • string $tag
    • string $parent_name
    • integer $occurrence @param $node if non null gets the element relative to that node. Defaults to null
    • $node
      • Default Value: null
  • Returns: DOMNode
    the node just created

changeAttributesOnNodes()

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 1080
  • Signature: public function changeAttributesOnNodes($old,$new,$node)
  • Parameters:
    • $old
    • $new
    • $node
      • Default Value: null

clearHeaders()

Clear all headers currently set for this template.

createElement()

Create an element to be added to this page. Create a new element in the document with the given attributes and return the node to be added where needed.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 367
  • Signature: public function createElement($element_name,$attributes,$value)
  • Parameters:
    • string $element_name
    • array $attributes
      • Default Value: array()
    • $value
      • Default Value: ""

createTextNode()

Create a text node

evaluate()

evaluates an Xpath expression on the document

findAndRemoveNodes()

Find and remove nodes. Search the document xpath for any matching nodes and remove them from the document.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 555
  • Signature: public function findAndRemoveNodes($xpath,$node)
  • Parameters:
    • string $xpath @param $node if non null gets the element relative to that node. Defaults to null
    • $node
      • Default Value: null

findTemplate()

This method finds the location of a template file.If the file is not an absolute file path, it searches the class path 'XML' This method searches the template directory path from the global configuration array for the given template. If it exists it returns the full path to the file and if not it returns false. It seaches the path backwards so that later directories can override package versions of files.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 85
  • Signature: public function findTemplate($template,$raise_error)
  • Parameters:
    • string $template
      The name of the template file.
    • boolean $raise_error
      Defaults to true. Raise error if template is not found
      • Default Value: true
  • Returns: mixed

getDisplay()

Returns the displayed page as a (tidy!) string

getDoc()

Get the DOM for the template

getElementById()

Searches the DOM XPath for the given id. returns the first match found.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 268
  • Signature: public function getElementById($id,$node)
  • Parameters:
    • string $id @param $node if non null gets the element relative to that node. Defaults to null
    • $node
      • Default Value: null
  • Returns: DOMNode

getElementByName()

Searches the DOM XPath for the given name attribute. This searches the document for the given name attribute. It returns whatever occurrence is requested. If $occurrence is negative then it will return the occurence offset from the end. Example: -1 returns the last occurence. If $occurence is null it returns a DOMNodeList

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 295
  • Signature: public function getElementByName($name,$occurrence,$node)
  • Parameters:
    • string $name
    • integer $occurrence @param $node if non null gets the element relative to that node. Defaults to null
    • $node
      • Default Value: null
  • Returns: DOMNode

getElementByTagName()

Searches the DOM XPath for the given tag name This searches the document for the given tagname . It returns whatever occurrence is requested. If $occurrence is negative then it will return the occurence offset from the end. Example: -1 returns the last occurence. If $occurence is null it returns a DOMNodeList

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 330
  • Signature: public function getElementByTagName($tagname,$occurrence,$node)
  • Parameters:
    • string $tagname
    • integer $occurrence @param $node if non null gets the element relative to that node. Defaults to null
    • $node
      • Default Value: null
  • Returns: DOMNode

getHeaders()

Get the headers for this page.

getUser()

Get the user for this template

importText()

Add a string of text to the document.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 811
  • Signature: public function importText($text,$tag)
  • Parameters:
    • string $text
    • string $tag
      Defaults to "div." If null, all top-level nodes are returned in an array
      • Default Value: "div"
  • Returns: DOMNode
    or array od DOMNodes null on failure

loadFile()

Load a template file into the current document. This will load the given template file into the current document. It will only load based on the surrounding tag name given. It doesn't place the given node into the document yet, just makes it available for use.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 647
  • Signature: public function loadFile($contentfile,$tag)
  • Parameters:
    • string $contentfile
    • string $tag
      If non-null it is the tagname of a toplevel node we wish to import. if null, we import all nodes.
      • Default Value: "div"
  • Returns: mixed
    DOMNode -- the node just created if $tag was non-nill. array if $tag was null consisting of the imported nodes.

loadRootFile()

Creates a new document and loads the root file used for this template.

loadRootText()

Creates a new document and loads the input text

prepareDisplay()

Called to prepare the display.

processArgs()

Process any arguments sent to the page

query()

Run an Xpath query on the document

raiseError()

A raise error method for template that behaves like I2CE::raiseError, except it also displays what is calling the I2CE_Template methods. Raises an error and redirect the user for any critical errors. The default redirect will go to the home page for the site. @param string/mixed $message The error message.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 1028
  • Signature: protected function raiseError($message,$type,$redirect)
  • Parameters:
    • $message
    • integer $type
      The error type.
      • Default Value: E_USER_NOTICE
    • string $redirect
      The page to redirect to for critical errors. @global array
      • Default Value: ""

reIdNodes()

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 1064
  • Signature: public function reIdNodes($old_name,$new_name,$node)
  • Parameters:
    • $old_name
    • $new_name
    • $node
      • Default Value: null

removeNode()

Remove the given node from the document.

removeNodeById()

Remove a node with the given id attribute.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 533
  • Signature: public function removeNodeById($id,$node)
  • Parameters:
    • string $id @param $node if non null gets the element relative to that node. Defaults to null
    • $node
      • Default Value: null

renameNodes()

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 1060
  • Signature: public function renameNodes($old_name,$new_name,$node)
  • Parameters:
    • $old_name
    • $new_name
    • $node
      • Default Value: null

replaceNode()

Replace a node based on the id attribute. Finds a node with the same id attribute as the one in the node passed to this method and replaces it.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 437
  • Signature: public function replaceNode($node,$relative_node)
  • Parameters:
    • DOMNode $node
    • DOMNode $relative_node
      if non null gets the element relative to that node. Defaults to null
      • Default Value: null

setAttribute()

Sets an attribute on the given node ID and xpath. Finds a given node by ID and then searches the given xpath and then adds or replaces the given attribute.

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 396
  • Signature: public function setAttribute($attr,$value,$id,$xpath,$node)
  • Parameters:
    • string $attr
    • string $value
    • string $id
      If non-null we perform our xpath query relative to the node with this id
    • string $xpath
      Defaults to null, in which case we set the attribute of the node by id. If non-null, we change the attribute of every node found by the xpath query which is searched relative to the the node with the given id. @param $node Defaults to null. if non null gets the element by id relative to that node if id is not null. If id is null, tand xpath is not null, then we get query with respect to that node
      • Default Value: null
    • $node
      • Default Value: null

setLoadOptions()

Set the load options used when loading XML templates. If not called, we use the load options = LIBXML_DTDVALID & & LIBXML_DTDATTR @param integer options.

setNodeAttribute()

Sets an attribute on the given node.

setUser()

Set the user for this template

setVerboseErrors()

Set the verbosity of errors for validation

setWorkingDir()

Set the working directory for the document. Used for validation and document creation.

validate()

Validates the XML of this template.

xmlError()

Prints an XML error nicely. Based on http://us3.php.net/manual/en/function.libxml-get-errors.php

  • Defined in i2ce/lib/I2CE_TemplateMeister.php on line 886
  • Signature: public function xmlError($error,$ret_string)
  • Parameters:
    • LIBXmlError $error
      or array or LIBXMLError
    • mixed $ret_string
      Defaults to false in which it raises an error for the errors . If true, we return a string. if a string, it returns a string with the this value at the begining.
      • Default Value: false
  • Returns: string

Inherited Methods

_hasMethod()

This public method is inherited from I2CE_Fuzzy->_hasMethod()

Inherited Fuzzy Methods

userMessage()

This method is inherited from I2CE_Fuzzy->userMessage()