Inheritance diagram for ilTemplate:
Collaboration diagram for ilTemplate:Public Member Functions | |
| ilTemplate ($file, $flag1, $flag2, $in_module=false, $vars="DEFAULT") | |
| constructor | |
| get ($part="DEFAULT", $add_error_mess=false, $handle_referer=false, $add_ilias_footer=false) | |
| ??? public | |
| addErrorMessage () | |
| show ($part="DEFAULT") | |
| public | |
| addILIASFooter () | |
| add ILIAS footer | |
| handleReferer () | |
| blockExists ($a_blockname) | |
| check if block exists in actual template private | |
| fillVars () | |
| all template vars defined in $vars will be replaced automatically without setting and parsing them with setVariable & parseCurrentBlock private | |
| setCurrentBlock ($part="DEFAULT") | |
| �berladene Funktion, die sich hier lokal noch den aktuellen Block merkt. | |
| touchBlock ($block) | |
| overwrites ITX::touchBlock. | |
| parseCurrentBlock ($part="DEFAULT") | |
| �berladene Funktion, die auf den aktuelle Block vorher noch ein replace ausfhrt public | |
| replaceFromDatabase (&$DB, $block, $conv, $select="default") | |
| ??? TODO: Adjust var names to ilias. | |
| prepareForFormular ($vars) | |
| Wird angewendet, wenn die Daten in ein Formular replaced werden sollen, Dann wird erst noch ein htmlspecialchars drumherum gemacht. | |
| replace () | |
| ??? public | |
| replaceDefault () | |
| ??? public | |
| checkTopic ($a_block, $a_topic) | |
| checks for a topic in the template private | |
| includeNavigation () | |
| check if there is a NAVIGATION-topic public | |
| includeTree () | |
| check if there is a TREE-topic public | |
| fileExists ($filename) | |
| check if a file exists public | |
| addBlockFile ($var, $block, $tplname, $in_module=false) | |
| overwrites ITX::addBlockFile public | |
| getTemplatePath ($a_tplname, $a_in_module=false) | |
| builds a full template path with template and module name | |
| ilTemplate ($root) | |
| constructor | |
| show ($part="DEFAULT") | |
| public | |
| blockExists ($a_blockname) | |
| check if block exists in actual template private | |
Data Fields | |
| $vars | |
| $activeBlock | |
Definition at line 34 of file class.ilTemplate.php.
| ilTemplate::addBlockFile | ( | $ | var, | |
| $ | block, | |||
| $ | tplname, | |||
| $ | in_module = false | |||
| ) |
overwrites ITX::addBlockFile public
| string | ||
| string | ||
| string | $tplname template name | |
| boolean | $in_module should be set to true, if template file is in module subdirectory |
Definition at line 497 of file class.ilTemplate.php.
References getTemplatePath().
Referenced by addErrorMessage(), addILIASFooter(), and show().
{
if (DEBUG)
{
echo "<br/>Template '".$this->tplPath."/".$tplname."'";
}
$tplfile = $this->getTemplatePath($tplname, $in_module);
if (file_exists($tplfile) == false)
{
echo "<br/>Template '".$tplfile."' doesn't exist! aborting...";
return false;
}
return parent::addBlockFile($var, $block, $tplfile);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::addErrorMessage | ( | ) |
Definition at line 143 of file class.ilTemplate.php.
References $_SESSION, addBlockFile(), and blockExists().
Referenced by get(), and show().
{
// ERROR HANDLER SETS $_GET["message"] IN CASE OF $error_obj->MESSAGE
if ($_SESSION["message"] || $_SESSION["info"])
{
if($this->blockExists("MESSAGE"))
{
$this->addBlockFile("MESSAGE", "message", "tpl.message.html");
# $this->setCurrentBlock("message");
$this->setVariable("MSG", $_SESSION["message"]);
$this->setVariable("INFO", $_SESSION["info"]);
session_unregister("message");
session_unregister("info");
# $this->parseCurrentBlock();
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::addILIASFooter | ( | ) |
add ILIAS footer
Definition at line 197 of file class.ilTemplate.php.
References $ilias, and addBlockFile().
Referenced by get(), and show().
{
global $ilias;
$this->addBlockFile("FOOTER", "footer", "tpl.footer.html");
$this->setVariable("ILIAS_VERSION", $ilias->getSetting("ilias_version"));
if (DEVMODE)
{
if(function_exists("memory_get_usage"))
{
$this->setVariable("MEMORY_USAGE",
", Memory Usage: ".memory_get_usage()." Bytes");
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::blockExists | ( | $ | a_blockname | ) |
check if block exists in actual template private
| string | blockname |
Definition at line 255 of file class.ilTemplate.php.
Referenced by addErrorMessage(), and show().
{
return $this->blockvariables["content"][$a_blockname] ? true : false;
}
Here is the caller graph for this function:| ilTemplate::blockExists | ( | $ | a_blockname | ) |
check if block exists in actual template private
| string | blockname |
Definition at line 140 of file class.ilTemplate.php.
{
return $this->blockvariables["content"][$a_blockname] ? true : false;
}
| ilTemplate::checkTopic | ( | $ | a_block, | |
| $ | a_topic | |||
| ) |
checks for a topic in the template private
| string | ||
| string |
Definition at line 452 of file class.ilTemplate.php.
Referenced by includeNavigation(), and includeTree().
{
return array_key_exists($a_topic, $this->blockvariables[$a_block]);
}
Here is the caller graph for this function:| ilTemplate::fileExists | ( | $ | filename | ) |
check if a file exists public
Definition at line 482 of file class.ilTemplate.php.
{
return file_exists($this->tplPath."/".$filename);
}
| ilTemplate::fillVars | ( | ) |
all template vars defined in $vars will be replaced automatically without setting and parsing them with setVariable & parseCurrentBlock private
Definition at line 267 of file class.ilTemplate.php.
References $count.
Referenced by parseCurrentBlock(), and touchBlock().
{
$count = 0;
reset($this->vars);
while(list($key, $val) = each($this->vars))
{
if (is_array($this->blockvariables[$this->activeBlock]))
{
if (array_key_exists($key, $this->blockvariables[$this->activeBlock]))
{
$count++;
$this->setVariable($key, $val);
}
}
}
return $count;
}
Here is the caller graph for this function:| ilTemplate::get | ( | $ | part = "DEFAULT", |
|
| $ | add_error_mess = false, |
|||
| $ | handle_referer = false, |
|||
| $ | add_ilias_footer = false | |||
| ) |
??? public
| string |
Definition at line 114 of file class.ilTemplate.php.
References addErrorMessage(), addILIASFooter(), and handleReferer().
{
if ($add_error_mess)
{
$this->addErrorMessage();
}
if ($add_ilias_footer)
{
$this->addILIASFooter();
}
if ($handle_referer)
{
$this->handleReferer();
}
if ($part == "DEFAULT")
{
return parent::get();
}
else
{
return parent::get($part);
}
}
Here is the call graph for this function:| ilTemplate::getTemplatePath | ( | $ | a_tplname, | |
| $ | a_in_module = false | |||
| ) |
builds a full template path with template and module name
| string | $a_tplname template name | |
| boolean | $in_module should be set to true, if template file is in module subdirectory |
Definition at line 522 of file class.ilTemplate.php.
References $_GET, $ilCtrl, and $ilias.
Referenced by addBlockFile(), and ilTemplate().
{
global $ilias, $ilCtrl;
// if baseClass functionality is used (ilias.php):
// get template directory from ilCtrl
if (!empty($_GET["baseClass"]) && $a_in_module === true)
{
$a_in_module = $ilCtrl->getModuleDir();
}
if (strpos($a_tplname,"/") === false)
{
//$fname = $ilias->tplPath;
$base = "./";
if ($a_in_module)
{
if ($a_in_module === true)
{
$base.= ILIAS_MODULE."/";
}
else
{
$base.= $a_in_module."/";
}
}
$base .= "templates/";
$fname = $base.$ilias->account->skin."/".basename($a_tplname);
//echo "looking for :$fname:<br>";
if(!file_exists($fname))
{
$fname = $base."default/".basename($a_tplname);
}
}
else
{
$fname = $a_tplname;
}
return $fname;
}
Here is the caller graph for this function:| ilTemplate::handleReferer | ( | ) |
Definition at line 214 of file class.ilTemplate.php.
References $_POST, and $_SESSION.
Referenced by get(), and show().
{
if (((substr(strrchr($_SERVER["PHP_SELF"],"/"),1) != "error.php")
&& (substr(strrchr($_SERVER["PHP_SELF"],"/"),1) != "adm_menu.php")
&& (substr(strrchr($_SERVER["PHP_SELF"],"/"),1) != "chat.php")))
{
$_SESSION["post_vars"] = $_POST;
// referer is modified if query string contains cmd=gateway and $_POST is not empty.
// this is a workaround to display formular again in case of error and if the referer points to another page
$url_parts = parse_url($_SERVER["REQUEST_URI"]);
if (preg_match("/cmd=gateway/",$url_parts["query"]) && (isset($_POST["cmd"]["create"])))
{
foreach ($_POST as $key => $val)
{
if (is_array($val))
{
$val = key($val);
}
$str .= "&".$key."=".$val;
}
$_SESSION["referer"] = preg_replace("/cmd=gateway/",substr($str,1),$_SERVER["REQUEST_URI"]);
}
else
{
$_SESSION["referer"] = $_SERVER["REQUEST_URI"];
}
unset($_SESSION["error_post_vars"]);
}
}
Here is the caller graph for this function:| ilTemplate::ilTemplate | ( | $ | file, | |
| $ | flag1, | |||
| $ | flag2, | |||
| $ | in_module = false, |
|||
| $ | vars = "DEFAULT" | |||
| ) |
constructor
| string | $file templatefile (mit oder ohne pfad) | |
| boolean | $flag1 remove unknown variables | |
| boolean | $flag2 remove empty blocks | |
| boolean | $in_module should be set to true, if template file is in module subdirectory | |
| array | $vars variables to replace public |
Definition at line 59 of file class.ilTemplate.php.
References $file, $ilias, ilTemplateX::callConstructor(), and getTemplatePath().
{
global $ilias;
$this->activeBlock = "__global__";
$this->vars = array();
/*
if (strpos($file,"/") === false)
{
//$fname = $ilias->tplPath;
$base = "./";
if ($module != "")
{
$base.= $module."/";
}
$base .= "templates/";
$fname = $base.$ilias->account->skin."/".basename($file);
if(!file_exists($fname))
{
$fname .= $base."default/".basename($file);
}
}
else
{
$fname = $file;
}*/
$fname = $this->getTemplatePath($file, $in_module);
$this->tplName = basename($fname);
$this->tplPath = dirname($fname);
if (!file_exists($fname))
{
$ilias->raiseError("template ".$fname." was not found.", $ilias->error_obj->FATAL);
return false;
}
//$this->IntegratedTemplateExtension(dirname($fname));
$this->callConstructor();
//$this->loadTemplatefile(basename($fname), $flag1, $flag2);
$this->loadTemplatefile($fname, $flag1, $flag2);
//add tplPath to replacevars
$this->vars["TPLPATH"] = $this->tplPath;
return true;
}
Here is the call graph for this function:| ilTemplate::ilTemplate | ( | $ | root | ) |
constructor
| string | $file templatefile (mit oder ohne pfad) | |
| boolean | $flag1 remove unknown variables | |
| boolean | $flag2 remove empty blocks | |
| boolean | $in_module should be set to true, if template file is in module subdirectory | |
| array | $vars variables to replace public |
Definition at line 59 of file class.ilTemplate.php.
References ilTemplateX::callConstructor().
{
$this->callConstructor();
$this->setRoot($root);
return true;
}
Here is the call graph for this function:| ilTemplate::includeNavigation | ( | ) |
check if there is a NAVIGATION-topic public
Definition at line 462 of file class.ilTemplate.php.
References checkTopic().
{
return $this->checkTopic("__global__", "NAVIGATION");
}
Here is the call graph for this function:| ilTemplate::includeTree | ( | ) |
check if there is a TREE-topic public
Definition at line 472 of file class.ilTemplate.php.
References checkTopic().
{
return $this->checkTopic("__global__", "TREE");
}
Here is the call graph for this function:| ilTemplate::parseCurrentBlock | ( | $ | part = "DEFAULT" |
) |
�berladene Funktion, die auf den aktuelle Block vorher noch ein replace ausfhrt public
| string |
Definition at line 332 of file class.ilTemplate.php.
References fillVars().
Referenced by replaceFromDatabase(), and touchBlock().
{
// Hier erst noch ein replace aufrufen
if ($part != "DEFAULT")
{
$tmp = $this->activeBlock;
$this->activeBlock = $part;
}
if ($part != "DEFAULT")
{
$this->activeBlock = $tmp;
}
$this->fillVars();
$this->activeBlock = "__global__";
if ($part == "DEFAULT")
{
return parent::parseCurrentBlock();
}
else
{
return parent::parseCurrentBlock($part);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::prepareForFormular | ( | $ | vars | ) |
Wird angewendet, wenn die Daten in ein Formular replaced werden sollen, Dann wird erst noch ein htmlspecialchars drumherum gemacht.
public
| string |
Definition at line 404 of file class.ilTemplate.php.
References $vars.
| ilTemplate::replace | ( | ) |
??? public
Definition at line 426 of file class.ilTemplate.php.
Referenced by replaceDefault(), and replaceFromDatabase().
{
reset($this->vars);
while(list($key, $val) = each($this->vars))
{
$this->setVariable($key, $val);
}
}
Here is the caller graph for this function:| ilTemplate::replaceDefault | ( | ) |
??? public
Definition at line 440 of file class.ilTemplate.php.
References replace().
{
$this->replace($this->vars);
}
Here is the call graph for this function:| ilTemplate::replaceFromDatabase | ( | &$ | DB, | |
| $ | block, | |||
| $ | conv, | |||
| $ | select = "default" | |||
| ) |
??? TODO: Adjust var names to ilias.
This method wasn't used so far and isn't translated yet public
| string | ||
| string | ||
| string | ||
| string |
Definition at line 370 of file class.ilTemplate.php.
References $DB, $res, $result, parseCurrentBlock(), replace(), and setCurrentBlock().
{
$res = $DB->selectDbAll();
while ($DB->getDbNextElement($res))
{
$this->setCurrentBlock($block);
$result = array();
reset($conv);
while (list ($key,$val) = each ($conv))
{
$result[$val]=$DB->element->data[$key];
}
if (($select != "default")
&& ($DB->element->data[$select["id"]]==$select["value"]
|| (strtolower($select["text"]) == "checked"
&& strpos( ",,".$select["value"].",," , ",".$DB->element->data[$select["id"]]."," )!=false)))
{
$result[$select["field"]] = $select["text"];
}
$this->replace($result);
$this->parseCurrentBlock($block);
}
}
Here is the call graph for this function:| ilTemplate::setCurrentBlock | ( | $ | part = "DEFAULT" |
) |
�berladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
public
| string |
Definition at line 294 of file class.ilTemplate.php.
Referenced by replaceFromDatabase(), and touchBlock().
{
$this->activeBlock = $part;
if ($part == "DEFAULT")
{
return parent::setCurrentBlock();
}
else
{
return parent::setCurrentBlock($part);
}
}
Here is the caller graph for this function:| ilTemplate::show | ( | $ | part = "DEFAULT" |
) |
public
| string |
Definition at line 168 of file class.ilTemplate.php.
References $ilias, addErrorMessage(), addILIASFooter(), and handleReferer().
Referenced by show().
{
global $ilias;
header('Content-type: text/html; charset=UTF-8');
$this->addErrorMessage();
// display ILIAS footer
if ($part !== false)
{
$this->addILIASFooter();
}
if ($part == "DEFAULT" or is_bool($part))
{
parent::show();
}
else
{
parent::show($part);
}
$this->handleReferer();
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::show | ( | $ | part = "DEFAULT" |
) |
public
| string |
Definition at line 72 of file class.ilTemplate.php.
References $_POST, $_SESSION, addBlockFile(), blockExists(), and show().
{
header('Content-type: text/html; charset=UTF-8');
// ERROR HANDLER SETS $_GET["message"] IN CASE OF $error_obj->MESSAGE
if ($_SESSION["message"] || $_SESSION["info"])
{
if ($this->blockExists("MESSAGE"))
{
$this->addBlockFile("MESSAGE", "message", "tpl.message.html");
# $this->setCurrentBlock("message");
$this->setVariable("MSG", $_SESSION["message"]);
$this->setVariable("INFO", $_SESSION["info"]);
session_unregister("message");
session_unregister("info");
# $this->parseCurrentBlock();
}
}
if ($part == "DEFAULT")
{
parent::show();
}
else
{
parent::show($part);
}
if (((substr(strrchr($_SERVER["PHP_SELF"],"/"),1) != "error.php")
&& (substr(strrchr($_SERVER["PHP_SELF"],"/"),1) != "adm_menu.php")))
{
$_SESSION["post_vars"] = $_POST;
// referer is modified if query string contains cmd=gateway and $_POST is not empty.
// this is a workaround to display formular again in case of error and if the referer points to another page
$url_parts = parse_url($_SERVER["REQUEST_URI"]);
if (preg_match("/cmd=gateway/",$url_parts["query"]))
{
foreach ($_POST as $key => $val)
{
if (is_array($val))
{
$val = key($val);
}
$str .= "&".$key."=".$val;
}
$_SESSION["referer"] = preg_replace("/cmd=gateway/",substr($str,1),$_SERVER["REQUEST_URI"]);
}
else
{
$_SESSION["referer"] = $_SERVER["REQUEST_URI"];
}
unset($_SESSION["error_post_vars"]);
}
}
Here is the call graph for this function:| ilTemplate::touchBlock | ( | $ | block | ) |
overwrites ITX::touchBlock.
public
| string |
Definition at line 314 of file class.ilTemplate.php.
References $count, fillVars(), parseCurrentBlock(), and setCurrentBlock().
{
$this->setCurrentBlock($block);
$count = $this->fillVars();
$this->parseCurrentBlock();
if ($count == 0)
{
parent::touchBlock($block);
}
}
Here is the call graph for this function:| ilTemplate::$activeBlock |
Definition at line 48 of file class.ilTemplate.php.
| ilTemplate::$vars |
Definition at line 40 of file class.ilTemplate.php.
Referenced by prepareForFormular().
1.7.1