ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTemplate Class Reference

special template class to simplify handling of ITX/PEAR More...

+ Inheritance diagram for ilTemplate:
+ Collaboration diagram for ilTemplate:

Public Member Functions

 __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)
 
- 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...
 

Data Fields

 $vars
 
 $activeBlock
 
- 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

 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

 $il_use_cache
 
 $il_cur_key
 
 $tplName
 
 $tplPath
 
 $tplIdentifier
 

Static Protected Attributes

static $il_cache = array()
 

Private Member Functions

 fillVars ()
 all template vars defined in $vars will be replaced automatically without setting and parsing them with setVariable & parseCurrentBlock @access private More...
 
 getTemplateIdentifier ($a_tplname, $a_in_module=false)
 get a unique template identifier More...
 

Detailed Description

special template class to simplify handling of ITX/PEAR

Author
Stefan Kesseler skess.nosp@m.eler.nosp@m.@data.nosp@m.bay..nosp@m.de
Sascha Hofmann shofm.nosp@m.ann@.nosp@m.datab.nosp@m.ay.d.nosp@m.e
Version
$Id$

Definition at line 13 of file class.ilTemplate.php.

Constructor & Destructor Documentation

◆ __construct()

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.

Parameters
string$filetemplate file
bool$flag1remove unknown variables
bool$flag2remove empty blocks
string$in_modulemodule/service subdirectory
string$varsvariables to replace
bool$pluginplugin template
bool$a_use_cacheus cache
Exceptions
ilTemplateException

Definition at line 71 of file class.ilTemplate.php.

79 {
80 $this->activeBlock = "__global__";
81 $this->vars = array();
82
83 $this->il_use_cache = $a_use_cache;
84 $this->il_cur_key = $file . "/" . $in_module;
85
86 $fname = $this->getTemplatePath($file, $in_module, $plugin);
87
88 $this->tplName = basename($fname);
89 $this->tplPath = dirname($fname);
90 $this->tplIdentifier = $this->getTemplateIdentifier($file, $in_module);
91
92 if (!file_exists($fname)) {
93 throw new \LogicException("Template '$fname' was not found.");
94 }
95
97 $this->loadTemplatefile($fname, $flag1, $flag2);
98 //add tplPath to replacevars
99 $this->vars["TPLPATH"] = $this->tplPath;
100
101 // Option for baseclass HTML_Template_IT
102 $this->setOption('use_preg', false);
103
104 return true;
105 }
setOption($option, $value)
Sets the option for the template class.
Definition: IT.php:399
loadTemplatefile( $filename, $removeUnknownVariables=true, $removeEmptyBlocks=true)
Reads a template file from the disk.
getTemplateIdentifier($a_tplname, $a_in_module=false)
get a unique template identifier
getTemplatePath($a_tplname, $a_in_module=false, $a_plugin=false)
builds a full template path with template and module name
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References XapiProxy\$plugin, $tplPath, ILIAS\GlobalScreen\Provider\__construct(), getTemplateIdentifier(), getTemplatePath(), loadTemplatefile(), and HTML_Template_IT\setOption().

+ Here is the call graph for this function:

Member Function Documentation

◆ addBlockFile()

ilTemplate::addBlockFile (   $var,
  $block,
  $tplname,
  $in_module = false 
)

overwrites ITX::addBlockFile @access public

Parameters
string
string
string$tplnametemplate name
boolean$in_moduleshould be set to true, if template file is in module subdirectory
Returns
boolean/string

Definition at line 279 of file class.ilTemplate.php.

280 {
281 global $DIC;
282
283 if (DEBUG) {
284 echo "<br/>Template '" . $this->tplPath . "/" . $tplname . "'";
285 }
286
287 $tplfile = $this->getTemplatePath($tplname, $in_module);
288 if (file_exists($tplfile) == false) {
289 echo "<br/>Template '" . $tplfile . "' doesn't exist! aborting...";
290 return false;
291 }
292
293 $id = $this->getTemplateIdentifier($tplname, $in_module);
294 $template = $this->getFile($tplfile);
295
296 // include the template input hook
297 $ilPluginAdmin = $DIC["ilPluginAdmin"];
298 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
299 foreach ($pl_names as $pl) {
300 $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
301 $gui_class = $ui_plugin->getUIClassInstance();
302
303 $resp = $gui_class->getHTML(
304 "",
305 "template_add",
306 array("tpl_id" => $id, "tpl_obj" => $this, "html" => $template)
307 );
308
309 if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
310 $template = $gui_class->modifyHTML($template, $resp);
311 }
312 }
313
314 return $this->addBlock($var, $block, $template);
315 }
addBlock($placeholder, $blockname, $template)
Adds a block to the template changing a variable placeholder to a block placeholder.
Definition: ITX.php:241
getFile($filename)
Reads a file from disk and returns its content.
Definition: IT.php:914
const IL_COMP_SERVICE
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get Plugin Object.
global $DIC
Definition: goto.php:24

