Class: I2CE Template (Development): Difference between revisions

From IHRIS Wiki
(Created page with '{{otherversions|Class: I2CE_Template}} This article describes the class ''I2CE_Template'' . *Extends the class: [[Class: I2CE_TemplateMeister (Development) | I2CE_TemplateMeister…')
 
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 2: Line 2:
This article describes the class ''I2CE_Template'' .
This article describes the class ''I2CE_Template'' .
*Extends the class: [[Class: I2CE_TemplateMeister (Development) | I2CE_TemplateMeister]].
*Extends the class: [[Class: I2CE_TemplateMeister (Development) | I2CE_TemplateMeister]].
*Location: Part of the module [[I2CE Module List (Development)#pages|pages]] in the package [https://launchpad.net/i2ce I2CE] 4.0-dev
*Location: Part of the module [[I2CE Module List (Development)#pages|pages]] 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:/modules/Pages/lib/I2CE_Template.php#L28 modules/Pages/lib/I2CE_Template.php] on line 28
*Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L28 modules/Pages/lib/I2CE_Template.php] on line 28
==Variables==
==Variables==
===$files_loaded===
===$files_loaded===
An array of  files that have been loaded so they're aren't added in twice. The keys are the file names, the value is true if it has been loaded, unset otherwise
An array of  files that have been loaded so they're aren't added in twice. The keys are the file names, the value is true if it has been loaded, unset otherwise
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L183 i2ce/modules/Pages/lib/I2CE_Template.php] on line 183
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L219 i2ce/modules/Pages/lib/I2CE_Template.php] on line 219
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $files_loaded
*Type: protected [http://www.php.net/manual/en/language.types.array.php array ] $files_loaded


Line 13: Line 13:
===__construct()===
===__construct()===
I2CE_Template constructor method. This constructor sets up the basic variables for all I2CE_Template objects. $loadOptions is set to zero.
I2CE_Template constructor method. This constructor sets up the basic variables for all I2CE_Template objects. $loadOptions is set to zero.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L196 i2ce/modules/Pages/lib/I2CE_Template.php] on line 196
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L232 i2ce/modules/Pages/lib/I2CE_Template.php] on line 232
*Signature: public function __construct()
*Signature: public function __construct()
===_loadFile()===
===_loadFile()===
Helper method. Load a file into the spectified document as HTML
Helper method. Load a file into the spectified document as HTML
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L78 i2ce/modules/Pages/lib/I2CE_Template.php] on line 78
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L78 i2ce/modules/Pages/lib/I2CE_Template.php] on line 78
*Signature: public function _loadFile($doc,$contentfile)
*Signature: public function _loadFile($doc,$contentfile)
*Parameters:
*Parameters:
Line 25: Line 25:
===_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:/modules/Pages/lib/I2CE_Template.php#L131 i2ce/modules/Pages/lib/I2CE_Template.php] on line 131
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L167 i2ce/modules/Pages/lib/I2CE_Template.php] on line 167
*Signature: protected function _loadText($doc,$text,$setEncoding)
*Signature: protected function _loadText($doc,$text,$setEncoding)
*Parameters:
*Parameters:
Line 34: Line 34:
*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,
===addClass()===
===addClass()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L31 i2ce/modules/Pages/lib/I2CE_Template.php] on line 31
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L31 i2ce/modules/Pages/lib/I2CE_Template.php] on line 31
*Signature: public function addClass($node,$class)
*Signature: public function addClass($node,$class)
*Parameters:
*Parameters:
Line 41: Line 41:
===addHeaderLink()===
===addHeaderLink()===
Add a script or css to the header as a link
Add a script or css to the header as a link
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L563 i2ce/modules/Pages/lib/I2CE_Template.php] on line 563
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L662 i2ce/modules/Pages/lib/I2CE_Template.php] on line 662
*Signature: public function addHeaderLink($file,$attr,$use_filedump)
*Signature: public function addHeaderLink($file,$attr,$use_filedump)
*Parameters:
*Parameters:
Line 50: Line 50:
***Default Value: true
***Default Value: true
===addHeaderText()===
===addHeaderText()===
Add  text to the header of the document. @param mixed $as_serpate_node whether or not we want add the node as a seperate node or append it (default to false-- append). It will append it to the last node if so. If it is a string, then we create a new node and set the id of a node to  the given string, or append to an existing  node with that id. If it is a DOMNode then we just append to that node
Add  text to the header of the document.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L510 i2ce/modules/Pages/lib/I2CE_Template.php] on line 510
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L609 i2ce/modules/Pages/lib/I2CE_Template.php] on line 609
*Signature: public function addHeaderText($text,$type,$as_separate_node,$init_text)
*Signature: public function addHeaderText($text,$type,$as_separate_node,$init_text)
*Parameters:
*Parameters:
** [http://www.php.net/manual/en/language.types.string.php string ] $text
** [http://www.php.net/manual/en/language.types.string.php string ] $text
** [http://www.php.net/manual/en/language.types.string.php string ] $type <br/>one of 'css',javascipt','vbscript'
** [http://www.php.net/manual/en/language.types.string.php string ] $type <br/>one of 'css',javascipt','vbscript'
**$as_separate_node  
** [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $as_separate_node <br/>whether or not we want add the node as a separate node or append it (default to false-- append). It will append it to the last node if so. If it is a string, then we create a new node and set the id of a node to  the given string, or append to an existing  node with that id. If it is a DOMNode then we just append to that node
***Default Value: false  
***Default Value: false  
** [http://www.php.net/manual/en/language.types.string.php string ] $init_text <br/>the text we ar adding as a separate node and the node does not exist.  Defaults to the empty string
** [http://www.php.net/manual/en/language.types.string.php string ] $init_text <br/>the text we ar adding as a separate node and the node does not exist.  Defaults to the empty string
Line 63: Line 63:
===checkRolesTasksAndPermissions()===
===checkRolesTasksAndPermissions()===
Remove any restricted access elements of the page. This method processes all elements in the document that have a role attribute. If there is no known user or the user doesn't have access to that role then the entire node will be removed from the document. @param I2CE_User $user
Remove any restricted access elements of the page. This method processes all elements in the document that have a role attribute. If there is no known user or the user doesn't have access to that role then the entire node will be removed from the document. @param I2CE_User $user
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L331 i2ce/modules/Pages/lib/I2CE_Template.php] on line 331
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L430 i2ce/modules/Pages/lib/I2CE_Template.php] on line 430
*Signature: public function checkRolesTasksAndPermissions($node)
*Signature: public function checkRolesTasksAndPermissions($node)
*Parameters:
*Parameters:
Line 69: Line 69:
***Default Value: null
***Default Value: null
===ensureCSSURLs()===
===ensureCSSURLs()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L262 i2ce/modules/Pages/lib/I2CE_Template.php] on line 262
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L298 i2ce/modules/Pages/lib/I2CE_Template.php] on line 298
*Signature: static public function ensureCSSURLs($css)
*Signature: static public function ensureCSSURLs($css)
*Parameters:
*Parameters:
**$css  
**$css  
===ensureURL()===
===ensureURL()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L271 i2ce/modules/Pages/lib/I2CE_Template.php] on line 271
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L307 i2ce/modules/Pages/lib/I2CE_Template.php] on line 307
*Signature: static public function ensureURL($url)
*Signature: static public function ensureURL($url)
*Parameters:
*Parameters:
Line 80: Line 80:
===findTemplate()===
===findTemplate()===
This method finds the location of a template file. If the file is not an absolute path searches the class path 'TEMPLATES' 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 path searches the class path 'TEMPLATES' 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:/modules/Pages/lib/I2CE_Template.php#L160 i2ce/modules/Pages/lib/I2CE_Template.php] on line 160
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L196 i2ce/modules/Pages/lib/I2CE_Template.php] on line 196
*Signature: public function findTemplate($template,$raise_error)
*Signature: public function findTemplate($template,$raise_error)
*Parameters:
*Parameters:
Line 89: Line 89:
===fixupAnchors()===
===fixupAnchors()===
Fixes any href's starting with # so that they work properly Also makes sure that any relative URL include an index.php if .htaccess is not used.
Fixes any href's starting with # so that they work properly Also makes sure that any relative URL include an index.php if .htaccess is not used.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L208 i2ce/modules/Pages/lib/I2CE_Template.php] on line 208
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L244 i2ce/modules/Pages/lib/I2CE_Template.php] on line 244
*Signature: protected function fixupAnchors()
*Signature: protected function fixupAnchors()
===getDisplay()===
===getDisplay()===
Returns the displayed page as a string
Returns the displayed page as a string
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L296 i2ce/modules/Pages/lib/I2CE_Template.php] on line 296
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L332 i2ce/modules/Pages/lib/I2CE_Template.php] on line 332
*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 ]
===hasClass()===
===hasClass()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L47 i2ce/modules/Pages/lib/I2CE_Template.php] on line 47
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L47 i2ce/modules/Pages/lib/I2CE_Template.php] on line 47
*Signature: public function hasClass($node,$class)
*Signature: public function hasClass($node,$class)
*Parameters:
*Parameters:
Line 104: Line 104:
===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:/modules/Pages/lib/I2CE_Template.php#L283 i2ce/modules/Pages/lib/I2CE_Template.php] on line 283
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L319 i2ce/modules/Pages/lib/I2CE_Template.php] on line 319
*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:/modules/Pages/lib/I2CE_Template.php#L377 i2ce/modules/Pages/lib/I2CE_Template.php] on line 377
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L476 i2ce/modules/Pages/lib/I2CE_Template.php] on line 476
*Signature: public function processArgs($args)
*Signature: public function processArgs($args)
*Parameters:
*Parameters:
Line 115: Line 115:
===processLoopCount()===
===processLoopCount()===
Recursively process all child nodes that are being added in a loop to replace the designator text.
Recursively process all child nodes that are being added in a loop to replace the designator text.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L465 i2ce/modules/Pages/lib/I2CE_Template.php] on line 465
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L564 i2ce/modules/Pages/lib/I2CE_Template.php] on line 564
*Signature: protected function processLoopCount($node,$designator,$count)
*Signature: protected function processLoopCount($node,$designator,$count)
*Parameters:
*Parameters:
Line 122: Line 122:
** integer $count @see replaceCount
** integer $count @see replaceCount
===removeClass()===
===removeClass()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L59 i2ce/modules/Pages/lib/I2CE_Template.php] on line 59
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L59 i2ce/modules/Pages/lib/I2CE_Template.php] on line 59
*Signature: public function removeClass($node,$class)
*Signature: public function removeClass($node,$class)
*Parameters:
*Parameters:
**$node  
**$node  
**$class  
**$class  
===removeProprietaryAttr()===
Remove the proprietary HTML attributes from tags before outputting the content through tidy. Commented out for now until the best course of action can be determined.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L377 i2ce/modules/Pages/lib/I2CE_Template.php] on line 377
*Signature: protected function removeProprietaryAttr()
===removeTranslatorComments()===
===removeTranslatorComments()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L300 i2ce/modules/Pages/lib/I2CE_Template.php] on line 300
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L364 i2ce/modules/Pages/lib/I2CE_Template.php] on line 364
*Signature: protected function removeTranslatorComments()
*Signature: protected function removeTranslatorComments()
===replaceCount()===
===replaceCount()===
Replace the given designator text with the loop count of the template file being added. If the node is a DOM element then the designator text with the number of the count.
Replace the given designator text with the loop count of the template file being added. If the node is a DOM element then the designator text with the number of the count.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L481 i2ce/modules/Pages/lib/I2CE_Template.php] on line 481
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L580 i2ce/modules/Pages/lib/I2CE_Template.php] on line 580
*Signature: protected function replaceCount($node,$designator,$count)
*Signature: protected function replaceCount($node,$designator,$count)
*Parameters:
*Parameters:
Line 139: Line 143:
** integer $count
** integer $count
===setBase()===
===setBase()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L308 i2ce/modules/Pages/lib/I2CE_Template.php] on line 308
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L407 i2ce/modules/Pages/lib/I2CE_Template.php] on line 407
*Signature: protected function setBase()
*Signature: protected function setBase()
===setBodyAttr()===
===setBodyAttr()===
Adds an attribute to the body tag of this document. This will find the body tag of the document and add or replace the given attribute with the given value.
Adds an attribute to the body tag of this document. This will find the body tag of the document and add or replace the given attribute with the given value.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L433 i2ce/modules/Pages/lib/I2CE_Template.php] on line 433
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L532 i2ce/modules/Pages/lib/I2CE_Template.php] on line 532
*Signature: public function setBodyAttr($attr,$value)
*Signature: public function setBodyAttr($attr,$value)
*Parameters:
*Parameters:
Line 150: Line 154:
===setBodyId()===
===setBodyId()===
Sets the id attribute for the body tag. This will find the body tag of the document and add or replace the id attribute with the given id.
Sets the id attribute for the body tag. This will find the body tag of the document and add or replace the id attribute with the given id.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L450 i2ce/modules/Pages/lib/I2CE_Template.php] on line 450
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L549 i2ce/modules/Pages/lib/I2CE_Template.php] on line 549
*Signature: public function setBodyId($id)
*Signature: public function setBodyId($id)
*Parameters:
*Parameters:
Line 156: Line 160:
===setTitle()===
===setTitle()===
Set the HTML title of the page. This will find the first title element of the page and replace the text in it with the given title.  There should only be one title element in a valid HTML page.
Set the HTML title of the page. This will find the first title element of the page and replace the text in it with the given title.  There should only be one title element in a valid HTML page.
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L410 i2ce/modules/Pages/lib/I2CE_Template.php] on line 410
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L509 i2ce/modules/Pages/lib/I2CE_Template.php] on line 509
*Signature: public function setTitle($title)
*Signature: public function setTitle($title)
*Parameters:
*Parameters:
Line 162: Line 166:
===validate()===
===validate()===
No validation occcurs so always returns true
No validation occcurs so always returns true
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L546 i2ce/modules/Pages/lib/I2CE_Template.php] on line 546
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L645 i2ce/modules/Pages/lib/I2CE_Template.php] on line 645
*Signature: public function validate()
*Signature: public function validate()
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
*Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
===wrapHeaderTextInTag()===
===wrapHeaderTextInTag()===
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L661 i2ce/modules/Pages/lib/I2CE_Template.php] on line 661
*Defined in [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.1-dev/annotate/head:/modules/Pages/lib/I2CE_Template.php#L776 i2ce/modules/Pages/lib/I2CE_Template.php] on line 776
*Signature: protected function wrapHeaderTextInTag($text,$tag)
*Signature: protected function wrapHeaderTextInTag($text,$tag)
*Parameters:
*Parameters:
Line 172: Line 176:
**&$tag  
**&$tag  
==Inherited Methods==
==Inherited Methods==
===addAnchorIdByName()===
This public method is inherited from [[Class: I2CE_TemplateMeister (Development)#addAnchorIdByName() | I2CE_TemplateMeister->addAnchorIdByName()]]
===addFile()===
===addFile()===
This public method is inherited from [[Class: I2CE_TemplateMeister (Development)#addFile() | I2CE_TemplateMeister->addFile()]]
This public method is inherited from [[Class: I2CE_TemplateMeister (Development)#addFile() | I2CE_TemplateMeister->addFile()]]
Line 342: Line 349:
===addColorPickerTriple()===
===addColorPickerTriple()===
This method is implemented by [[Class: I2CE_Module_ColorPicker (Development)#addColorPickerTriple() | I2CE_Module_ColorPicker->addColorPickerTriple() ]]
This method is implemented by [[Class: I2CE_Module_ColorPicker (Development)#addColorPickerTriple() | I2CE_Module_ColorPicker->addColorPickerTriple() ]]
===addReportSelector()===
This method is implemented by [[Class: I2CE_Module_ReportSelector (Development)#addReportSelector() | I2CE_Module_ReportSelector->addReportSelector() ]]
===addDatePicker()===
This method is implemented by [[Class: I2CE_Module_DatePicker (Development)#addDatePicker() | I2CE_Module_DatePicker->addDatePicker() ]]
===setDisplayData()===
===setDisplayData()===
This method is implemented by [[Class: I2CE_DisplayData (Development)#setDisplayData() | I2CE_DisplayData->setDisplayData() ]]
This method is implemented by [[Class: I2CE_DisplayData (Development)#setDisplayData() | I2CE_DisplayData->setDisplayData() ]]
Line 358: Line 369:
===setClassValues()===
===setClassValues()===
This method is implemented by [[Class: I2CE_MootoolsCore (Development)#setClassValues() | I2CE_MootoolsCore->setClassValues() ]]
This method is implemented by [[Class: I2CE_MootoolsCore (Development)#setClassValues() | I2CE_MootoolsCore->setClassValues() ]]
===useDropDown()===
This method is implemented by [[Class: I2CE_MootoolsCore (Development)#useDropDown() | I2CE_MootoolsCore->useDropDown() ]]
===addOption()===
===addOption()===
This method is implemented by [[Class: I2CE_Template_Options (Development)#addOption() | I2CE_Template_Options->addOption() ]]
This method is implemented by [[Class: I2CE_Template_Options (Development)#addOption() | I2CE_Template_Options->addOption() ]]
Line 368: Line 381:
===setForm()===
===setForm()===
This method is implemented by [[Class: I2CE_Module_Forms (Development)#setForm() | I2CE_Module_Forms->setForm() ]]
This method is implemented by [[Class: I2CE_Module_Forms (Development)#setForm() | I2CE_Module_Forms->setForm() ]]
===getForm()===
This method is implemented by [[Class: I2CE_Module_Forms (Development)#getForm() | I2CE_Module_Forms->getForm() ]]
===getField()===
===getField()===
This method is implemented by [[Class: I2CE_Module_Forms (Development)#getField() | I2CE_Module_Forms->getField() ]]
This method is implemented by [[Class: I2CE_Module_Forms (Development)#getField() | I2CE_Module_Forms->getField() ]]
Line 374: Line 389:
===isReview()===
===isReview()===
This method is implemented by [[Class: I2CE_Module_Forms (Development)#isReview() | I2CE_Module_Forms->isReview() ]]
This method is implemented by [[Class: I2CE_Module_Forms (Development)#isReview() | I2CE_Module_Forms->isReview() ]]
===setShowForm()===
This method is implemented by [[Class: I2CE_Module_Forms (Development)#setShowForm() | I2CE_Module_Forms->setShowForm() ]]
===showForm()===
This method is implemented by [[Class: I2CE_Module_Forms (Development)#showForm() | I2CE_Module_Forms->showForm() ]]
===makeJumper()===
===makeJumper()===
This method is implemented by [[Class: I2CE_Module_Jumper (Development)#makeJumper() | I2CE_Module_Jumper->makeJumper() ]]
This method is implemented by [[Class: I2CE_Module_Jumper (Development)#makeJumper() | I2CE_Module_Jumper->makeJumper() ]]
===makeScalingJumper()===
This method is implemented by [[Class: I2CE_Module_Jumper (Development)#makeScalingJumper() | I2CE_Module_Jumper->makeScalingJumper() ]]
===menuSelect()===
===menuSelect()===
This method is implemented by [[Class: I2CE_Module_MenuSelect (Development)#menuSelect() | I2CE_Module_MenuSelect->menuSelect() ]]
This method is implemented by [[Class: I2CE_Module_MenuSelect (Development)#menuSelect() | I2CE_Module_MenuSelect->menuSelect() ]]
Line 386: Line 399:
===addAjaxUpdate()===
===addAjaxUpdate()===
This method is implemented by [[Class: I2CE_Stub (Development)#addAjaxUpdate() | I2CE_Stub->addAjaxUpdate() ]]
This method is implemented by [[Class: I2CE_Stub (Development)#addAjaxUpdate() | I2CE_Stub->addAjaxUpdate() ]]
===addAjaxLoad()===
This method is implemented by [[Class: I2CE_Stub (Development)#addAjaxLoad() | I2CE_Stub->addAjaxLoad() ]]
===addAjaxToggle()===
===addAjaxToggle()===
This method is implemented by [[Class: I2CE_Stub (Development)#addAjaxToggle() | I2CE_Stub->addAjaxToggle() ]]
This method is implemented by [[Class: I2CE_Stub (Development)#addAjaxToggle() | I2CE_Stub->addAjaxToggle() ]]

Latest revision as of 08:19, 6 May 2015


This article describes the class I2CE_Template .

Variables

$files_loaded

An array of files that have been loaded so they're aren't added in twice. The keys are the file names, the value is true if it has been loaded, unset otherwise

Methods

__construct()

I2CE_Template constructor method. This constructor sets up the basic variables for all I2CE_Template objects. $loadOptions is set to zero.

_loadFile()

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

_loadText()

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

  • Defined in i2ce/modules/Pages/lib/I2CE_Template.php on line 167
  • 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,

addClass()

addHeaderLink()

Add a script or css to the header as a link

  • Defined in i2ce/modules/Pages/lib/I2CE_Template.php on line 662
  • Signature: public function addHeaderLink($file,$attr,$use_filedump)
  • Parameters:
    • string $file
    • mixed $attr
      an array of attribute/value pairs. Defaults to the empty array. can also be a string in which case it is the id that you want to give the import node.
      • Default Value: array()
    • boolean $use_filedump
      default to true meaning that we should use the filedump utility when looking for the script/css @returm DOMNode -- the node just created or appended to You might use this by calling addHeaderLink("printer.css",,array('media'=>'print')); Note: Uses the file's extension to determine the proper behavior. Valid ones are 'js', 'css', and 'vb'
      • Default Value: true

addHeaderText()

Add text to the header of the document.

  • Defined in i2ce/modules/Pages/lib/I2CE_Template.php on line 609
  • Signature: public function addHeaderText($text,$type,$as_separate_node,$init_text)
  • Parameters:
    • string $text
    • string $type
      one of 'css',javascipt','vbscript'
    • mixed $as_separate_node
      whether or not we want add the node as a separate node or append it (default to false-- append). It will append it to the last node if so. If it is a string, then we create a new node and set the id of a node to the given string, or append to an existing node with that id. If it is a DOMNode then we just append to that node
      • Default Value: false
    • string $init_text
      the text we ar adding as a separate node and the node does not exist. Defaults to the empty string
      • Default Value:
  • Returns: DOMNode
    the node just created or appended to. False on failure Note the text does not have to be wrapped in <$tag> node. If not, it will put it in a <$tag> node with reasonalbe attributes.

checkRolesTasksAndPermissions()

Remove any restricted access elements of the page. This method processes all elements in the document that have a role attribute. If there is no known user or the user doesn't have access to that role then the entire node will be removed from the document. @param I2CE_User $user

  • Defined in i2ce/modules/Pages/lib/I2CE_Template.php on line 430
  • Signature: public function checkRolesTasksAndPermissions($node)
  • Parameters:
    • DOMNode $node
      Defaults to null, meaning we check the whole document. Otherwise, we check relaive to that role
      • Default Value: null

ensureCSSURLs()

ensureURL()

findTemplate()

This method finds the location of a template file. If the file is not an absolute path searches the class path 'TEMPLATES' 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.

fixupAnchors()

Fixes any href's starting with # so that they work properly Also makes sure that any relative URL include an index.php if .htaccess is not used.

getDisplay()

Returns the displayed page as a string

hasClass()

prepareDisplay()

Called to prepare the display.

processArgs()

Process any arguments sent to the page

processLoopCount()

Recursively process all child nodes that are being added in a loop to replace the designator text.

removeClass()

removeProprietaryAttr()

Remove the proprietary HTML attributes from tags before outputting the content through tidy. Commented out for now until the best course of action can be determined.

removeTranslatorComments()

replaceCount()

Replace the given designator text with the loop count of the template file being added. If the node is a DOM element then the designator text with the number of the count.

setBase()

setBodyAttr()

Adds an attribute to the body tag of this document. This will find the body tag of the document and add or replace the given attribute with the given value.

setBodyId()

Sets the id attribute for the body tag. This will find the body tag of the document and add or replace the id attribute with the given id.

setTitle()

Set the HTML title of the page. This will find the first title element of the page and replace the text in it with the given title. There should only be one title element in a valid HTML page.

validate()

No validation occcurs so always returns true

wrapHeaderTextInTag()

Inherited Methods

addAnchorIdByName()

This public method is inherited from I2CE_TemplateMeister->addAnchorIdByName()

addFile()

This public method is inherited from I2CE_TemplateMeister->addFile()

addHeader()

This public method is inherited from I2CE_TemplateMeister->addHeader()

addText()

This public method is inherited from I2CE_TemplateMeister->addText()

addTextNode()

This public method is inherited from I2CE_TemplateMeister->addTextNode()

appendElementById()

This public method is inherited from I2CE_TemplateMeister->appendElementById()

appendElementByNode()

This public method is inherited from I2CE_TemplateMeister->appendElementByNode()

appendFileById()

This public method is inherited from I2CE_TemplateMeister->appendFileById()

appendFileByName()

This public method is inherited from I2CE_TemplateMeister->appendFileByName()

appendFileByNode()

This public method is inherited from I2CE_TemplateMeister->appendFileByNode()

appendNode()

This public method is inherited from I2CE_TemplateMeister->appendNode()

appendNodeById()

This public method is inherited from I2CE_TemplateMeister->appendNodeById()

appendNodeByName()

This public method is inherited from I2CE_TemplateMeister->appendNodeByName()

appendNodesByName()

This public method is inherited from I2CE_TemplateMeister->appendNodesByName()

appendTextById()

This public method is inherited from I2CE_TemplateMeister->appendTextById()

appendTextByName()

This public method is inherited from I2CE_TemplateMeister->appendTextByName()

changeAttributesOnNodes()

This public method is inherited from I2CE_TemplateMeister->changeAttributesOnNodes()

clearHeaders()

This public method is inherited from I2CE_TemplateMeister->clearHeaders()

createElement()

This public method is inherited from I2CE_TemplateMeister->createElement()

createTextNode()

This public method is inherited from I2CE_TemplateMeister->createTextNode()

evaluate()

This public method is inherited from I2CE_TemplateMeister->evaluate()

findAndRemoveNodes()

This public method is inherited from I2CE_TemplateMeister->findAndRemoveNodes()

getDoc()

This public method is inherited from I2CE_TemplateMeister->getDoc()

getElementById()

This public method is inherited from I2CE_TemplateMeister->getElementById()

getElementByName()

This public method is inherited from I2CE_TemplateMeister->getElementByName()

getElementByTagName()

This public method is inherited from I2CE_TemplateMeister->getElementByTagName()

getHeaders()

This public method is inherited from I2CE_TemplateMeister->getHeaders()

getUser()

This public method is inherited from I2CE_TemplateMeister->getUser()

importText()

This public method is inherited from I2CE_TemplateMeister->importText()

loadFile()

This public method is inherited from I2CE_TemplateMeister->loadFile()

loadRootFile()

This public method is inherited from I2CE_TemplateMeister->loadRootFile()

loadRootText()

This public method is inherited from I2CE_TemplateMeister->loadRootText()

query()

This public method is inherited from I2CE_TemplateMeister->query()

reIdNodes()

This public method is inherited from I2CE_TemplateMeister->reIdNodes()

removeNode()

This public method is inherited from I2CE_TemplateMeister->removeNode()

removeNodeById()

This public method is inherited from I2CE_TemplateMeister->removeNodeById()

renameNodes()

This public method is inherited from I2CE_TemplateMeister->renameNodes()

replaceNode()

This public method is inherited from I2CE_TemplateMeister->replaceNode()

setAttribute()

This public method is inherited from I2CE_TemplateMeister->setAttribute()

setLoadOptions()

This public method is inherited from I2CE_TemplateMeister->setLoadOptions()

setNodeAttribute()

This public method is inherited from I2CE_TemplateMeister->setNodeAttribute()

setUser()

This public method is inherited from I2CE_TemplateMeister->setUser()

setVerboseErrors()

This public method is inherited from I2CE_TemplateMeister->setVerboseErrors()

setWorkingDir()

This public method is inherited from I2CE_TemplateMeister->setWorkingDir()

xmlError()

This public method is inherited from I2CE_TemplateMeister->xmlError()

raiseError()

This protected method is inherited from I2CE_TemplateMeister->raiseError()

_hasMethod()

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

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

launchBackgroundProcess()

This method is implemented by I2CE_BackgroundProcess->launchBackgroundProcess()

launchBackgroundPHPScript()

This method is implemented by I2CE_BackgroundProcess->launchBackgroundPHPScript()

launchBackgroundPage()

This method is implemented by I2CE_BackgroundProcess->launchBackgroundPage()

addColorPickerTriple()

This method is implemented by I2CE_Module_ColorPicker->addColorPickerTriple()

addReportSelector()

This method is implemented by I2CE_Module_ReportSelector->addReportSelector()

addDatePicker()

This method is implemented by I2CE_Module_DatePicker->addDatePicker()

setDisplayData()

This method is implemented by I2CE_DisplayData->setDisplayData()

setDisplayDataImmediate()

This method is implemented by I2CE_DisplayData->setDisplayDataImmediate()

selectOptionsImmediate()

This method is implemented by I2CE_DisplayData->selectOptionsImmediate()

addFormWorm()

This method is implemented by I2CE_Module_FormWorm->addFormWorm()

getClassValue()

This method is implemented by I2CE_MootoolsCore->getClassValue()

loadClassValues()

This method is implemented by I2CE_MootoolsCore->loadClassValues()

setClassValue()

This method is implemented by I2CE_MootoolsCore->setClassValue()

setClassValues()

This method is implemented by I2CE_MootoolsCore->setClassValues()

useDropDown()

This method is implemented by I2CE_MootoolsCore->useDropDown()

addOption()

This method is implemented by I2CE_Template_Options->addOption()

addOptions()

This method is implemented by I2CE_Template_Options->addOptions()

addAutoCompleteInputTreeById()

This method is implemented by I2CE_Module_TreeSelect->addAutoCompleteInputTreeById()

addAutoCompleteInputTree()

This method is implemented by I2CE_Module_TreeSelect->addAutoCompleteInputTree()

setForm()

This method is implemented by I2CE_Module_Forms->setForm()

getForm()

This method is implemented by I2CE_Module_Forms->getForm()

getField()

This method is implemented by I2CE_Module_Forms->getField()

setReview()

This method is implemented by I2CE_Module_Forms->setReview()

isReview()

This method is implemented by I2CE_Module_Forms->isReview()

makeJumper()

This method is implemented by I2CE_Module_Jumper->makeJumper()

makeScalingJumper()

This method is implemented by I2CE_Module_Jumper->makeScalingJumper()

menuSelect()

This method is implemented by I2CE_Module_MenuSelect->menuSelect()

addUpdateSelect()

This method is implemented by I2CE_Module_MenuSelect->addUpdateSelect()

addAjaxUpdate()

This method is implemented by I2CE_Stub->addAjaxUpdate()

addAjaxLoad()

This method is implemented by I2CE_Stub->addAjaxLoad()

addAjaxToggle()

This method is implemented by I2CE_Stub->addAjaxToggle()

addAjaxRequestFunction()

This method is implemented by I2CE_Stub->addAjaxRequestFunction()

addAjaxCompleteFunction()

This method is implemented by I2CE_Stub->addAjaxCompleteFunction()

addAjaxToggleOnFunction()

This method is implemented by I2CE_Stub->addAjaxToggleOnFunction()

addAjaxToggleOffFunction()

This method is implemented by I2CE_Stub->addAjaxToggleOffFunction()

hasAjax()

This method is implemented by I2CE_Stub->hasAjaxFuzzy()

setDataTypePriority()

This method is implemented by I2CE_Module_TemplateData->setDataTypePriority()

setData()

This method is implemented by I2CE_Module_TemplateData->setData()

getData()

This method is implemented by I2CE_Module_TemplateData->getData()

getDefaultData()

This method is implemented by I2CE_Module_TemplateData->getDefaultData()

removeData()

This method is implemented by I2CE_Module_TemplateData->removeData()

getDataNames()

This method is implemented by I2CE_Module_TemplateData->getDataNames()

ensureNode()

This method is implemented by I2CE_Module_TemplateData->ensureNode()