ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilIndependantTemplate Class Reference
+ Inheritance diagram for ilIndependantTemplate:
+ Collaboration diagram for ilIndependantTemplate:

Public Member Functions

 getFile ($filename)
 Reads a file from disk and returns its content. More...
 
 loadTemplatefile ( $filename, $removeUnknownVariables=true, $removeEmptyBlocks=true)
 Reads a template file from the disk. More...
 
 get ($part=null)
 
- Public Member Functions inherited from ilTemplate
 __construct (string $file, bool $flag1, bool $flag2, string $in_module="", string $vars="DEFAULT", bool $plugin=false, bool $a_use_cache=true)
 constructor ilTemplate constructor. More...
 
 blockExists ($a_blockname)
 check if block exists in actual template @access private More...
 
 get ($part="DEFAULT")
 
 getUnmodified ($part="DEFAULT")
 
 setCurrentBlock ($part="DEFAULT")
 Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt. More...
 
 touchBlock ($block)
 overwrites ITX::touchBlock. More...
 
 parseCurrentBlock ($part="DEFAULT")
 Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt @access public. More...
 
 addBlockFile ($var, $block, $tplname, $in_module=false)
 overwrites ITX::addBlockFile @access public More...
 
 loadTemplatefile ( $filename, $removeUnknownVariables=true, $removeEmptyBlocks=true)
 Reads a template file from the disk. More...
 
 variableExists ($a_variablename)
 
 __construct ($file, $flag1, $flag2, $in_module=false, $vars="DEFAULT")
 constructor More...
 
 printToString ()
 @inheritDoc More...
 
 getTemplatePath ($a_tplname, $a_in_module=false, $a_plugin=false)
 builds a full template path with template and module name More...
 
 addBlockFile ($var, $block, $tplname, $in_module=false)
 overwrites ITX::addBlockFile More...
 
 show ($part="DEFAULT")
 @access public More...
 
 getMessageHTML ($a_txt, $a_type="info")
 Get HTML for a system message. More...
 
 setCurrentBlock ($part="DEFAULT")
 Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt. More...
 
 touchBlock ($block)
 overwrites ITX::touchBlock. More...
 
 parseCurrentBlock ($part="DEFAULT")
 Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt @access public. More...
 
 setOnScreenMessage ($a_type, $a_txt, $a_keep=false)
 Set message. More...
 
 fillMessage ()
 
 blockExists ($a_blockname)
 check if block exists in actual template @access private More...
 
 addJavaScript ($a_js_file, $a_add_version_parameter=true, $a_batch=2)
 Add a javascript file that should be included in the header. More...
 
 fillJavaScriptFiles ($force=true)
 
 addCss ($a_css_file, $media="screen")
 Add a css file that should be included in the header. More...
 
 fillCssFiles ($a_force=false)
 Fill in the css file tags. More...
 
 get ($part="DEFAULT")
 
 hideFooter ()
 @inheritDoc More...
 
 addOnLoadCode ($a_code, $a_batch=2)
 @inheritDoc More...
 
 getOnLoadCodeForAsynch ()
 @inheritDoc More...
 
 resetJavascript ()
 @inheritDoc More...
 
 addInlineCss ($a_css, $media="screen")
 @inheritDoc More...
 
 setBodyClass ($a_class="")
 
 loadStandardTemplate ()
 @inheritDoc More...
 
 setTitle ($a_title, $hidden=false)
 @inheritDoc More...
 
 setDescription ($a_descr)
 @inheritDoc More...
 
 setTitleIcon ($a_icon_path, $a_icon_desc="")
 @inheritDoc More...
 
 setAlertProperties (array $a_props)
 @inheritDoc More...
 
 clearHeader ()
 @inheritDoc More...
 
 setHeaderActionMenu ($a_header)
 @inheritDoc More...
 
 setHeaderPageTitle ($a_title)
 @inheritDoc More...
 
 setLocator ()
 @inheritDoc More...
 
 setTabs ($a_tabs_html)
 @inheritDoc More...
 
 setSubTabs ($a_tabs_html)
 @inheritDoc More...
 
 setContent ($a_html)
 @inheritDoc More...
 
 setLeftContent ($a_html)
 @inheritDoc More...
 
 setLeftNavContent ($a_content)
 @inheritDoc More...
 
 setRightContent ($a_html)
 @inheritDoc More...
 
 setPageFormAction ($a_action)
 
 setLoginTargetPar ($a_val)
 @inheritDoc More...
 
 getSpecial ($part="DEFAULT", $add_error_mess=false, $handle_referer=false, $add_ilias_footer=false, $add_standard_elements=false, $a_main_menu=true, $a_tabs=true)
 @inheritDoc More...
 
 printToStdout ($part="DEFAULT", $a_fill_tabs=true, $a_skip_main_menu=false)
 @inheritDoc More...
 
 setTreeFlatIcon ($a_link, $a_mode)
 @inheritDoc More...
 
 addLightbox ($a_html, $a_id)
 @inheritDoc More...
 
 addAdminPanelToolbar (ilToolbarGUI $toolb, $a_bottom_panel=true, $a_arrow=false)
 @inheritDoc More...
 
 setPermanentLink ($a_type, $a_id, $a_append="", $a_target="", $a_title="")
 
 resetHeaderBlock ($a_reset_header_action=true)
 @inheritDoc More...
 
 enableDragDropFileUpload ($a_ref_id)
 @inheritDoc More...
 
