|
|
(23 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| This article desrcibes the class ''I2CE_Template''.
| | #REDIRECT [[Class: I2CE_Template (4.1.7)]] |
| *Extends the class: [[Class: I2CE_TemplateMeister | I2CE_TemplateMeister]].
| |
| *Location: Part of the module [[iHRIS Module List#pages|pages]] in the package [https://launchpad.net/i2ce I2CE]
| |
| *Source: Defined in the file [http://bazaar.launchpad.net/~intrahealth+informatics/i2ce/4.0.0-release/annotate/head:/modules/Pages/lib/I2CE_Template.php modules/Pages/lib/I2CE_Template.php]
| |
| ==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
| |
| *Type: protected y $files_loaded
| |
| | |
| ==Methods==
| |
| ===__construct()===
| |
| I2CE_Template constructor method.
| |
| | |
| This constructor sets up the basic variables for all I2CE_Template objects.
| |
| $loadOptions is set to zero.
| |
| *Signature: public function __construct()
| |
| ===_loadFile()===
| |
| Helper method. Load a file into the spectified document as HTML
| |
| *Signature: public function _loadFile($doc,$contentfile)
| |
| *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] False on failure,
| |
| Parameters:
| |
| * [http://www.php.net/manual/en/class.domdocument.php DOMDocument ] $doc
| |
| * [http://www.php.net/manual/en/language.types.string.php string ] $contentfile<br/>the file to load
| |
| ===_loadText()===
| |
| Helper method. Load text into the spectified document as XML
| |
| @param string $contentfile the file to load
| |
| *Signature: protected function _loadText($doc,$text,$setEncoding)
| |
| *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] False on failure,
| |
| Parameters:
| |
| * [http://www.php.net/manual/en/class.domdocument.php DOMDocument ] $doc
| |
| *$text
| |
| * [http://www.php.net/manual/en/language.types.string.php string ] $setEncoding<br/>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
| |
| ===addClass()===
| |
| *Signature: public function addClass($node,$class)
| |
| Parameters:
| |
| *$node
| |
| *$class
| |
| ===addHeaderLink()===
| |
| Add a script or css to the header as a link
| |
| | |
| in which case it is the id that you want to give the import node.
| |
| 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'
| |
| *Signature: public function addHeaderLink($file,$attr,$use_filedump)
| |
| Parameters:
| |
| * [http://www.php.net/manual/en/language.types.string.php string ] $file
| |
| * [http://www.php.net/manual/en/language.pseudo-types.php mixed ] $attr<br/>an array of attribute/value pairs. Defaults to the empty array. can also be a string
| |
| **Default Value: array()
| |
| * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $use_filedump<br/>default to true meaning that we should use the filedump utility
| |
| **Default Value: true
| |
| ===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
| |
| *Signature: public function addHeaderText($text,$type,$as_separate_node,$init_text)
| |
| *Returns: [http://www.php.net/manual/en/class.domnode.php 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.
| |
| Parameters:
| |
| * [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'
| |
| *$as_separate_node
| |
| **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
| |
| **Default Value: ''
| |
| ===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
| |
| relaive to that role
| |
| *Signature: public function checkRolesTasksAndPermissions($node)
| |
| Parameters:
| |
| * [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node<br/>Defaults to null, meaning we check the whole document. Otherwise, we check
| |
| **Default Value: null
| |
| ===ensureCSSURLs()===
| |
| *Signature: static public function ensureCSSURLs($css)
| |
| Parameters:
| |
| *$css
| |
| ===ensureURL()===
| |
| *Signature: static public function ensureURL($url)
| |
| Parameters:
| |
| *$url
| |
| ===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.
| |
| *Signature: public function findTemplate($template,$raise_error)
| |
| *Returns: [http://www.php.net/manual/en/language.pseudo-types.php mixed ]
| |
| Parameters:
| |
| * [http://www.php.net/manual/en/language.types.string.php string ] $template<br/>The name of the template file.
| |
| * [http://www.php.net/manual/en/language.types.boolean.php boolean ] $raise_error<br/>Defaults to true. Raise error if template is not found
| |
| **Default Value: true
| |
| ===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.
| |
| *Signature: protected function fixupAnchors()
| |
| ===getDisplay()===
| |
| Returns the displayed page as a string
| |
| *Signature: public function getDisplay()
| |
| *Returns: [http://www.php.net/manual/en/language.types.string.php string ]
| |
| ===hasClass()===
| |
| *Signature: public function hasClass($node,$class)
| |
| Parameters:
| |
| *$node
| |
| *$class
| |
| ===prepareDisplay()===
| |
| Called to prepare the display.
| |
| *Signature: public function prepareDisplay()
| |
| ===processArgs()===
| |
| Process any arguments sent to the page
| |
| *Signature: public function processArgs($args)
| |
| *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ] true on sucess. false on failure
| |
| Parameters:
| |
| *$args
| |
| ===processLoopCount()===
| |
| Recursively process all child nodes that are being added in a loop to replace the designator text.
| |
| @see replaceCount
| |
| *Signature: protected function processLoopCount($node,$designator,$count)
| |
| Parameters:
| |
| * [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node
| |
| * [http://www.php.net/manual/en/language.types.string.php string ] $designator
| |
| * integer $count
| |
| ===removeClass()===
| |
| *Signature: public function removeClass($node,$class)
| |
| Parameters:
| |
| *$node
| |
| *$class
| |
| ===removeTranslatorComments()===
| |
| *Signature: protected function 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.
| |
| *Signature: protected function replaceCount($node,$designator,$count)
| |
| Parameters:
| |
| * [http://www.php.net/manual/en/class.domnode.php DOMNode ] $node
| |
| * [http://www.php.net/manual/en/language.types.string.php string ] $designator
| |
| * integer $count
| |
| ===setBase()===
| |
| *Signature: protected function 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.
| |
| *Signature: public function setBodyAttr($attr,$value)
| |
| Parameters:
| |
| * [http://www.php.net/manual/en/language.types.string.php string ] $attr
| |
| * [http://www.php.net/manual/en/language.types.string.php string ] $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.
| |
| *Signature: public function setBodyId($id)
| |
| Parameters:
| |
| * [http://www.php.net/manual/en/language.types.string.php string ] $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.
| |
| *Signature: public function setTitle($title)
| |
| Parameters:
| |
| * [http://www.php.net/manual/en/language.types.string.php string ] $title
| |
| ===validate()===
| |
| No validation occcurs so always returns true
| |
| *Signature: public function validate()
| |
| *Returns: [http://www.php.net/manual/en/language.types.boolean.php boolean ]
| |
| ===wrapHeaderTextInTag()===
| |
| *Signature: protected function wrapHeaderTextInTag($text,$tag)
| |
| Parameters:
| |
| *&$text
| |
| *&$tag
| |
| ==Inherited Variables==
| |
| ===$doc===
| |
| Theis public variable is inherited from [[Class: I2CE_TemplateMeister#$doc | I2CE_TemplateMeister->$doc]]
| |
| | |
| ===$xpath===
| |
| Theis protected variable is inherited from [[Class: I2CE_TemplateMeister#$xpath | I2CE_TemplateMeister->$xpath]]
| |
| | |
| ===$user===
| |
| Theis protected variable is inherited from [[Class: I2CE_TemplateMeister#$user | I2CE_TemplateMeister->$user]]
| |
| | |
| ===$working_dir===
| |
| Theis protected variable is inherited from [[Class: I2CE_TemplateMeister#$working_dir | I2CE_TemplateMeister->$working_dir]]
| |
| | |
| ===$loadOptions===
| |
| Theis protected variable is inherited from [[Class: I2CE_TemplateMeister#$loadOptions | I2CE_TemplateMeister->$loadOptions]]
| |
| | |
| ===$headers===
| |
| Theis protected variable is inherited from [[Class: I2CE_TemplateMeister#$headers | I2CE_TemplateMeister->$headers]]
| |
| | |
| ===$verboseErrors===
| |
| Theis protected variable is inherited from [[Class: I2CE_TemplateMeister#$verboseErrors | I2CE_TemplateMeister->$verboseErrors]]
| |
| ==Inherited Fuzzy Methods==
| |
| ===userMessage()===
| |
| This method is inherited from [[Class: I2CE_Fuzzy#userMessage() | I2CE_Fuzzy->userMessage()]]
| |
| ==Fuzzy Methods==
| |
| ===launchBackgroundProcess()===
| |
| This method is implemented by [[Class: I2CE_BackgroundProcess#launchBackgroundProcess() | I2CE_BackgroundProcess->launchBackgroundProcess() ]]
| |
| ===launchBackgroundPHPScript()===
| |
| This method is implemented by [[Class: I2CE_BackgroundProcess#launchBackgroundPHPScript() | I2CE_BackgroundProcess->launchBackgroundPHPScript() ]]
| |
| ===launchBackgroundPage()===
| |
| This method is implemented by [[Class: I2CE_BackgroundProcess#launchBackgroundPage() | I2CE_BackgroundProcess->launchBackgroundPage() ]]
| |
| ===addColorPickerTriple()===
| |
| This method is implemented by [[Class: I2CE_Module_ColorPicker#addColorPickerTriple() | I2CE_Module_ColorPicker->addColorPickerTriple() ]]
| |
| ===setDisplayData()===
| |
| This method is implemented by [[Class: I2CE_DisplayData#setDisplayData() | I2CE_DisplayData->setDisplayData() ]]
| |
| ===setDisplayDataImmediate()===
| |
| This method is implemented by [[Class: I2CE_DisplayData#setDisplayDataImmediate() | I2CE_DisplayData->setDisplayDataImmediate() ]]
| |
| ===selectOptionsImmediate()===
| |
| This method is implemented by [[Class: I2CE_DisplayData#selectOptionsImmediate() | I2CE_DisplayData->selectOptionsImmediate() ]]
| |
| ===addFormWorm()===
| |
| This method is implemented by [[Class: I2CE_Module_FormWorm#addFormWorm() | I2CE_Module_FormWorm->addFormWorm() ]]
| |
| ===getClassValue()===
| |
| This method is implemented by [[Class: I2CE_MootoolsCore#getClassValue() | I2CE_MootoolsCore->getClassValue() ]]
| |
| ===loadClassValues()===
| |
| This method is implemented by [[Class: I2CE_MootoolsCore#loadClassValues() | I2CE_MootoolsCore->loadClassValues() ]]
| |
| ===setClassValue()===
| |
| This method is implemented by [[Class: I2CE_MootoolsCore#setClassValue() | I2CE_MootoolsCore->setClassValue() ]]
| |
| ===setClassValues()===
| |
| This method is implemented by [[Class: I2CE_MootoolsCore#setClassValues() | I2CE_MootoolsCore->setClassValues() ]]
| |
| ===addOption()===
| |
| This method is implemented by [[Class: I2CE_Template_Options#addOption() | I2CE_Template_Options->addOption() ]]
| |
| ===addOptions()===
| |
| This method is implemented by [[Class: I2CE_Template_Options#addOptions() | I2CE_Template_Options->addOptions() ]]
| |
| ===addAutoCompleteInputTreeById()===
| |
| This method is implemented by [[Class: I2CE_Module_TreeSelect#addAutoCompleteInputTreeById() | I2CE_Module_TreeSelect->addAutoCompleteInputTreeById() ]]
| |
| ===addAutoCompleteInputTree()===
| |
| This method is implemented by [[Class: I2CE_Module_TreeSelect#addAutoCompleteInputTree() | I2CE_Module_TreeSelect->addAutoCompleteInputTree() ]]
| |
| ===setForm()===
| |
| This method is implemented by [[Class: I2CE_Module_Forms#setForm() | I2CE_Module_Forms->setForm() ]]
| |
| ===getField()===
| |
| This method is implemented by [[Class: I2CE_Module_Forms#getField() | I2CE_Module_Forms->getField() ]]
| |
| ===setReview()===
| |
| This method is implemented by [[Class: I2CE_Module_Forms#setReview() | I2CE_Module_Forms->setReview() ]]
| |
| ===isReview()===
| |
| This method is implemented by [[Class: I2CE_Module_Forms#isReview() | I2CE_Module_Forms->isReview() ]]
| |
| ===setShowForm()===
| |
| This method is implemented by [[Class: I2CE_Module_Forms#setShowForm() | I2CE_Module_Forms->setShowForm() ]]
| |
| ===showForm()===
| |
| This method is implemented by [[Class: I2CE_Module_Forms#showForm() | I2CE_Module_Forms->showForm() ]]
| |
| ===makeJumper()===
| |
| This method is implemented by [[Class: I2CE_Module_Jumper#makeJumper() | I2CE_Module_Jumper->makeJumper() ]]
| |
| ===menuSelect()===
| |
| This method is implemented by [[Class: I2CE_Module_MenuSelect#menuSelect() | I2CE_Module_MenuSelect->menuSelect() ]]
| |
| ===addUpdateSelect()===
| |
| This method is implemented by [[Class: I2CE_Module_MenuSelect#addUpdateSelect() | I2CE_Module_MenuSelect->addUpdateSelect() ]]
| |
| ===addAjaxUpdate()===
| |
| This method is implemented by [[Class: I2CE_Stub#addAjaxUpdate() | I2CE_Stub->addAjaxUpdate() ]]
| |
| ===addAjaxToggle()===
| |
| This method is implemented by [[Class: I2CE_Stub#addAjaxToggle() | I2CE_Stub->addAjaxToggle() ]]
| |
| ===addAjaxRequestFunction()===
| |
| This method is implemented by [[Class: I2CE_Stub#addAjaxRequestFunction() | I2CE_Stub->addAjaxRequestFunction() ]]
| |
| ===addAjaxCompleteFunction()===
| |
| This method is implemented by [[Class: I2CE_Stub#addAjaxCompleteFunction() | I2CE_Stub->addAjaxCompleteFunction() ]]
| |
| ===addAjaxToggleOnFunction()===
| |
| This method is implemented by [[Class: I2CE_Stub#addAjaxToggleOnFunction() | I2CE_Stub->addAjaxToggleOnFunction() ]]
| |
| ===addAjaxToggleOffFunction()===
| |
| This method is implemented by [[Class: I2CE_Stub#addAjaxToggleOffFunction() | I2CE_Stub->addAjaxToggleOffFunction() ]]
| |
| ===hasAjax()===
| |
| This method is implemented by [[Class: I2CE_Stub#hasAjaxFuzzy() | I2CE_Stub->hasAjaxFuzzy() ]]
| |
| ===setDataTypePriority()===
| |
| This method is implemented by [[Class: I2CE_Module_TemplateData#setDataTypePriority() | I2CE_Module_TemplateData->setDataTypePriority() ]]
| |
| ===setData()===
| |
| This method is implemented by [[Class: I2CE_Module_TemplateData#setData() | I2CE_Module_TemplateData->setData() ]]
| |
| ===getData()===
| |
| This method is implemented by [[Class: I2CE_Module_TemplateData#getData() | I2CE_Module_TemplateData->getData() ]]
| |
| ===getDefaultData()===
| |
| This method is implemented by [[Class: I2CE_Module_TemplateData#getDefaultData() | I2CE_Module_TemplateData->getDefaultData() ]]
| |
| ===removeData()===
| |
| This method is implemented by [[Class: I2CE_Module_TemplateData#removeData() | I2CE_Module_TemplateData->removeData() ]]
| |
| ===getDataNames()===
| |
| This method is implemented by [[Class: I2CE_Module_TemplateData#getDataNames() | I2CE_Module_TemplateData->getDataNames() ]]
| |
| ===ensureNode()===
| |
| This method is implemented by [[Class: I2CE_Module_TemplateData#ensureNode() | I2CE_Module_TemplateData->ensureNode() ]]
| |
| | |
| | |
| [[Category:Class Documentation]]
| |