4include_once(
"./Services/UICore/lib/html-it/IT.php");
 
    5include_once(
"./Services/UICore/lib/html-it/ITX.php");
 
   50    public function __construct($file, $flag1, $flag2, $in_module = 
false, 
$vars = 
"DEFAULT")
 
   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)) {
 
   62            die(
"template " . $fname . 
" was not found.");
 
   67        parent::__construct();
 
   71        $this->vars[
"TPLPATH"] = $this->tplPath;
 
   74        if (method_exists($this, 
"setOption")) {
 
   89    public function getTemplatePath($a_tplname, $a_in_module = 
false, $a_plugin = 
false)
 
   95        if (!empty(
$_GET[
"baseClass"]) && $a_in_module === 
true) {
 
   96            $a_in_module = 
$ilCtrl->getModuleDir();
 
   99        if (strpos($a_tplname, 
"/") === 
false) {
 
  104                if ($a_in_module === 
true) {
 
  107                    $module_path = $a_in_module . 
"/";
 
  111            if ($fname == 
"" || !file_exists($fname)) {
 
  112                if ($a_in_module == 
"setup") {
 
  113                    $fname = 
"./" . $module_path . 
"templates/" . basename($a_tplname);
 
  115                    $fname = 
"./" . $module_path . 
"templates/default/" . basename($a_tplname);
 
  125    public function addBlockFile($var, $block, $tplname, $in_module = 
false)
 
  128            echo 
"<br/>Template '" . $this->tplPath . 
"/" . $tplname . 
"'";
 
  132        if (file_exists($tplfile) == 
false) {
 
  133            echo 
"<br/>Template '" . $tplfile . 
"' doesn't exist! aborting...";
 
  137        return parent::addBlockFile($var, $block, $tplfile);
 
  144    public function show($part = 
"DEFAULT")
 
  146        header(
'Content-type: text/html; charset=UTF-8');
 
  152        $ms = array(
"info", 
"success", 
"failure", 
"question");
 
  155        foreach ($ms as 
$m) {
 
  156            if (
$m == 
"question") {
 
  157                $m = 
"mess_question";
 
  162                : $this->message[
$m];
 
  164            if (
$m == 
"mess_question") {
 
  172            if (
$m == 
"question") {
 
  173                $m = 
"mess_question";
 
  185        if ($part == 
"DEFAULT") {
 
  191        if (((substr(strrchr(
$_SERVER[
"PHP_SELF"], 
"/"), 1) != 
"error.php")
 
  192            && (substr(strrchr(
$_SERVER[
"PHP_SELF"], 
"/"), 1) != 
"adm_menu.php"))) {
 
  197            $url_parts = parse_url(
$_SERVER[
"REQUEST_URI"]);
 
  205            if (preg_match(
"/cmd=gateway/", $url_parts[
"query"])) {
 
  207                    if (is_array($val)) {
 
  211                    $str .= 
"&" . 
$key . 
"=" . $val;
 
  216                    preg_replace(
"/cmd=gateway/", substr($str, 1), 
$_SERVER[
"REQUEST_URI"])
 
  220                    (
int) 
$_GET[
'ref_id']
 
  226                    (
int) 
$_GET[
'ref_id']
 
  241        $mtpl = 
new ilTemplate(
"tpl.message.html", 
true, 
true, 
"Services/Utilities");
 
  242        $mtpl->setCurrentBlock(
$a_type . 
"_message");
 
  243        $mtpl->setVariable(
"TEXT", $a_txt);
 
  244        $mtpl->setVariable(
"MESSAGE_HEADING", 
$lng->txt(
$a_type . 
"_message"));
 
  245        $mtpl->parseCurrentBlock();
 
  258        $this->activeBlock = $part;
 
  260        if ($part == 
"DEFAULT") {
 
  261            return parent::setCurrentBlock();
 
  263            return parent::setCurrentBlock($part);
 
  280            parent::touchBlock($block);
 
  293        if ($part != 
"DEFAULT") {
 
  295            $this->activeBlock = $part;
 
  298        if ($part != 
"DEFAULT") {
 
  299            $this->activeBlock = $tmp;
 
  304        $this->activeBlock = 
"__global__";
 
  306        if ($part == 
"DEFAULT") {
 
  307            return parent::parseCurrentBlock();
 
  309            return parent::parseCurrentBlock($part);
 
  318        if (!in_array(
$a_type, array(
"info", 
"success", 
"failure", 
"question")) || $a_txt == 
"") {
 
  325            $this->message[
$a_type] = $a_txt;
 
  335        $ms = array(
"info", 
"success", 
"failure", 
"question");
 
  338        foreach ($ms as 
$m) {
 
  339            if (
$m == 
"question") {
 
  340                $m = 
"mess_question";
 
  345                : $this->message[
$m];
 
  347            if (
$m == 
"mess_question") {
 
  352                $mtpl = 
new ilTemplate(
"tpl.message.html", 
true, 
true, 
"Services/Utilities");
 
  353                $mtpl->setCurrentBlock(
$m . 
"_message");
 
  354                $mtpl->setVariable(
"TEXT", 
$txt);
 
  355                $mtpl->setVariable(
"MESSAGE_HEADING", 
$lng->txt(
$m . 
"_message"));
 
  356                $mtpl->parseCurrentBlock();
 
  357                $out .= $mtpl->get();
 
  360            if (
$m == 
"question") {
 
  361                $m = 
"mess_question";
 
  383        return (isset($this->blockvariables[
"content"][$a_blockname]) ? 
true : 
false) | (isset($this->blockvariables[$a_blockname]) ? true : 
false);
 
  391        if (!in_array($a_js_file, $this->js_files)) {
 
  392            $this->js_files[] = $a_js_file;
 
  398        global $ilias,$ilTabs;
 
  400            foreach ($this->js_files as $file) {
 
  401                if (is_file($file) || substr($file, 0, 4) == 
"http") {
 
  413    public function addCss($a_css_file, $media = 
"screen")
 
  415        if (!array_key_exists($a_css_file . $media, $this->css_files)) {
 
  416            $this->css_files[$a_css_file . $media] = array(
"file" => $a_css_file, 
"media" => $media);
 
  430        foreach ($this->css_files as $css) {
 
  445    public function get($part = 
"DEFAULT")
 
  447        if ($part == 
"DEFAULT") {
 
An exception for terminatinating execution or to throw for unit testing.
setOption($option, $value)
Sets the option for the template class.
parseCurrentBlock()
Parses the current block.
setVariable($variable, $value='')
Sets a variable value.
show()
returns the content of IniFile @access public
static set($a_var, $a_val)
Set a value.
static clear($a_var)
Unset a value.
static get($a_var)
Get a value.
special template class to simplify handling of ITX/PEAR
touchBlock($block)
overwrites ITX::touchBlock.
show($part="DEFAULT")
@access public
loadTemplatefile( $filename, $removeUnknownVariables=true, $removeEmptyBlocks=true)
Reads a template file from the disk.
setMessage($a_type, $a_txt, $a_keep=false)
Set message.
blockExists($a_blockname)
check if block exists in actual template @access private
addBlockFile($var, $block, $tplname, $in_module=false)
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt @access public.
fillCssFiles($a_force=false)
Fill in the css file tags.
addJavaScript($a_js_file)
Add a javascript file that should be included in the header.
getMessageHTML($a_txt, $a_type="info")
Get HTML for a system message.
addCss($a_css_file, $media="screen")
Add a css file that should be included in the header.
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
__construct($file, $flag1, $flag2, $in_module=false, $vars="DEFAULT")
constructor
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']