ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilIndependentTemplate Class Reference
+ Inheritance diagram for ilIndependentTemplate:
+ Collaboration diagram for ilIndependentTemplate:

Public Member Functions

 __construct ( $file, $flag1, $flag2, $in_module=false, $vars="DEFAULT", $plugin=false, $a_use_cache=true)
 
 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 ($block=null)
 Get the rendered template or a specific block. More...
 
- Public Member Functions inherited from ilTemplate
 __construct ( $file, $flag1, $flag2, $in_module=false, $vars="DEFAULT", $plugin=false, $a_use_cache=true)
 constructor More...
 
 init ()
 
 setAddFooter ($value)
 
 getAddFooter ()
 
 getAsynch ()
 Use this for final get before sending asynchronous output (ajax) per echo to output. More...
 
 get ( $part="DEFAULT", $add_error_mess=false, $handle_referer=false, $add_ilias_footer=false, $add_standard_elements=false, $a_main_menu=true, $a_tabs=true)
 ??? public More...
 
 setMessage ($a_type, $a_txt, $a_keep=false)
 Set message. More...
 
 hasMessage ($a_type)
 
 fillMessage ()
 
 getMessageHTML ($a_txt, $a_type="info")
 Get HTML for a system message. More...
 
 getContentType ()
 Get the content type for the template output. More...
 
 setContentType ($a_content_type="text/html")
 Set the content type for the template output. More...
 
 show ($part="DEFAULT", $a_fill_tabs=true, $a_skip_main_menu=false)
 
 fillContentLanguage ()
 Add current user language to meta tags. More...
 
 fillWindowTitle ()
 
 getTabsHTML ()
 Get tabs HTML. More...
 
 fillTabs ()
 
 fillToolbar ()
 
 fillPageFormAction ()
 
 fillJavaScriptFiles ($a_force=false)
 
 fillCssFiles ($a_force=false)
 Fill in the css file tags. More...
 
 fillInlineCss ()
 Fill in the inline css. More...
 
 setContentStyleSheet ($a_style)
 Set content style (used for page content editor) More...
 
 fillContentStyle ()
 Fill Content Style. More...
 
 getMainMenu ()
 
 fillMainMenu ()
 
 initHelp ()
 Init help. More...
 
 addILIASFooter ()
 add ILIAS footer More...
 
 handleReferer ()
 TODO: this is nice, but shouldn't be done here (-> maybe at the end of ilias.php!?, alex) More...
 
 blockExists ($a_blockname)
 check if block exists in actual template private More...
 
 fillVars ()
 all template vars defined in $vars will be replaced automatically without setting and parsing them with setVariable & parseCurrentBlock private 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 public. More...
 
 replaceFromDatabase (&$DB, $block, $conv, $select="default")
 ??? TODO: Adjust var names to ilias. More...
 
 prepareForFormular ($vars)
 Wird angewendet, wenn die Daten in ein Formular replaced werden sollen, Dann wird erst noch ein htmlspecialchars drumherum gemacht. More...
 
 replace ()
 ??? public More...
 
 replaceDefault ()
 ??? public More...
 
 checkTopic ($a_block, $a_topic)
 checks for a topic in the template private More...
 
 includeNavigation ()
 check if there is a NAVIGATION-topic public More...
 
 includeTree ()
 check if there is a TREE-topic public More...
 
 fileExists ($filename)
 check if a file exists public More...
 
 addBlockFile ($var, $block, $tplname, $in_module=false)
 overwrites ITX::addBlockFile public More...
 
 loadTemplatefile ( $filename, $removeUnknownVariables=true, $removeEmptyBlocks=true)
 Reads a template file from the disk. More...
 
 getTemplatePath ($a_tplname, $a_in_module=false, $a_plugin=false)
 builds a full template path with template and module name More...
 
 getTemplateIdentifier ($a_tplname, $a_in_module=false)
 get a unique template identifier More...
 
 setHeaderPageTitle ($a_title)
 
 setStyleSheetLocation ($a_stylesheet)
 
 setNewContentStyleSheetLocation ($a_stylesheet)
 
 getStandardTemplate ()
 
 setTitle ($a_title)
 sets title in standard template More...
 
 setTitleUrl ($a_url)
 sets title url in standard template More...
 
 setTitleColor ($a_val)
 Set title color. More...
 
 getTitleColor ()
 Get title color. More...
 
 setAlertProperties (array $a_props)
 Set alert properties. More...
 
 clearHeader ()
 Clear header. More...
 
 setTitleIcon ($a_icon_path, $a_icon_desc="")
 set title icon More...
 
 setBodyClass ($a_class="")
 
 fillBodyClass ()
 
 setPageFormAction ($a_action)
 
 setDescription ($a_descr)
 sets title in standard template More...
 
 stopTitleFloating ()
 set stop floating (if no tabs are used) More...
 
 setHeaderActionMenu ($a_header)
 Set header action menu. More...
 
 getHeaderActionMenu ()
 Get header action menu. More...
 
 setContent ($a_html)
 sets content for standard template More...
 
 fillMainContent ()
 Fill main content. More...
 
 setRightContent ($a_html)
 sets content of right column More...
 
 setLeftContent ($a_html)
 sets content of left column More...
 
 setLeftNavContent ($a_content)
 Sets content of left navigation column. More...
 
 fillLeftNav ()
 Fill left navigation frame. 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...
 
 setUpperIcon ($a_link, $a_frame="")
 sets icon to upper level More...
 
 setLoginTargetPar ($a_val)
 Set target parameter for login (public sector). More...
 
 getLoginTargetPar ()
 Get target parameter for login. More...
 
 fillScreenReaderFocus ()
 Accessibility focus for screen readers. More...
 
 fillSideIcons ()
 Fill side icons (upper icon, tree icon, webfolder icon) More...
 
 setMountWebfolderIcon ($a_ref_id)
 shows icon for mounting a webfolder More...
 
 setTreeFlatIcon ($a_link, $a_mode)
 set tree/flat icon 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...
 
 resetJavascript ()
 Reset javascript files. More...
 
 resetCss ()
 Reset css files. More...
 
 addOnLoadCode ($a_code, $a_batch=2)
 Add on load code. More...
 
 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...
 
 addLightbox ($a_html, $a_id)
 Add lightbox html. More...
 
 fillLightbox ()
 Fill lightbox content. More...
 
 setPageActions ($a_page_actions_html)
 Show admin view button. More...
 
 setEditPageButton ($a_link, $a_txt, $a_frame)
 Show admin view button. More...
 
 addAdminPanelCommand ($a_cmd, $a_txt, $a_arrow=false)
 Add a command to the admin panel. More...
 
 addAdminPanelToolbar (ilToolbarGUI $toolb, $a_bottom_panel=true, $a_arrow=false)
 Add admin panel commands as toolbar. More...
 
 fillAdminPanel ()
 Put admin panel into template: More...
 
 setPermanentLink ($a_type, $a_id, $a_append="", $a_target="", $a_title="")
 
 fillPermanentLink ()
 Fill in permanent link. More...
 
 fillOnLoadCode ()
 Fill add on load code. More...
 
 getOnLoadCodeForAsynch ()
 Get js onload code for ajax calls. More...
 
 setBackgroundColor ($a_bg_color)
 
 setBanner ($a_img, $a_width=1370, $a_height=100, $a_export=false)
 Set banner. More...
 
 resetHeaderBlock ($a_reset_header_action=true)
 Set variable. More...
 
 enableDragDropFileUpload ($a_ref_id)
 Enables the file upload into this object by dropping a file. More...
 
 __construct ($file, $flag1, $flag2, $in_module=false, $vars="DEFAULT")
 constructor 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)
 
 show ($part="DEFAULT")
 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 public. More...
 
 setMessage ($a_type, $a_txt, $a_keep=false)
 Set message. More...
 
 fillMessage ()
 
 blockExists ($a_blockname)
 check if block exists in actual template private More...
 
 addJavaScript ($a_js_file)
 Add a javascript file that should be included in the header. More...
 
 fillJavaScriptFiles ()
 
 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")
 
