Class: I2CE Template (Development)

From IHRIS Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


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()