References $DIC, XapiProxy\$resp, HTML_Template_IT\$template, HTML_Template_ITX\addBlock(), HTML_Template_IT\getFile(), ilPluginAdmin\getPluginObject(), getTemplateIdentifier(), getTemplatePath(), IL_COMP_SERVICE, and ilUIHookPluginGUI\KEEP.

+ Here is the call graph for this function:

◆ blockExists()

ilTemplate::blockExists (   $a_blockname)

check if block exists in actual template @access private

Parameters
stringblockname
Returns
boolean

Reimplemented from HTML_Template_ITX.

Definition at line 154 of file class.ilTemplate.php.

155 {
156 // added second evaluation to the return statement because the first one only works for the content block (Helmut Schottmüller, 2007-09-14)
157 return (isset($this->blockvariables["content"][$a_blockname]) ? true : false) | (isset($this->blockvariables[$a_blockname]) ? true : false);
158 }
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.

References true.

Referenced by ilTinyMCE\handleImgContextMenuItem().

+ Here is the caller graph for this function:

◆ fillVars()

ilTemplate::fillVars ( )
private

all template vars defined in $vars will be replaced automatically without setting and parsing them with setVariable & parseCurrentBlock @access private

Returns
integer

Definition at line 323 of file class.ilTemplate.php.

324 {
325 $count = 0;
326 reset($this->vars);
327
328 foreach ($this->vars as $key => $val) {
329 if (is_array($this->blockvariables[$this->activeBlock])) {
330 if (array_key_exists($key, $this->blockvariables[$this->activeBlock])) {
331 $count++;
332
333 $this->setVariable($key, $val);
334 }
335 }
336 }
337
338 return $count;
339 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:615

References HTML_Template_IT\setVariable().

Referenced by parseCurrentBlock(), and touchBlock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get()

ilTemplate::get (   $part = "DEFAULT")
Parameters
string
Returns
string

Reimplemented from HTML_Template_IT.

Reimplemented in ilIndependantTemplate.

Definition at line 164 of file class.ilTemplate.php.

165 {
166 global $DIC;
167
168 $html = $this->getUnmodified($part);
169
170 // include the template output hook
171 $ilPluginAdmin = $DIC["ilPluginAdmin"];
172 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
173 foreach ($pl_names as $pl) {
174 $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
175 $gui_class = $ui_plugin->getUIClassInstance();
176
177 $resp = $gui_class->getHTML(
178 "",
179 "template_get",
180 array("tpl_id" => $this->tplIdentifier, "tpl_obj" => $this, "html" => $html)
181 );
182
183 if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
184 $html = $gui_class->modifyHTML($html, $resp);
185 }
186 }
187
188 return $html;
189 }
getUnmodified($part="DEFAULT")

References $DIC, XapiProxy\$resp, ilPluginAdmin\getPluginObject(), getUnmodified(), IL_COMP_SERVICE, and ilUIHookPluginGUI\KEEP.

+ Here is the call graph for this function:

◆ getTemplateIdentifier()

ilTemplate::getTemplateIdentifier (   $a_tplname,
  $a_in_module = false 
)
private

get a unique template identifier

The identifier is common for default or customized skins but distincts templates of different services with the same name.

This is used by the UI plugin hook for template input/output

Parameters
string$a_tplnametemplate name
string$in_moduleComponent, e.g. "Modules/Forum" boolean $in_module or true, if component should be determined by ilCtrl
Returns
string template identifier, e.g. "tpl.confirm.html"

Definition at line 482 of file class.ilTemplate.php.

483 {
484 global $DIC;
485
486 $ilCtrl = null;
487 if (isset($DIC["ilCtrl"])) {
488 $ilCtrl = $DIC->ctrl();
489 }
490
491
492 // if baseClass functionality is used (ilias.php):
493 // get template directory from ilCtrl
494 if (!empty($_GET["baseClass"]) && $a_in_module === true) {
495 $a_in_module = $ilCtrl->getModuleDir();
496 }
497
498 if (strpos($a_tplname, "/") === false) {
499 if ($a_in_module) {
500 if ($a_in_module === true) {
501 $module_path = ILIAS_MODULE . "/";
502 } else {
503 $module_path = $a_in_module . "/";
504 }
505 } else {
506 $module_path = "";
507 }
508
509 return $module_path . basename($a_tplname);
510 } else {
511 return $a_tplname;
512 }
513 }
$_GET["client_id"]
const ILIAS_MODULE
Definition: server.php:14