- Public Member Functions inherited from HTML_Template_ITX
 __construct ($root='')
 Builds some complex regexps and calls the constructor of the parent class. More...
 
 init ()
 
 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...
 
 init ()
 Clears all datafields of the object and rebuild the internal blocklist. 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 ILIAS\UI\Implementation\Render\Template
 setCurrentBlock ($name)
 Set the block to work on. More...
 
 parseCurrentBlock ()
 Parse the block that is currently worked on. More...
 
 touchBlock ($name)
 Touch a block without working further on it. More...
 
 setVariable ($name, $value)
 Set a variable in the current block. More...
 
 addOnLoadCode ($code)
 Add some javascript to be executed on_load of the rendered page. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTemplate
static buildLoginTarget ()
 Add current object (repository/workspace) as target for login url. More...
 
- Data Fields inherited from ilTemplate
const MESSAGE_TYPE_FAILURE = 'failure'
 
const MESSAGE_TYPE_INFO = "info"
 
const MESSAGE_TYPE_SUCCESS = "success"
 
const MESSAGE_TYPE_QUESTION = "question"
 
 $contenttype
 
 $vars
 
 $activeBlock
 
 $js_files = array(0 => "./Services/JavaScript/js/Basic.js")
 
 $js_files_vp = array("./Services/JavaScript/js/Basic.js" => true)
 
 $js_files_batch = array("./Services/JavaScript/js/Basic.js" => 1)
 
 $css_files = array()
 
 $inline_css = array()
 
 $admin_panel_commands = 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()
 
 $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
 fillJavascriptFile ($file, $vers)
 
