49 $this->activeBlock =
"__global__";
50 $this->vars = array();
54 $this->tplName = basename($fname);
55 $this->tplPath = dirname($fname);
57 $this->contenttype =
"text/html";
58 if (!file_exists($fname))
60 die(
"template ".$fname.
" was not found.");
69 $this->vars[
"TPLPATH"] = $this->tplPath;
72 if (method_exists($this,
"setOption"))
94 if (!empty(
$_GET[
"baseClass"]) && $a_in_module ===
true)
96 $a_in_module = $ilCtrl->getModuleDir();
99 if (strpos($a_tplname,
"/") ===
false)
106 if ($a_in_module ===
true)
112 $module_path = $a_in_module.
"/";
116 if($fname ==
"" || !file_exists($fname))
118 if ($a_in_module ==
"setup")
120 $fname =
"./".$module_path.
"templates/".basename($a_tplname);
124 $fname =
"./".$module_path.
"templates/default/".basename($a_tplname);
140 echo
"<br/>Template '".$this->tplPath.
"/".$tplname.
"'";
144 if (file_exists($tplfile) ==
false)
146 echo
"<br/>Template '".$tplfile.
"' doesn't exist! aborting...";
150 return parent::addBlockFile($var, $block, $tplfile);
157 function show($part =
"DEFAULT")
159 header(
'Content-type: text/html; charset=UTF-8');
165 $ms = array(
"info",
"success",
"failure",
"question");
170 if ($m ==
"question")
172 $m =
"mess_question";
177 : $this->message[$m];
179 if ($m ==
"mess_question")
189 if ($m ==
"question")
191 $m =
"mess_question";
205 if ($part ==
"DEFAULT")
214 if (((substr(strrchr($_SERVER[
"PHP_SELF"],
"/"),1) !=
"error.php")
215 && (substr(strrchr($_SERVER[
"PHP_SELF"],
"/"),1) !=
"adm_menu.php")))
221 $url_parts = parse_url($_SERVER[
"REQUEST_URI"]);
224 $protocol = (isset($_SERVER[
'HTTPS']) ?
'https' :
'http').
'://';
225 $host = $_SERVER[
'HTTP_HOST'];
226 $path = $_SERVER[
'REQUEST_URI'];
227 $url_parts = @parse_url($protocol.$host.$path);
230 if (preg_match(
"/cmd=gateway/",$url_parts[
"query"]))
232 foreach (
$_POST as $key => $val)
239 $str .=
"&".$key.
"=".$val;
243 preg_replace(
"/cmd=gateway/",substr($str,1),$_SERVER[
"REQUEST_URI"]));
245 (
int)
$_GET[
'ref_id']);
251 (
int)
$_GET[
'ref_id']);
265 $mtpl =
new ilTemplate(
"tpl.message.html",
true,
true,
"Services/Utilities");
266 $mtpl->setCurrentBlock($a_type.
"_message");
267 $mtpl->setVariable(
"TEXT", $a_txt);
268 $mtpl->setVariable(
"MESSAGE_HEADING", $lng->txt($a_type.
"_message"));
269 $mtpl->parseCurrentBlock();
282 $this->activeBlock = $part;
284 if ($part ==
"DEFAULT")
286 return parent::setCurrentBlock();
290 return parent::setCurrentBlock($part);
308 parent::touchBlock($block);
321 if ($part !=
"DEFAULT")
324 $this->activeBlock = $part;
327 if ($part !=
"DEFAULT")
329 $this->activeBlock = $tmp;
334 $this->activeBlock =
"__global__";
336 if ($part ==
"DEFAULT")
338 return parent::parseCurrentBlock();
342 return parent::parseCurrentBlock($part);
351 if (!in_array($a_type, array(
"info",
"success",
"failure",
"question")) || $a_txt ==
"")
355 if ($a_type ==
"question")
357 $a_type =
"mess_question";
361 $this->message[$a_type] = $a_txt;
373 $ms = array(
"info",
"success",
"failure",
"question");
378 if ($m ==
"question")
380 $m =
"mess_question";
385 : $this->message[$m];
387 if ($m ==
"mess_question")
394 $mtpl =
new ilTemplate(
"tpl.message.html",
true,
true,
"Services/Utilities");
395 $mtpl->setCurrentBlock($m.
"_message");
396 $mtpl->setVariable(
"TEXT",
$txt);
397 $mtpl->setVariable(
"MESSAGE_HEADING", $lng->txt($m.
"_message"));
398 $mtpl->parseCurrentBlock();
402 if ($m ==
"question")
404 $m =
"mess_question";
428 return (isset($this->blockvariables[
"content"][$a_blockname]) ?
true :
false) | (isset($this->blockvariables[$a_blockname]) ? true :
false);
436 if (!in_array($a_js_file, $this->js_files))
438 $this->js_files[] = $a_js_file;
444 global $ilias,$ilTabs;
447 foreach($this->js_files as
$file)
449 if (is_file($file) || substr($file, 0, 4) ==
"http")
462 function addCss($a_css_file, $media =
"screen")
464 if (!array_key_exists($a_css_file . $media, $this->css_files))
466 $this->css_files[$a_css_file . $media] = array(
"file" => $a_css_file,
"media" => $media);
481 foreach($this->css_files as $css)
496 function get($part =
"DEFAULT")
498 if ($part ==
"DEFAULT")
500 return parent::get();
504 return parent::get($part);
getTemplatePath($a_tplname, $a_in_module=false, $a_plugin=false)
builds a full template path with template and module name
setMessage($a_type, $a_txt, $a_keep=false)
Set message.
ilTemplate($file, $flag1, $flag2, $in_module=false, $vars="DEFAULT")
constructor
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
loadTemplatefile( $filename, $removeUnknownVariables=true, $removeEmptyBlocks=true)
Reads a template file from the disk.
setVariable($variable, $value='')
Sets a variable value.
touchBlock($block)
overwrites ITX::touchBlock.
special template class to simplify handling of ITX/PEAR
static clear($a_var)
Unset a value.
addJavaScript($a_js_file)
Add a javascript file that should be included in the header.
addBlockFile($var, $block, $tplname, $in_module=false)
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
parseCurrentBlock()
Parses the current block.
ilTemplate($file, $flag1, $flag2, $in_module=false, $vars="DEFAULT", $plugin=false, $a_use_cache=false)
constructor
getMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
fillCssFiles($a_force=false)
Fill in the css file tags.
blockExists($a_blockname)
check if block exists in actual template private
setOption($option, $value)
Sets the option for the template class.
Dummy class that inherits from new ITX PEAR Class (see header.inc)
addCss($a_css_file, $media="screen")
Add a css file that should be included in the header.
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
show($part="DEFAULT")
public