References $_GET, $DIC, and ILIAS_MODULE.

Referenced by __construct(), and addBlockFile().

+ Here is the caller graph for this function:

◆ getTemplatePath()

ilTemplate::getTemplatePath (   $a_tplname,
  $a_in_module = false,
  $a_plugin = false 
)
protected

builds a full template path with template and module name

Parameters
string$a_tplnametemplate name
boolean$in_moduleshould be set to true, if template file is in module subdirectory
Returns
string full template path

Definition at line 409 of file class.ilTemplate.php.

410 {
411 global $DIC;
412
413 $ilCtrl = null;
414 if (isset($DIC["ilCtrl"])) {
415 $ilCtrl = $DIC->ctrl();
416 }
417
418 $fname = "";
419
420 if (strpos($a_tplname, "/") === false) {
421 $module_path = "";
422
423 if ($a_in_module != "") {
424 $module_path = $a_in_module . "/";
425 }
426
427 // use ilStyleDefinition instead of account to get the current skin
428 include_once "Services/Style/System/classes/class.ilStyleDefinition.php";
429 if (ilStyleDefinition::getCurrentSkin() != "default") {
431
432 $fname = "./Customizing/global/skin/" .
433 ilStyleDefinition::getCurrentSkin() . "/" . $style . "/" . $module_path
434 . basename($a_tplname);
435
436 if ($fname == "" || !file_exists($fname)) {
437 $fname = "./Customizing/global/skin/" .
438 ilStyleDefinition::getCurrentSkin() . "/" . $module_path . basename($a_tplname);
439 }
440 }
441
442 if ($fname == "" || !file_exists($fname)) {
443 $fname = "./" . $module_path . "templates/default/" . basename($a_tplname);
444 }
445 } elseif (strpos($a_tplname, "src/UI") === 0) {
446 if (class_exists("ilStyleDefinition") // for testing
447 && ilStyleDefinition::getCurrentSkin() != "default") {
450 $base_path = "./Customizing/global/skin/";
451 $ui_path = "/" . str_replace("src/UI/templates/default", "UI", $a_tplname);
452 $fname = $base_path . ilStyleDefinition::getCurrentSkin() . "/" . $style . "/" . $ui_path;
453
454 if (!file_exists($fname)) {
455 $fname = $base_path . $skin . "/" . $ui_path;
456 }
457 }
458
459 if ($fname == "" || !file_exists($fname)) {
460 $fname = $a_tplname;
461 }
462 } else {
463 $fname = $a_tplname;
464 }
465 return $fname;
466 }
static getCurrentSkin()
get the current skin
static getCurrentStyle()
get the current style or sub style

References $DIC, ilStyleDefinition\getCurrentSkin(), and ilStyleDefinition\getCurrentStyle().

Referenced by __construct(), and addBlockFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUnmodified()

ilTemplate::getUnmodified (   $part = "DEFAULT")
Parameters
string
Returns
string

Definition at line 195 of file class.ilTemplate.php.

196 {
197 global $DIC;
198
199 if ($part == "DEFAULT") {
200 return parent::get();
201 }
202 return parent::get($part);
203 }
get(string $class_name)

References $DIC, and ILIAS\GlobalScreen\get().

Referenced by get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

ilTemplate::init ( )
protected

Clears all datafields of the object and rebuild the internal blocklist.

LoadTemplatefile() and setTemplate() automatically call this function when a new template is given. Don't use this function unless you know what you're doing.

@access public

See also
free()

Reimplemented from HTML_Template_ITX.

Definition at line 108 of file class.ilTemplate.php.

