special template class to simplify handling of ITX/PEAR More...
Inheritance diagram for ilTemplate:
Collaboration diagram for ilTemplate:Public Member Functions | |
| ilTemplate ($file, $flag1, $flag2, $in_module=false, $vars="DEFAULT") | |
| constructor | |
| getAsynch () | |
| Use this for final get before sending asynchronous output (ajax) per echo to output. | |
| get ($part="DEFAULT", $add_error_mess=false, $handle_referer=false, $add_ilias_footer=false, $add_standard_elements=false) | |
| ??? public | |
| addErrorMessage () | |
| getContentType () | |
| Get the content type for the template output. | |
| setContentType ($a_content_type="text/html") | |
| Set the content type for the template output. | |
| show ($part="DEFAULT", $a_fill_tabs=true) | |
| public | |
| fillContentLanguage () | |
| Add current user language to meta tags. | |
| fillWindowTitle () | |
| fillTabs () | |
| fillPageFormAction () | |
| fillJavaScriptFiles () | |
| fillCssFiles () | |
| setContentStyle () | |
| fillMainMenu () | |
| fillNavigationHistory () | |
| fillHeaderIcon () | |
| addILIASFooter () | |
| add ILIAS footer | |
| handleReferer () | |
| TODO: this is nice, but shouldn't be done here (-> maybe at the end of ilias.php!?, alex). | |
| 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 ausführt 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 | |
| setHeaderPageTitle ($a_title) | |
| setStyleSheetLocation ($a_stylesheet) | |
| setNewContentStyleSheetLocation ($a_stylesheet) | |
| getStandardTemplate () | |
| setTitle ($a_title) | |
| sets title in standard template | |
| setTitleIcon ($a_icon_path, $a_icon_desc="") | |
| set title icon | |
| setPageFormAction ($a_action) | |
| setDescription ($a_descr) | |
| sets title in standard template | |
| stopTitleFloating () | |
| stop floating (if no tabs are used) | |
| setContent ($a_html) | |
| sets content for standard template | |
| setRightContent ($a_html) | |
| sets content of right column | |
| setLeftContent ($a_html) | |
| sets content of left column | |
| setLocator () | |
| Insert locator. | |
| setTabs ($a_tabs_html) | |
| sets tabs in standard template | |
| setSubTabs ($a_tabs_html) | |
| sets subtabs in standard template | |
| setUpperIcon ($a_link, $a_frame="") | |
| sets icon to upper level | |
| setTreeFlatIcon ($a_link, $a_mode) | |
| set tree/flat icon | |
| addJavaScript ($a_js_file, $a_add_version_parameter=true) | |
| Add a javascript file that should be included in the header. | |
| addCss ($a_css_file, $media="screen") | |
| Add a css file that should be included in the header. | |
| ilTemplate ($root) | |
| constructor | |
| show ($part="DEFAULT") | |
| public | |
| blockExists ($a_blockname) | |
| check if block exists in actual template private | |
| addJavaScript ($a_js_file) | |
| Add a javascript file that should be included in the header. | |
| fillJavaScriptFiles () | |
Data Fields | |
| $contenttype | |
| $vars | |
| $activeBlock | |
| $js_files = array(0 => "Services/JavaScript/js/Basic.js") | |
| $js_files_vp = array("Services/JavaScript/js/Basic.js" => true) | |
| $css_files = array() | |
special template class to simplify handling of ITX/PEAR
Definition at line 31 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 828 of file class.ilTemplate.php.
References getTemplatePath().
Referenced by addErrorMessage(), addILIASFooter(), getStandardTemplate(), 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::addCss | ( | $ | a_css_file, | |
| $ | media = "screen" | |||
| ) |
Add a css file that should be included in the header.
Definition at line 1075 of file class.ilTemplate.php.
{
if (!array_key_exists($a_css_file . $media, $this->css_files))
{
$this->css_files[$a_css_file . $media] = array("file" => $a_css_file, "media" => $media);
}
}
| ilTemplate::addErrorMessage | ( | ) |
Definition at line 180 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 432 of file class.ilTemplate.php.
References $_GET, $_SESSION, $ilCtrl, $ilias, $ilSetting, ilObjLanguageAccess::_checkTranslate(), ilObjLanguageExtGUI::_getTranslationLink(), addBlockFile(), ilUtil::appendUrlParameterString(), blockExists(), ilPHP::cloneObject(), parseCurrentBlock(), setCurrentBlock(), and ilValidatorAdapter::validate().
Referenced by get(), and show().
{
global $ilias, $ilClientIniFile, $ilCtrl, $ilDB, $ilSetting;
$this->addBlockFile("FOOTER", "footer", "tpl.footer.html");
$this->setVariable("ILIAS_VERSION", $ilias->getSetting("ilias_version"));
// output translation link
if ($ilSetting->get("lang_ext_maintenance") == "1")
{
include_once("Services/Language/classes/class.ilObjLanguageAccess.php");
if (ilObjLanguageAccess::_checkTranslate())
{
include_once("Services/Language/classes/class.ilObjLanguageExtGUI.php");
$this->setVariable("TRANSLATION_LINK",
ilObjLanguageExtGUI::_getTranslationLink());
}
}
if (DEVMODE)
{
$mem_usage = "";
if(function_exists("memory_get_usage"))
{
$mem_usage.=
"<br /> Memory Usage: ".memory_get_usage()." Bytes";
}
if(function_exists("xdebug_peak_memory_usage"))
{
$mem_usage.=
"<br /> XDebug Peak Memory Usage: ".xdebug_peak_memory_usage()." Bytes";
}
if ($mem_usage != "")
{
$this->setVariable("MEMORY_USAGE", $mem_usage);
}
$this->setVariable("SESS_INFO", "<br />maxlifetime: ".
ini_get("session.gc_maxlifetime")." (".
(ini_get("session.gc_maxlifetime")/60)."), id: ".session_id()."<br />".
"timestamp: ".date("Y-m-d H:i:s", $_SESSION["_authsession"]["timestamp"]).
", idle: ".date("Y-m-d H:i:s", $_SESSION["_authsession"]["idle"]).
"<br />expire: ".($exp = $ilClientIniFile->readVariable("session","expire")).
" (".($exp/60)."), session ends at: ".
date("Y-m-d H:i:s", $_SESSION["_authsession"]["idle"] + $exp));
if (version_compare(PHP_VERSION,'5','>='))
{
$this->setVariable("VALIDATION_LINKS",
'<br /><a href="'.
ilUtil::appendUrlParameterString($_SERVER["REQUEST_URI"], "do_dev_validate=xhtml").
'">Validate</a> | <a href="'.
ilUtil::appendUrlParameterString($_SERVER["REQUEST_URI"], "do_dev_validate=accessibility").
'">Accessibility</a>');
}
if (!empty($_GET["do_dev_validate"]) && $this->blockExists("xhtml_validation"))
{
require_once("Services/XHTMLValidator/classes/class.ilValidatorAdapter.php");
$template2 = ilPHP::cloneObject($this);
//echo "-".ilValidatorAdapter::validate($template2->get(), $_GET["do_dev_validate"])."-";
$this->setCurrentBlock("xhtml_validation");
$this->setVariable("VALIDATION",
ilValidatorAdapter::validate($template2->get("DEFAULT",
false, false, false, true), $_GET["do_dev_validate"]));
$this->parseCurrentBlock();
}
// controller history
if (is_object($ilCtrl) && $this->blockExists("c_entry") &&
$this->blockExists("call_history"))
{
$hist = $ilCtrl->getCallHistory();
foreach($hist as $entry)
{
$this->setCurrentBlock("c_entry");
$this->setVariable("C_ENTRY", $entry);
if (is_object($ilDB))
{
$set = $ilDB->query("SELECT file FROM ctrl_classfile WHERE LOWER(class) ".
" = ".$ilDB->quote(strtolower($entry)));
$rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
if ($rec["file"] != "")
{
$this->setVariable("C_FILE", "[".$rec["file"]."]");
}
}
$this->parseCurrentBlock();
}
$this->setCurrentBlock("call_history");
$this->parseCurrentBlock();
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::addJavaScript | ( | $ | a_js_file, | |
| $ | a_add_version_parameter = true | |||
| ) |
Add a javascript file that should be included in the header.
Definition at line 1063 of file class.ilTemplate.php.
{
if (!in_array($a_js_file, $this->js_files))
{
$this->js_files[] = $a_js_file;
$this->js_files_vp[$a_js_file] = $a_add_version_parameter;
}
}
| ilTemplate::addJavaScript | ( | $ | a_js_file | ) |
Add a javascript file that should be included in the header.
Definition at line 150 of file class.ilTemplate.php.
{
if (!in_array($a_js_file, $this->js_files))
{
$this->js_files[] = $a_js_file;
}
}
| ilTemplate::blockExists | ( | $ | a_blockname | ) |
check if block exists in actual template private
| string | blockname |
Definition at line 586 of file class.ilTemplate.php.
Referenced by addErrorMessage(), addILIASFooter(), fillJavaScriptFiles(), and show().
{
// added second evaluation to the return statement because the first one only works for the content block (Helmut Schottmüller, 2007-09-14)
return ($this->blockvariables["content"][$a_blockname] ? true : false) | ($this->blockvariables[$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 142 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 783 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 813 of file class.ilTemplate.php.
References $filename.
{
return file_exists($this->tplPath."/".$filename);
}
| ilTemplate::fillContentLanguage | ( | ) |
Add current user language to meta tags.
public
Definition at line 283 of file class.ilTemplate.php.
References $lng.
Referenced by show().
{
global $ilUser,$lng;
if(is_object($ilUser))
{
if($ilUser->getLanguage())
{
$this->setVariable('META_CONTENT_LANGUAGE',$ilUser->getLanguage());
return true;
}
if(is_object($lng))
{
$this->setVariable('META_CONTENT_LANGUAGE',$lng->getDefaultLanguage());
return true;
}
}
$this->setVariable('META_CONTENT_LANGUAGE','en');
return true;
}
Here is the caller graph for this function:| ilTemplate::fillCssFiles | ( | ) |
Definition at line 371 of file class.ilTemplate.php.
References $filename, parseCurrentBlock(), and setCurrentBlock().
Referenced by get(), and show().
{
foreach($this->css_files as $css)
{
$filename = $css["file"];
if (strpos($filename, "?") > 0) $filename = substr($filename, 0, strpos($filename, "?"));
if (is_file($filename))
{
$this->setCurrentBlock("css_file");
$this->setVariable("CSS_FILE", $css["file"]);
$this->setVariable("CSS_MEDIA", $css["media"]);
$this->parseCurrentBlock();
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::fillHeaderIcon | ( | ) |
Definition at line 413 of file class.ilTemplate.php.
References parseCurrentBlock(), and setCurrentBlock().
Referenced by get(), and show().
{
if ($this->icon_path != "")
{
if ($this->icon_desc != "")
{
$this->setCurrentBlock("header_image_desc");
$this->setVariable("IMAGE_DESC", $this->icon_desc);
$this->parseCurrentBlock();
}
$this->setCurrentBlock("header_image");
$this->setVariable("IMG_HEADER", $this->icon_path);
$this->parseCurrentBlock();
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::fillJavaScriptFiles | ( | ) |
Definition at line 339 of file class.ilTemplate.php.
References $file, $ilias, $ilSetting, ilUtil::appendUrlParameterString(), blockExists(), parseCurrentBlock(), and setCurrentBlock().
Referenced by get(), and show().
{
global $ilias,$ilTabs,$ilSetting;
if (is_object($ilSetting)) // maybe this one can be removed
{
$vers = "vers=".str_replace(array(".", " "), "-", $ilSetting->get("ilias_version"));
}
if ($this->blockExists("js_file"))
{
foreach($this->js_files as $file)
{
if (is_file($file) || substr($file, 0, 4) == "http")
{
$this->setCurrentBlock("js_file");
if ($this->js_files_vp[$file])
{
$this->setVariable("JS_FILE", ilUtil::appendUrlParameterString($file,$vers));
}
else
{
$this->setVariable("JS_FILE", $file);
}
$this->parseCurrentBlock();
}
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::fillJavaScriptFiles | ( | ) |
Definition at line 158 of file class.ilTemplate.php.
References $file, $ilias, blockExists(), parseCurrentBlock(), and setCurrentBlock().
{
global $ilias,$ilTabs;
if ($this->blockExists("js_file"))
{
foreach($this->js_files as $file)
{
if (is_file($file) || substr($file, 0, 4) == "http")
{
$this->setCurrentBlock("js_file");
$this->setVariable("JS_FILE", $file);
$this->parseCurrentBlock();
}
}
}
}
Here is the call graph for this function:| ilTemplate::fillMainMenu | ( | ) |
| ilTemplate::fillNavigationHistory | ( | ) |
Definition at line 402 of file class.ilTemplate.php.
References $tpl.
{
global $tpl, $ilMainMenu;
/* Now part of the main menu
require_once("Services/Navigation/classes/class.ilNavigationHistoryGUI.php");
$nav_hist = new ilNavigationHistoryGUI();
$tpl->setVariable("NAVIGATION_HISTORY", $nav_hist->getHTML());
*/
}
| ilTemplate::fillPageFormAction | ( | ) |
Definition at line 328 of file class.ilTemplate.php.
References parseCurrentBlock(), setCurrentBlock(), and touchBlock().
Referenced by show().
{
if ($this->page_form_action != "")
{
$this->setCurrentBlock("page_form_start");
$this->setVariable("PAGE_FORM_ACTION", $this->page_form_action);
$this->parseCurrentBlock();
$this->touchBlock("page_form_end");
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::fillTabs | ( | ) |
| ilTemplate::fillVars | ( | ) |
all template vars defined in $vars will be replaced automatically without setting and parsing them with setVariable & parseCurrentBlock private
Definition at line 598 of file class.ilTemplate.php.
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::fillWindowTitle | ( | ) |
Definition at line 304 of file class.ilTemplate.php.
References $ilSetting.
Referenced by get(), and show().
{
global $ilSetting;
if ($ilSetting->get('short_inst_name') != "")
{
$this->setVariable("WINDOW_TITLE",
$ilSetting->get('short_inst_name'));
}
else
{
$this->setVariable("WINDOW_TITLE",
"ILIAS");
}
}
Here is the caller graph for this function:| ilTemplate::get | ( | $ | part = "DEFAULT", |
|
| $ | add_error_mess = false, |
|||
| $ | handle_referer = false, |
|||
| $ | add_ilias_footer = false, |
|||
| $ | add_standard_elements = false | |||
| ) |
??? public
| string |
Definition at line 137 of file class.ilTemplate.php.
References addErrorMessage(), addILIASFooter(), fillCssFiles(), fillHeaderIcon(), fillJavaScriptFiles(), fillMainMenu(), fillTabs(), fillWindowTitle(), handleReferer(), and setContentStyle().
{
if ($add_error_mess)
{
$this->addErrorMessage();
}
// set standard parts (tabs and title icon)
if($add_standard_elements)
{
$this->setContentStyle();
$this->fillWindowTitle();
$this->fillMainMenu();
$this->fillTabs();
$this->fillHeaderIcon();
//$this->fillNavigationHistory();
$this->fillCssFiles();
$this->fillJavaScriptFiles();
}
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::getAsynch | ( | ) |
Use this for final get before sending asynchronous output (ajax) per echo to output.
Definition at line 125 of file class.ilTemplate.php.
References getContentType().
{
header("Content-type: " . $this->getContentType() . "; charset=UTF-8");
return $this->get();
}
Here is the call graph for this function:| ilTemplate::getContentType | ( | ) |
Get the content type for the template output.
Definition at line 207 of file class.ilTemplate.php.
Referenced by getAsynch(), and show().
{
return $this->contenttype;
}
Here is the caller graph for this function:| ilTemplate::getStandardTemplate | ( | ) |
Definition at line 914 of file class.ilTemplate.php.
References addBlockFile().
{
$this->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
$this->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
}
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 853 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)
{
$module_path = "";
//$fname = $ilias->tplPath;
if ($a_in_module)
{
if ($a_in_module === true)
{
$module_path = ILIAS_MODULE."/";
}
else
{
$module_path = $a_in_module."/";
}
}
if ($ilias->account->skin != "default")
{
$fname = "./Customizing/global/skin/".
$ilias->account->skin."/".$module_path.basename($a_tplname);
}
if($fname == "" || !file_exists($fname))
{
$fname = "./".$module_path."templates/default/".basename($a_tplname);
}
}
else
{
$fname = $a_tplname;
}
return $fname;
}
Here is the caller graph for this function:| ilTemplate::handleReferer | ( | ) |
TODO: this is nice, but shouldn't be done here (-> maybe at the end of ilias.php!?, alex).
Definition at line 531 of file class.ilTemplate.php.
References $_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 if (preg_match("/cmd=post/",$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=post/",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 65 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);
// set default content-type to text/html
$this->contenttype = "text/html";
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;
// set Options
if (method_exists($this, "setOption"))
{
$this->setOption('use_preg', false);
}
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 793 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 803 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 ausführt public.
| string |
Definition at line 663 of file class.ilTemplate.php.
References fillVars().
Referenced by addILIASFooter(), fillCssFiles(), fillHeaderIcon(), fillJavaScriptFiles(), fillPageFormAction(), replaceFromDatabase(), setLeftContent(), setRightContent(), setTreeFlatIcon(), setUpperIcon(), 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 735 of file class.ilTemplate.php.
References $vars.
| ilTemplate::replace | ( | ) |
??? public
Definition at line 757 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 771 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 701 of file class.ilTemplate.php.
References $DB, $res, 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::setContent | ( | $ | a_html | ) |
sets content for standard template
Definition at line 963 of file class.ilTemplate.php.
{
$this->setVariable("ADM_CONTENT", $a_html);
}
| ilTemplate::setContentStyle | ( | ) |
Definition at line 387 of file class.ilTemplate.php.
References ilUtil::getNewContentStyleSheetLocation().
Referenced by get(), and show().
{
$this->setVariable("LOCATION_NEWCONTENT_STYLESHEET_TAG",
'<link rel="stylesheet" type="text/css" href="'.
ilUtil::getNewContentStyleSheetLocation()
.'" />');
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::setContentType | ( | $ | a_content_type = "text/html" |
) |
Set the content type for the template output.
Set the content type for the template output Usually this is text/html. For MathML output the content type should be set to text/xml
| string | $a_content_type Content type public |
Definition at line 222 of file class.ilTemplate.php.
{
$this->contenttype = $a_content_type;
}
| ilTemplate::setCurrentBlock | ( | $ | part = "DEFAULT" |
) |
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
public
| string |
Definition at line 625 of file class.ilTemplate.php.
Referenced by addILIASFooter(), fillCssFiles(), fillHeaderIcon(), fillJavaScriptFiles(), fillPageFormAction(), replaceFromDatabase(), setLeftContent(), setRightContent(), setTreeFlatIcon(), setUpperIcon(), 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::setDescription | ( | $ | a_descr | ) |
sets title in standard template
Definition at line 947 of file class.ilTemplate.php.
{
$this->setVariable("H_DESCRIPTION", $a_descr);
}
| ilTemplate::setHeaderPageTitle | ( | $ | a_title | ) |
Definition at line 899 of file class.ilTemplate.php.
{
$this->setVariable("PAGETITLE", $a_title);
}
| ilTemplate::setLeftContent | ( | $ | a_html | ) |
sets content of left column
Definition at line 984 of file class.ilTemplate.php.
References parseCurrentBlock(), and setCurrentBlock().
{
if (trim($a_html) != "")
{
$this->setCurrentBlock("left_column");
$this->setVariable("LEFT_CONTENT", $a_html);
$this->parseCurrentBlock();
}
}
Here is the call graph for this function:| ilTemplate::setLocator | ( | ) |
Insert locator.
Definition at line 997 of file class.ilTemplate.php.
References $lng.
{
global $ilLocator, $lng;
$this->setVariable("LOCATOR", $ilLocator->getHTML());
}
| ilTemplate::setNewContentStyleSheetLocation | ( | $ | a_stylesheet | ) |
Definition at line 909 of file class.ilTemplate.php.
{
$this->setVariable("LOCATION_NEWCONTENT_STYLESHEET", $a_stylesheet);
}
| ilTemplate::setPageFormAction | ( | $ | a_action | ) |
Definition at line 939 of file class.ilTemplate.php.
{
$this->page_form_action = $a_action;
}
| ilTemplate::setRightContent | ( | $ | a_html | ) |
sets content of right column
Definition at line 971 of file class.ilTemplate.php.
References parseCurrentBlock(), and setCurrentBlock().
{
if (trim($a_html) != "")
{
$this->setCurrentBlock("right_column");
$this->setVariable("RIGHT_CONTENT", $a_html);
$this->parseCurrentBlock();
}
}
Here is the call graph for this function:| ilTemplate::setStyleSheetLocation | ( | $ | a_stylesheet | ) |
Definition at line 904 of file class.ilTemplate.php.
{
$this->setVariable("LOCATION_STYLESHEET", $a_stylesheet);
}
| ilTemplate::setSubTabs | ( | $ | a_tabs_html | ) |
sets subtabs in standard template
Definition at line 1015 of file class.ilTemplate.php.
{
$this->setVariable("SUB_TABS", $a_tabs_html);
}
| ilTemplate::setTabs | ( | $ | a_tabs_html | ) |
sets tabs in standard template
Definition at line 1007 of file class.ilTemplate.php.
{
$this->setVariable("TABS", $a_tabs_html);
}
| ilTemplate::setTitle | ( | $ | a_title | ) |
sets title in standard template
Definition at line 923 of file class.ilTemplate.php.
{
$this->setVariable("HEADER", $a_title);
$this->setVariable("PAGETITLE",
"- ".$a_title);
}
| ilTemplate::setTitleIcon | ( | $ | a_icon_path, | |
| $ | a_icon_desc = "" | |||
| ) |
set title icon
Definition at line 933 of file class.ilTemplate.php.
{
$this->icon_desc = $a_icon_desc;
$this->icon_path = $a_icon_path;
}
| ilTemplate::setTreeFlatIcon | ( | $ | a_link, | |
| $ | a_mode | |||
| ) |
set tree/flat icon
| string | link target | |
| strong | mode ("tree" | "flat") |
Definition at line 1047 of file class.ilTemplate.php.
References $lng, ilFrameTargetInfo::_getFrame(), ilUtil::getImagePath(), parseCurrentBlock(), and setCurrentBlock().
{
global $lng;
$this->setCurrentBlock("tree_mode");
$this->setVariable("LINK_MODE", $a_link);
$this->setVariable("IMG_TREE",ilUtil::getImagePath("ic_".$a_mode."view.gif"));
$this->setVariable("ALT_TREE",$lng->txt($a_mode."view"));
$this->setVariable("TARGET_TREE", ilFrameTargetInfo::_getFrame("MainContent"));
//echo ":".ilFrameTargetInfo::_getFrame("MainContent").":";
$this->parseCurrentBlock();
}
Here is the call graph for this function:| ilTemplate::setUpperIcon | ( | $ | a_link, | |
| $ | a_frame = "" | |||
| ) |
sets icon to upper level
Definition at line 1023 of file class.ilTemplate.php.
References $lng, ilUtil::getImagePath(), parseCurrentBlock(), and setCurrentBlock().
{
global $lng;
if ($a_frame != "")
{
$this->setCurrentBlock("target_top");
$this->setVariable("TARGET_TOP", $a_frame);
$this->parseCurrentBlock();
}
$this->setVariable("ALT_TOP", $lng->txt("up"));
$this->setCurrentBlock("top");
$this->setVariable("LINK_TOP", $a_link);
$this->setVariable("IMG_TOP",ilUtil::getImagePath("ic_top.gif"));
$this->parseCurrentBlock();
}
Here is the call graph for this function:| ilTemplate::show | ( | $ | part = "DEFAULT", |
|
| $ | a_fill_tabs = true | |||
| ) |
public
| string | ||
| bool | fill template variable {TABS} with content of ilTabs |
Definition at line 232 of file class.ilTemplate.php.
References $ilias, addErrorMessage(), addILIASFooter(), fillContentLanguage(), fillCssFiles(), fillHeaderIcon(), fillJavaScriptFiles(), fillMainMenu(), fillPageFormAction(), fillTabs(), fillWindowTitle(), getContentType(), handleReferer(), and setContentStyle().
Referenced by show().
{
global $ilias;
//echo "-".ilUtil::getP3PLocation()."-";
//header('P3P: policyref="'.ilUtil::getP3PLocation().
// '", CP="CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT CNT STA PRE"');
header('P3P: CP="CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT CNT STA PRE"');
header("Content-type: " . $this->getContentType() . "; charset=UTF-8");
$this->addErrorMessage();
// display ILIAS footer
if ($part !== false)
{
$this->addILIASFooter();
}
// set standard parts (tabs and title icon)
if($a_fill_tabs)
{
$this->setContentStyle();
$this->fillContentLanguage();
$this->fillWindowTitle();
$this->fillMainMenu();
$this->fillTabs();
$this->fillHeaderIcon();
//$this->fillNavigationHistory();
$this->fillCssFiles();
$this->fillPageFormAction();
$this->fillJavaScriptFiles();
}
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 $_SESSION, addBlockFile(), blockExists(), fillJavaScriptFiles(), and show().
{
header('Content-type: text/html; charset=UTF-8');
$this->fillJavaScriptFiles();
// 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::stopTitleFloating | ( | ) |
stop floating (if no tabs are used)
Definition at line 955 of file class.ilTemplate.php.
References touchBlock().
{
$this->touchBlock("stop_floating");
}
Here is the call graph for this function:| ilTemplate::touchBlock | ( | $ | block | ) |
overwrites ITX::touchBlock.
public
| string |
Definition at line 645 of file class.ilTemplate.php.
References fillVars(), parseCurrentBlock(), and setCurrentBlock().
Referenced by fillPageFormAction(), and stopTitleFloating().
{
$this->setCurrentBlock($block);
$count = $this->fillVars();
$this->parseCurrentBlock();
if ($count == 0)
{
parent::touchBlock($block);
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilTemplate::$activeBlock |
Definition at line 50 of file class.ilTemplate.php.
| ilTemplate::$contenttype |
Definition at line 37 of file class.ilTemplate.php.
| ilTemplate::$css_files = array() |
Definition at line 54 of file class.ilTemplate.php.
| ilTemplate::$js_files = array(0 => "Services/JavaScript/js/Basic.js") |
Definition at line 52 of file class.ilTemplate.php.
| ilTemplate::$js_files_vp = array("Services/JavaScript/js/Basic.js" => true) |
Definition at line 53 of file class.ilTemplate.php.
| ilTemplate::$vars |
Definition at line 42 of file class.ilTemplate.php.
Referenced by prepareForFormular().
1.7.1