- Public Member Functions inherited from HTML_Template_ITX
 __construct ($root='')
 Builds some complex regexps and calls the constructor of the parent class. More...
 
 replaceBlock ($block, $template, $keep_content=false)
 Replaces an existing block with new content. More...
 
 replaceBlockfile ($block, $filename, $keep_content=false)
 Replaces an existing block with new content from a file. More...
 
 addBlock ($placeholder, $blockname, $template)
 Adds a block to the template changing a variable placeholder to a block placeholder. More...
 
 addBlockfile ($placeholder, $blockname, $filename)
 Adds a block taken from a file to the template changing a variable placeholder to a block placeholder. More...
 
 placeholderExists ($placeholder, $block='')
 Returns the name of the (first) block that contains the specified placeholder. More...
 
 performCallback ()
 Checks the list of function calls in the template and calls their callback function. More...
 
 getFunctioncalls ()
 Returns a list of all function calls in the current template. More...
 
 setFunctioncontent ($functionID, $replacement)
 Replaces a function call with the given replacement. More...
 
 setCallbackFunction ($tplfunction, $callbackfunction, $callbackobject='', $expandCallbackParameters=false)
 Sets a callback function. More...
 
 setCallbackFuntiontable ($functions)
 Sets the Callback function lookup table. More...
 
 removeBlockData ($block)
 Recursively removes all data assiciated with a block, including all inner blocks. More...
 
 getBlocklist ()
 Returns a list of blocknames in the template. More...
 
 blockExists ($blockname)
 Checks wheter a block exists. More...
 
 getBlockvariables ($block)
 Returns a list of variables of a block. More...
 
 BlockvariableExists ($block, $variable)
 Checks wheter a block variable exists. More...
 
 buildFunctionlist ()
 Builds a functionlist from the template. More...
 
 getValue ($code, $delimiter)
 Truncates the given code from the first occurence of $delimiter but ignores $delimiter enclosed by " or '. More...
 
 deleteFromBlockvariablelist ($block, $variables)
 Deletes one or many variables from the block variable list. More...
 
 updateBlockvariablelist ($block)
 Updates the variable list of a block. More...
 
 findPlaceholderBlocks ($variable)
 Returns an array of blocknames where the given variable placeholder is used. More...
 
 warning ($message, $file='', $line=0)
 Handles warnings, saves them to $warn and prints them or calls die() depending on the flags. More...
 