109 {
110 $this->free();
111 $this->buildFunctionlist();
112
113 $cache_hit = false;
114 if ($this->il_use_cache) {
115 // cache hit
116 if (isset(self::$il_cache[$this->il_cur_key]) && is_array(self::$il_cache[$this->il_cur_key])) {
117 $cache_hit = true;
118 //echo "cache hit";
119 $this->err = self::$il_cache[$this->il_cur_key]["err"];
120 $this->flagBlocktrouble = self::$il_cache[$this->il_cur_key]["flagBlocktrouble"];
121 $this->blocklist = self::$il_cache[$this->il_cur_key]["blocklist"];
122 $this->blockdata = self::$il_cache[$this->il_cur_key]["blockdata"];
123 $this->blockinner = self::$il_cache[$this->il_cur_key]["blockinner"];
124 $this->blockparents = self::$il_cache[$this->il_cur_key]["blockparents"];
125 $this->blockvariables = self::$il_cache[$this->il_cur_key]["blockvariables"];
126 }
127 }
128
129 if (!$cache_hit) {
130 $this->findBlocks($this->template);
131 $this->template = '';
132 $this->buildBlockvariablelist();
133 if ($this->il_use_cache) {
134 self::$il_cache[$this->il_cur_key]["err"] = $this->err;
135 self::$il_cache[$this->il_cur_key]["flagBlocktrouble"] = $this->flagBlocktrouble;
136 self::$il_cache[$this->il_cur_key]["blocklist"] = $this->blocklist;
137 self::$il_cache[$this->il_cur_key]["blockdata"] = $this->blockdata;
138 self::$il_cache[$this->il_cur_key]["blockinner"] = $this->blockinner;
139 self::$il_cache[$this->il_cur_key]["blockparents"] = $this->blockparents;
140 self::$il_cache[$this->il_cur_key]["blockvariables"] = $this->blockvariables;
141 }
142 }
143
144 // we don't need it any more
145 $this->template = '';
146 } // end func init
buildFunctionlist()
Builds a functionlist from the template.
Definition: ITX.php:591
findBlocks($string)
Recusively builds a list of all blocks within the template.
Definition: IT.php:865
free()
Clears all datafields of the object.
Definition: IT.php:716
buildBlockvariablelist()
Build a list of all variables within of a block.
Definition: IT.php:824

References HTML_Template_IT\$blockdata, HTML_Template_IT\$blockinner, HTML_Template_IT\$blocklist, HTML_Template_IT\$blockparents, HTML_Template_IT\$blockvariables, HTML_Template_IT\$err, HTML_Template_IT\$flagBlocktrouble, $il_cur_key, HTML_Template_IT\buildBlockvariablelist(), HTML_Template_ITX\buildFunctionlist(), HTML_Template_IT\findBlocks(), and HTML_Template_IT\free().

+ Here is the call graph for this function:

◆ loadTemplatefile()

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

Reads a template file from the disk.

overwrites IT:loadTemplateFile to include 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 HTML_Template_IT.

Reimplemented in ilIndependantTemplate.

Definition at line 354 of file class.ilTemplate.php.

358 {
359 global $DIC;
360
361 // copied from IT:loadTemplateFile
362 $template = '';
363 if (!$this->flagCacheTemplatefile ||
364 $this->lastTemplatefile != $filename
365 ) {
366 $template = $this->getFile($filename);
367 }
368 $this->lastTemplatefile = $filename;
369 // copied.
370
371 // new code to include the template input hook:
372 $ilPluginAdmin = $DIC["ilPluginAdmin"];
373 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
374 foreach ($pl_names as $pl) {
375 $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
376 $gui_class = $ui_plugin->getUIClassInstance();
377
378 $resp = $gui_class->getHTML(
379 "",
380 "template_load",
381 array("tpl_id" => $this->tplIdentifier, "tpl_obj" => $this, "html" => $template)
382 );
383
384 if ($resp["mode"] != ilUIHookPluginGUI::KEEP) {
385 $template = $gui_class->modifyHTML($template, $resp);
386 }
387 }
388 // new.
389
390 // copied from IT:loadTemplateFile
391 return $template != '' ?
392 $this->setTemplate(
393 $template,
396 ) : false;
397 // copied.
398 }
$filename
Definition: buildRTE.php:89
$removeEmptyBlocks
Definition: IT.php:202
$removeUnknownVariables
Definition: IT.php:195
setTemplate( $template, $removeUnknownVariables=true, $removeEmptyBlocks=true)
Sets the template.
Definition: IT.php:743

References $DIC, $filename, HTML_Template_IT\$removeEmptyBlocks, HTML_Template_IT\$removeUnknownVariables, XapiProxy\$resp, HTML_Template_IT\$template, HTML_Template_IT\getFile(), ilPluginAdmin\getPluginObject(), IL_COMP_SERVICE, ilUIHookPluginGUI\KEEP, and HTML_Template_IT\setTemplate().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseCurrentBlock()

ilTemplate::parseCurrentBlock (   $part = "DEFAULT")

Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt @access public.

Parameters
string
Returns
string

Definition at line 247 of file class.ilTemplate.php.