- Protected Attributes inherited from ilTemplate
 $tpl
 
 $message = array()
 
 $title_desc = ""
 
 $title_url = ""
 
 $upper_icon = ""
 
 $tree_flat_link = ""
 
 $mount_webfolder = ""
 
 $stop_floating = ""
 
 $page_form_action = ""
 
 $page_actions = array()
 
 $permanent_link = false
 
 $content_style_sheet = ""
 
 $title_alerts = array()
 
 $header_action
 
 $lightbox = array()
 
 $standard_template_loaded = false
 
 $translation_linked = false
 
- Static Protected Attributes inherited from ilTemplate
static $message_types
 
static $il_cache = array()
 

Detailed Description

Definition at line 12 of file ilIndependentTemplate.php.

Constructor & Destructor Documentation

◆ __construct()

ilIndependentTemplate::__construct (   $file,
  $flag1,
  $flag2,
  $in_module = false,
  $vars = "DEFAULT",
  $plugin = false,
  $a_use_cache = true 
)

Definition at line 14 of file ilIndependentTemplate.php.

References $file, and ilTemplate\$vars.

22  {
23  parent::__construct($file, $flag1, $flag2, $in_module, $vars, $plugin, false);
24  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file

Member Function Documentation

◆ get()

ilIndependentTemplate::get (   $block = null)

Get the rendered template or a specific block.

Parameters
string | null$block
Returns
string

Implements ILIAS\UI\Implementation\Render\Template.

Definition at line 95 of file ilIndependentTemplate.php.

References $ret, HTML_Template_IT\errorMessage(), IT_BLOCK_NOT_FOUND, and HTML_Template_IT\parse().

96  {
97  if ($block === null) {
98  $block = "__global__";
99  }
100  if ($block == '__global__' && !$this->flagGlobalParsed) {
101  $this->parse('__global__');
102  }
103 
104  if (!isset($this->blocklist[$block])) {
106  '"' . $block . "'"));
107  }
108 
109  if (isset($this->blockdata[$block])) {
110  $ret = $this->blockdata[$block];
111  if ($this->clearCache) {
112  unset($this->blockdata[$block]);
113  }
114  if ($this->_options['preserve_data']) {
115  $ret = str_replace(
116  $this->openingDelimiter .
117  '%preserved%' . $this->closingDelimiter,
118  $this->openingDelimiter,
119  $ret
120  );
121  }
122  return $ret;
123  }
124 
125  return '';
126  }
errorMessage($value, $blockname='')
Return a textual error message for a IT error code.
Definition: IT.php:991
const IT_BLOCK_NOT_FOUND
Definition: IT.php:26
parse($block='__global__', $flag_recursion=false)
Parses the given block.
Definition: IT.php:485
$ret
Definition: parser.php:6
+ Here is the call graph for this function:

◆ getFile()

ilIndependentTemplate::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

Definition at line 35 of file ilIndependentTemplate.php.

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

36  {
37  if ($filename{0} == '/' && substr($this->fileRoot, -1) == '/') {
38  $filename = substr($filename, 1);
39  }
40 
41  $filename = $this->fileRoot . $filename;
42 
43  require_once('./Services/GlobalCache/classes/class.ilGlobalCache.php');
44  $this->real_filename = $filename;
45 
46  if (!($fh = @fopen($filename, 'r'))) {
47  $this->err[] = PEAR::raiseError(
49  ': "' . $filename . '"',
51  );
52  return "";
53  }
54 
55  $fsize = filesize($filename);
56  if ($fsize < 1) {
57  fclose($fh);
58  return '';
59  }
60 
61  $content = fread($fh, $fsize);
62  fclose($fh);
63 
64  return preg_replace_callback(
65  "#<!-- INCLUDE (.*) -->#im",
66  function ($hit) {
67  return $this->getFile($hit[1]);
68  },
69  $content
70  );
71  } // end func getFile
errorMessage($value, $blockname='')
Return a textual error message for a IT error code.
Definition: IT.php:991
getFile($filename)
Reads a file from disk and returns its content.
& 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&#39;s de...
Definition: PEAR.php:522
const IT_TPL_NOT_FOUND
Definition: IT.php:25
+ Here is the call graph for this function:

◆ loadTemplatefile()

ilIndependentTemplate::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. public
Returns
boolean false on failure, otherwise true
See also
$template, setTemplate(), $removeUnknownVariables, $removeEmptyBlocks

Definition at line 86 of file ilIndependentTemplate.php.

References $filename, HTML_Template_IT\$removeEmptyBlocks, HTML_Template_IT\$removeUnknownVariables, and HTML_Template_IT\loadTemplatefile().

90  {
92  }
loadTemplatefile( $filename, $removeUnknownVariables=true, $removeEmptyBlocks=true)
Reads a template file from the disk.
Definition: IT.php:778
$removeUnknownVariables
Definition: IT.php:195
$removeEmptyBlocks
Definition: IT.php:202
+ Here is the call graph for this function:

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