- Public Member Functions inherited from HTML_Template_IT
 __construct ($root='', $options=null)
 Builds some complex regular expressions and optinally sets the file root directory. More...
 
 setOption ($option, $value)
 Sets the option for the template class. More...
 
 setOptions ($options)
 Sets the options for the template class. More...
 
 show ($block='__global__')
 Print a certain block with all replacements done. More...
 
 get ($block='__global__')
 Returns a block with all replacements done. More...
 
 parse ($block='__global__', $flag_recursion=false)
 Parses the given block. More...
 
 parseCurrentBlock ()
 Parses the current block. More...
 
 setVariable ($variable, $value='')
 Sets a variable value. More...
 
 setCurrentBlock ($block='__global__')
 Sets the name of the current block that is the block where variables are added. More...
 
 touchBlock ($block)
 Preserves an empty block even if removeEmptyBlocks is true. More...
 
 free ()
 Clears all datafields of the object. More...
 
 setTemplate ( $template, $removeUnknownVariables=true, $removeEmptyBlocks=true)
 Sets the template. More...
 
 loadTemplatefile ( $filename, $removeUnknownVariables=true, $removeEmptyBlocks=true)
 Reads a template file from the disk. More...
 
 setRoot ($root)
 Sets the file root. More...
 
 buildBlockvariablelist ()
 Build a list of all variables within of a block. More...
 
 getGlobalvariables ()
 Returns a list of all global variables. More...
 
 findBlocks ($string)
 Recusively builds a list of all blocks within the template. More...
 
 getFile ($filename)
 Reads a file from disk and returns its content. More...
 
 _addPregDelimiters ($str)
 Adds delimiters to a string, so it can be used as a pattern in preg_* functions. More...
 
 _preserveOpeningDelimiter ($str)
 Replaces an opening delimiter by a special string. More...
 
 errorMessage ($value, $blockname='')
 Return a textual error message for a IT error code. More...
 
- Public Member Functions inherited from ilGlobalTemplateInterface
 hideFooter ()
 Make the template hide the footer. More...
 
 setOnScreenMessage ($a_type, $a_txt, $a_keep=false)
 Set a message to be displayed to the user. More...
 
 addJavaScript ($a_js_file, $a_add_version_parameter=true, $a_batch=2)
 Add a javascript file that should be included in the header. More...
 
 addOnLoadCode ($a_code, $a_batch=2)
 Add on load code. More...
 
 getOnLoadCodeForAsynch ()
 Get js onload code for ajax calls. More...
 
 resetJavascript ()
 Reset javascript files. More...
 
 fillJavaScriptFiles ($a_force=false)
 
 addCss ($a_css_file, $media="screen")
 Add a css file that should be included in the header. More...
 
 addInlineCss ($a_css, $media="screen")
 Add a css file that should be included in the header. More...
 
 setBodyClass ($a_class="")
 
 loadStandardTemplate ()
 This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STATUSLINE placeholders if they are not already loaded. More...
 
 setTitle ($a_title, $hidden=false)
 Sets title in standard template. More...
 
 setDescription ($a_descr)
 Sets descripton below title in standard template. More...
 
 setTitleIcon ($a_icon_path, $a_icon_desc="")
 set title icon More...
 
 setAlertProperties (array $a_props)
 Set alert properties. More...
 
 clearHeader ()
 Clear header. More...
 
 setHeaderActionMenu ($a_header)
 Set header action menu. More...
 
 setHeaderPageTitle ($a_title)
 Sets the title of the page (for browser window). More...
 
 setLocator ()
 Insert locator. More...
 
 setTabs ($a_tabs_html)
 sets tabs in standard template More...
 
 setSubTabs ($a_tabs_html)
 sets subtabs in standard template More...
 
 setContent ($a_html)
 Sets content for standard template. More...
 
 setLeftContent ($a_html)
 Sets content of left column. More...
 
 setLeftNavContent ($a_content)
 Sets content of left navigation column. More...
 
 setRightContent ($a_html)
 Sets content of right column. More...
 
 setPageFormAction ($a_action)
 
 setLoginTargetPar ($a_val)
 Set target parameter for login (public sector). More...
 
 getSpecial ($part="DEFAULT", $add_error_mess=false, $handle_referer=false, $add_ilias_footer=false, $add_standard_elements=false, $a_main_menu=true, $a_tabs=true)
 
 printToStdout ($part="DEFAULT", $a_fill_tabs=true, $a_skip_main_menu=false)
 
 printToString ()
 Use this method to get the finally rendered page as string. More...
 
 setTreeFlatIcon ($a_link, $a_mode)
 set tree/flat icon More...
 
 addLightbox ($a_html, $a_id)
 Add lightbox html. More...
 
 addAdminPanelToolbar (ilToolbarGUI $toolb, $a_bottom_panel=true, $a_arrow=false)
 Add admin panel commands as toolbar. More...
 
 setPermanentLink ($a_type, $a_id, $a_append="", $a_target="", $a_title="")
 
 resetHeaderBlock ($a_reset_header_action=true)
 Reset all header properties: title, icon, description, alerts, action menu. More...
 
 enableDragDropFileUpload ($a_ref_id)
 Enables the file upload into this object by dropping a file. More...
 
 get ($part="DEFAULT")
 
 setVariable ($variable, $value='')
 
 setCurrentBlock ($part="DEFAULT")
 @access public More...
 
 touchBlock ($block)
 overwrites ITX::touchBlock. More...
 
 parseCurrentBlock ($part="DEFAULT")
 Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt. More...
 
 addBlockFile ($var, $block, $tplname, $in_module=false)
 overwrites ITX::addBlockFile More...
 
 blockExists ($a_blockname)
 check if block exists in actual template More...
 