248 {
249 // Hier erst noch ein replace aufrufen
250 if ($part != "DEFAULT") {
251 $tmp = $this->activeBlock;
252 $this->activeBlock = $part;
253 }
254
255 if ($part != "DEFAULT") {
256 $this->activeBlock = $tmp;
257 }
258
259 $this->fillVars();
260
261 $this->activeBlock = "__global__";
262
263 if ($part == "DEFAULT") {
264 return parent::parseCurrentBlock();
265 } else {
266 return parent::parseCurrentBlock($part);
267 }
268 }
fillVars()
all template vars defined in $vars will be replaced automatically without setting and parsing them wi...

References $activeBlock, and fillVars().

Referenced by ilContainerRenderer\addHeaderRow(), ilContainerRenderer\addSeparatorRow(), ilContainerRenderer\addStandardRow(), ilCalendarBlockGUI\addSubscriptionButton(), ilChatroomAuthInputGUI\insert(), ilOrgUnitAuthorityInputGUI\insert(), ilCaptchaInputGUI\insert(), ilEMailInputGUI\insert(), ilClozeGapInputBuilderGUI\insert(), ilContainerRenderer\renderDetails(), ilContainerRenderer\renderHelperGeneric(), ilSurveyPageGUI\renderPageNode(), and ilContainerRenderer\renderSelectAllBlock().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCurrentBlock()

ilTemplate::setCurrentBlock (   $part = "DEFAULT")

Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.

@access public

Parameters
string
Returns
???

Reimplemented from HTML_Template_IT.

Definition at line 213 of file class.ilTemplate.php.

214 {
215 $this->activeBlock = $part;
216
217 if ($part == "DEFAULT") {
218 return parent::setCurrentBlock();
219 } else {
220 return parent::setCurrentBlock($part);
221 }
222 }

Referenced by ilContainerRenderer\addHeaderRow(), ilContainerRenderer\addSeparatorRow(), ilContainerRenderer\addStandardRow(), ilCalendarBlockGUI\addSubscriptionButton(), ilChatroomAuthInputGUI\insert(), ilOrgUnitAuthorityInputGUI\insert(), ilCaptchaInputGUI\insert(), ilEMailInputGUI\insert(), ilClozeGapInputBuilderGUI\insert(), ilContainerRenderer\renderDetails(), ilContainerRenderer\renderHelperGeneric(), ilSurveyPageGUI\renderPageNode(), ilContainerRenderer\renderSelectAllBlock(), and touchBlock().

+ Here is the caller graph for this function:

◆ touchBlock()

ilTemplate::touchBlock (   $block)

overwrites ITX::touchBlock.

@access public

Parameters
string
Returns
???

Reimplemented from HTML_Template_IT.

Definition at line 230 of file class.ilTemplate.php.

231 {
232 $this->setCurrentBlock($block);
233 $count = $this->fillVars();
234 $this->parseCurrentBlock();
235
236 if ($count == 0) {
237 parent::touchBlock($block);
238 }
239 }
parseCurrentBlock()
Parses the current block.
Definition: IT.php:596
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.

References fillVars(), HTML_Template_IT\parseCurrentBlock(), and setCurrentBlock().

Referenced by ilContainerRenderer\addHeaderRow(), ilContainerRenderer\addStandardRow(), and ilSurveyPageGUI\renderPageNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ variableExists()

ilTemplate::variableExists (   $a_variablename)

Definition at line 515 of file class.ilTemplate.php.

516 {
517 return (isset($this->blockvariables["content"][$a_variablename]) ? true : false);
518 }

Field Documentation

◆ $activeBlock

ilTemplate::$activeBlock

Definition at line 27 of file class.ilTemplate.php.

Referenced by parseCurrentBlock().

◆ $il_cache

ilTemplate::$il_cache = array()
staticprotected

Definition at line 32 of file class.ilTemplate.php.

◆ $il_cur_key

ilTemplate::$il_cur_key
protected

Definition at line 42 of file class.ilTemplate.php.

Referenced by init().

◆ $il_use_cache

ilTemplate::$il_use_cache
protected

Definition at line 37 of file class.ilTemplate.php.

◆ $tplIdentifier

ilTemplate::$tplIdentifier
protected

Definition at line 57 of file class.ilTemplate.php.

◆ $tplName

ilTemplate::$tplName
protected

Definition at line 47 of file class.ilTemplate.php.

◆ $tplPath

ilTemplate::$tplPath
protected

Definition at line 52 of file class.ilTemplate.php.

Referenced by __construct().

◆ $vars

ilTemplate::$vars

Definition at line 19 of file class.ilTemplate.php.


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