4 include_once(
"./Services/UICore/lib/html-it/IT.php");
5 include_once(
"./Services/UICore/lib/html-it/ITX.php");
52 $this->activeBlock =
"__global__";
53 $this->vars =
array();
57 $this->tplName = basename($fname);
58 $this->tplPath = dirname($fname);
60 $this->contenttype =
"text/html";
61 if (!file_exists($fname))
63 die(
"template ".$fname.
" was not found.");
68 parent::__construct();
72 $this->vars[
"TPLPATH"] = $this->tplPath;
75 if (method_exists($this,
"setOption"))
97 if (!empty(
$_GET[
"baseClass"]) && $a_in_module ===
true)
99 $a_in_module = $ilCtrl->getModuleDir();
102 if (strpos($a_tplname,
"/") ===
false)
109 if ($a_in_module ===
true)
115 $module_path = $a_in_module.
"/";
119 if($fname ==
"" || !file_exists($fname))
121 if ($a_in_module ==
"setup")
123 $fname =
"./".$module_path.
"templates/".basename($a_tplname);
127 $fname =
"./".$module_path.
"templates/default/".basename($a_tplname);
143 echo "<br/>Template '".$this->tplPath.
"/".$tplname.
"'";
147 if (file_exists($tplfile) ==
false)
149 echo "<br/>Template '".$tplfile.
"' doesn't exist! aborting...";
153 return parent::addBlockFile($var, $block, $tplfile);
160 function show($part =
"DEFAULT")
162 header(
'Content-type: text/html; charset=UTF-8');
168 $ms =
array(
"info",
"success",
"failure",
"question");
173 if ($m ==
"question")
175 $m =
"mess_question";
180 : $this->message[$m];
182 if ($m ==
"mess_question")
192 if ($m ==
"question")
194 $m =
"mess_question";
208 if ($part ==
"DEFAULT")
217 if (((substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"),1) !=
"error.php")
218 && (substr(strrchr(
$_SERVER[
"PHP_SELF"],
"/"),1) !=
"adm_menu.php")))
224 $url_parts = parse_url(
$_SERVER[
"REQUEST_URI"]);
227 $protocol = (isset(
$_SERVER[
'HTTPS']) ?
'https' :
'http').
'://';
230 $url_parts = @parse_url($protocol.$host.$path);
233 if (preg_match(
"/cmd=gateway/",$url_parts[
"query"]))
235 foreach (
$_POST as $key => $val)
242 $str .=
"&".$key.
"=".$val;
246 preg_replace(
"/cmd=gateway/",substr($str,1),
$_SERVER[
"REQUEST_URI"]));
248 (
int)
$_GET[
'ref_id']);
254 (
int)
$_GET[
'ref_id']);
268 $mtpl =
new ilTemplate(
"tpl.message.html",
true,
true,
"Services/Utilities");
269 $mtpl->setCurrentBlock(
$a_type.
"_message");
270 $mtpl->setVariable(
"TEXT", $a_txt);
271 $mtpl->setVariable(
"MESSAGE_HEADING", $lng->txt(
$a_type.
"_message"));
272 $mtpl->parseCurrentBlock();
285 $this->activeBlock = $part;
287 if ($part ==
"DEFAULT")
289 return parent::setCurrentBlock();
293 return parent::setCurrentBlock($part);
311 parent::touchBlock($block);
324 if ($part !=
"DEFAULT")
327 $this->activeBlock = $part;
330 if ($part !=
"DEFAULT")
332 $this->activeBlock = $tmp;
337 $this->activeBlock =
"__global__";
339 if ($part ==
"DEFAULT")
341 return parent::parseCurrentBlock();
345 return parent::parseCurrentBlock($part);
354 if (!in_array(
$a_type,
array(
"info",
"success",
"failure",
"question")) || $a_txt ==
"")
364 $this->message[
$a_type] = $a_txt;
376 $ms =
array(
"info",
"success",
"failure",
"question");
381 if ($m ==
"question")
383 $m =
"mess_question";
388 : $this->message[$m];
390 if ($m ==
"mess_question")
397 $mtpl =
new ilTemplate(
"tpl.message.html",
true,
true,
"Services/Utilities");
398 $mtpl->setCurrentBlock($m.
"_message");
399 $mtpl->setVariable(
"TEXT",
$txt);
400 $mtpl->setVariable(
"MESSAGE_HEADING", $lng->txt($m.
"_message"));
401 $mtpl->parseCurrentBlock();
405 if ($m ==
"question")
407 $m =
"mess_question";
431 return (isset($this->blockvariables[
"content"][$a_blockname]) ?
true :
false) | (isset($this->blockvariables[$a_blockname]) ? true :
false);
439 if (!in_array($a_js_file, $this->js_files))
441 $this->js_files[] = $a_js_file;
447 global $ilias,$ilTabs;
450 foreach($this->js_files as
$file)
452 if (is_file($file) || substr($file, 0, 4) ==
"http")
465 function addCss($a_css_file, $media =
"screen")
467 if (!array_key_exists($a_css_file . $media, $this->css_files))
469 $this->css_files[$a_css_file . $media] =
array(
"file" => $a_css_file,
"media" => $media);
484 foreach($this->css_files as $css)
499 function get($part =
"DEFAULT")
501 if ($part ==
"DEFAULT")
503 return parent::get();
507 return parent::get($part);
getTemplatePath($a_tplname, $a_in_module=false, $a_plugin=false)
builds a full template path with template and module name
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
setMessage($a_type, $a_txt, $a_keep=false)
Set message.
__construct($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.
Add a drawing to the header
addJavaScript($a_js_file)
Add a javascript file that should be included in the header.
addBlockFile($var, $block, $tplname, $in_module=false)
Create styles array
The data for the language used.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
parseCurrentBlock()
Parses the current block.
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
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
setOption($option, $value)
Sets the option for the template class.
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