Additional Inherited Members

- Data Fields inherited from ilTemplate
 $vars
 
 $activeBlock
 
 $js_files = array()
 
 $css_files = array()
 
- Data Fields inherited from HTML_Template_ITX
 $warn = array()
 
 $printWarning = false
 
 $haltOnWarning = false
 
 $checkblocknameRegExp = ''
 
 $functionPrefix = 'func_'
 
 $functionnameRegExp = '[_a-zA-Z]+[A-Za-z_0-9]*'
 
 $functionRegExp = ''
 
 $functions = array()
 
 $callback = array()
 
- Data Fields inherited from HTML_Template_IT
 $err = array()
 
 $clearCache = false
 
 $openingDelimiter = '{'
 
 $closingDelimiter = '}'
 
 $blocknameRegExp = '[\.0-9A-Za-z_-]+'
 
 $variablenameRegExp = '[\.0-9A-Za-z_-]+'
 
 $variablesRegExp = ''
 
 $removeVariablesRegExp = ''
 RegExp used to strip unused variable placeholder. More...
 
 $removeUnknownVariables = true
 
 $removeEmptyBlocks = true
 
 $blockRegExp = ''
 
 $currentBlock = '__global__'
 
 $template = ''
 
 $blocklist = array()
 
 $blockdata = array()
 
 $blockvariables = array()
 
 $blockparents = array()
 
 $blockinner = array()
 
 $touchedBlocks = array()
 List of blocks to preverse even if they are "empty". More...
 
 $_hiddenBlocks = array()
 List of blocks which should not be shown even if not "empty". More...
 
 $variableCache = array()
 
 $clearCacheOnParse = false
 
 $fileRoot = ''
 
 $flagBlocktrouble = false
 
 $flagGlobalParsed = false
 
 $flagCacheTemplatefile = true
 
 $lastTemplatefile = ''
 EXPERIMENTAL! FIXME! More...
 
 $_options
 $_options['preserve_data'] Whether to substitute variables and remove empty placeholders in data passed through setVariable (see also bugs #20199, #21951). More...
 
- Protected Member Functions inherited from ilTemplate
 init ()
 Clears all datafields of the object and rebuild the internal blocklist. More...
 
 getTemplatePath ($a_tplname, $a_in_module=false, $a_plugin=false)
 builds a full template path with template and module name More...
 
 init ()
 Clears all datafields of the object and rebuild the internal blocklist. More...
 
 init ()
 Clears all datafields of the object and rebuild the internal blocklist. More...
 
- Protected Attributes inherited from ilTemplate
 $il_use_cache
 
 $il_cur_key
 
 $tplName
 
 $tplPath
 
 $tplIdentifier
 
- Static Protected Attributes inherited from ilTemplate
static $il_cache = array()
 

Detailed Description

Definition at line 44 of file ilIndependentTemplate.php.

Member Function Documentation

◆ get()

ilIndependantTemplate::get (   $part = null)
Parameters
string
Returns
string

Reimplemented from ilTemplate.

Definition at line 115 of file ilIndependentTemplate.php.

116 {
117 if ($part === null) {
118 $part = "__global__";
119 }
120 if ($part == '__global__' && !$this->flagGlobalParsed) {
121 $this->parse('__global__');
122 }
123
124 if (!isset($this->blocklist[$part])) {
126 '"' . $block . "'"));
127 }
128
129 if (isset($this->blockdata[$part])) {
130 $ret = $this->blockdata[$part];
131 if ($this->clearCache) {
132 unset($this->blockdata[$part]);
133 }
134 if ($this->_options['preserve_data']) {
135 $ret = str_replace(
136 $this->openingDelimiter .
137 '%preserved%' . $this->closingDelimiter,
138 $this->openingDelimiter,
139 $ret
140 );
141 }
142 return $ret;
143 }
144
145 return '';
146 }
const IT_BLOCK_NOT_FOUND
Definition: IT.php:26
errorMessage($value, $blockname='')
Return a textual error message for a IT error code.
Definition: IT.php:993
parse($block='__global__', $flag_recursion=false)
Parses the given block.
Definition: IT.php:487
$ret
Definition: parser.php:6

References $ret, and IT_BLOCK_NOT_FOUND.

◆ getFile()

ilIndependantTemplate::getFile (   $filename)

Reads a file from disk and returns its content.

Copy from Service/PEAR/lib/HTML/Template/IT.php with GlobalCache-stuff removed.

Parameters
stringFilename
Returns
string Filecontent

Reimplemented from HTML_Template_IT.

Definition at line 55 of file ilIndependentTemplate.php.

56 {
57 if ($filename[0] == '/' && substr($this->fileRoot, -1) == '/') {
58 $filename = substr($filename, 1);
59 }
60
61 $filename = $this->fileRoot . $filename;
62
63 require_once('./Services/GlobalCache/classes/class.ilGlobalCache.php');
64 $this->real_filename = $filename;
65
66 if (!($fh = @fopen($filename, 'r'))) {
67 $this->err[] = PEAR::raiseError(
69 ': "' . $filename . '"',
71 );
72 return "";
73 }
74
75 $fsize = filesize($filename);
76 if ($fsize < 1) {
77 fclose($fh);
78 return '';
79 }
80
81 $content = fread($fh, $fsize);
82 fclose($fh);
83
84 return preg_replace_callback(
85 "#<!-- INCLUDE (.*) -->#im",
86 function ($hit) {
87 return $this->getFile($hit[1]);
88 },
89 $content
90 );
91 } // end func getFile
const IT_TPL_NOT_FOUND
Definition: IT.php:25
$filename
Definition: buildRTE.php:89
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object's de...
Definition: PEAR.php:522
getFile($filename)
Reads a file from disk and returns its content.

References $filename, IT_TPL_NOT_FOUND, and PEAR\raiseError().

+ Here is the call graph for this function:

◆ loadTemplatefile()

ilIndependantTemplate::loadTemplatefile (   $filename,
  $removeUnknownVariables = true,
  $removeEmptyBlocks = true 
)

Reads a template file from the disk.

unoverwrites IT:loadTemplateFile to deinclude the template input hook

Parameters
stringname of the template file
boolhow to handle unknown variables.
boolhow to handle empty blocks. @access public
Returns
boolean false on failure, otherwise true
See also
$template, setTemplate(), $removeUnknownVariables, $removeEmptyBlocks

Reimplemented from ilTemplate.

Definition at line 106 of file ilIndependentTemplate.php.

110 {
112 }
$removeEmptyBlocks
Definition: IT.php:202
$removeUnknownVariables
Definition: IT.php:195
loadTemplatefile( $filename, $removeUnknownVariables=true, $removeEmptyBlocks=true)
Reads a template file from the disk.
Definition: IT.php:780

References $filename, and HTML_Template_IT\loadTemplatefile().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: