19include_once(
"./Services/UICore/lib/html-it/IT.php");
20include_once(
"./Services/UICore/lib/html-it/ITX.php");
60 string $in_module =
"",
63 bool $a_use_cache =
true
67 $this->
template =
new ilTemplate($file, $flag1, $flag2, $in_module, $vars,
$plugin, $a_use_cache);
95 $this->show_footer =
false;
109 $ilCtrl =
$DIC->ctrl();
112 if (!$this->show_footer) {
116 $ftpl =
new ilTemplate(
"tpl.footer.html",
true,
true,
"Services/UICore");
120 $php =
", PHP " . phpversion();
124 $link_items = array();
126 $this->
http = $DIC->http();
130 if ($this->
http->wrapper()->query()->has(
'record_id')) {
131 $baseClass = $this->
http->wrapper()->query()->retrieve(
'baseClass', $this->
refinery->kindlyTo()->string());
133 if ($this->
http->wrapper()->post()->has(
'record_id')) {
134 $baseClass = $this->
http->wrapper()->post()->retrieve(
'baseClass', $this->
refinery->kindlyTo()->string());
146 if (function_exists(
"tidy_parse_string")) {
149 "do_dev_validate=xhtml"
150 )] = array(
"Validate",
true);
153 "do_dev_validate=accessibility"
154 )] = array(
"Accessibility",
true);
164 foreach ($link_items as
$url => $caption) {
167 $ftpl->touchBlock(
"blank");
169 if ($cnt <
sizeof($link_items)) {
170 $ftpl->touchBlock(
"item_separator");
173 $ftpl->setCurrentBlock(
"items");
175 $ftpl->setVariable(
"TXT_ITEM", $caption[0]);
176 $ftpl->parseCurrentBlock();
218 self::MESSAGE_TYPE_FAILURE,
219 self::MESSAGE_TYPE_INFO,
220 self::MESSAGE_TYPE_SUCCESS,
221 self::MESSAGE_TYPE_QUESTION,
227 if (!in_array(
$type, self::$message_types) || $a_txt ==
"") {
231 $this->message[
$type] = $a_txt;
246 foreach (self::$message_types as $m) {
253 $request =
$DIC->http()->request();
254 $accept_header = $request->getHeaderLine(
'Accept');
271 if (isset($this->message[$m])) {
272 $txt = $this->message[$m];
289 protected $js_files = array(0 =>
"./Services/JavaScript/js/Basic.js");
294 protected $js_files_vp = array(
"./Services/JavaScript/js/Basic.js" =>
true);
304 public function addJavaScript(
string $a_js_file,
bool $a_add_version_parameter =
true,
int $a_batch = 2): void
307 if ($a_batch < 1 || $a_batch > 3) {
312 if (is_int(strpos($a_js_file,
"Services/jQuery"))
313 || is_int(strpos($a_js_file,
"/jquery.js"))
314 || is_int(strpos($a_js_file,
"/jquery-min.js"))
319 if (!in_array($a_js_file, $this->js_files)) {
320 $this->js_files[] = $a_js_file;
321 $this->js_files_vp[$a_js_file] = $a_add_version_parameter;
322 $this->js_files_batch[$a_js_file] = $a_batch;
332 if ($a_batch < 1 || $a_batch > 3) {
335 $this->on_load_code[$a_batch][] = $a_code;
345 for (
$i = 1;
$i <= 3;
$i++) {
346 if (is_array($this->on_load_code[
$i])) {
347 foreach ($this->on_load_code[
$i] as $code) {
353 return '<script type="text/javascript">' .
"\n" .
369 $this->js_files = array();
370 $this->js_files_vp = array();
371 $this->js_files_batch = array();
387 $vers =
"vers=" . str_replace(array(
".",
" "),
"-",
ILIAS_VERSION);
390 $vers .=
'-' . time();
395 for (
$i = 0;
$i <= 3;
$i++) {
396 reset($this->js_files);
397 foreach ($this->js_files as $file) {
398 if ($this->js_files_batch[$file] ==
$i) {
399 if (is_file($file) || substr($file, 0, 4) ==
"http" || substr(
403 ) ==
"//" || $a_force) {
406 if (substr($file, 0, 2) ==
'./') {
407 $url_parts = parse_url($file);
408 if (is_file($url_parts[
'path'])) {
424 for (
$i = 1;
$i <= 3;
$i++) {
425 if (is_array($this->on_load_code[
$i])) {
427 foreach ($this->on_load_code[
$i] as $code) {
441 if ($this->js_files_vp[$file]) {
470 public function addCss(
string $a_css_file,
string $media =
"screen"): void
472 if (!array_key_exists($a_css_file . $media, $this->css_files)) {
473 $this->css_files[$a_css_file . $media] = array(
"file" => $a_css_file,
"media" => $media);
484 public function addInlineCss(
string $a_css,
string $media =
"screen"): void
486 $this->inline_css[] = array(
"css" => $a_css,
"media" => $media);
503 foreach ($this->css_files as $css) {
529 $this->body_class = $a_class;
534 if ($this->body_class !=
"" && $this->
blockExists(
"body_class")) {
536 $this->
setVariable(
"BODY_CLASS", $this->body_class);
546 $this->css_files = array();
557 foreach ($this->inline_css as $css) {
570 "LOCATION_NEWCONTENT_STYLESHEET_TAG",
571 '<link rel="stylesheet" type="text/css" href="' .
588 if ($this->standard_template_loaded) {
599 $this->
addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
600 $this->
addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
602 $this->standard_template_loaded =
true;
618 public function setTitle(
string $a_title,
bool $hidden =
false): void
620 $this->title = $a_title;
621 $this->header_page_title = $a_title;
626 $this->title_desc = $a_descr;
629 public function setTitleIcon(
string $a_icon_path,
string $a_icon_desc =
""): void
631 $this->icon_desc = $a_icon_desc;
632 $this->icon_path = $a_icon_path;
637 $this->title_alerts = $alerts;
662 $this->header_action = $a_header;
672 $this->header_page_title = $a_title;
684 $header_tpl =
new ilTemplate(
'tpl.il_header.html',
true,
true);
687 if ($this->icon_path !=
"") {
689 $header_tpl->setCurrentBlock(
"header_image");
690 if ($this->icon_desc !=
"") {
691 $header_tpl->setVariable(
"IMAGE_DESC",
$lng->txt(
"icon") .
" " . $this->icon_desc);
692 $header_tpl->setVariable(
"IMAGE_ALT",
$lng->txt(
"icon") .
" " . $this->icon_desc);
695 $header_tpl->setVariable(
"IMG_HEADER", $this->icon_path);
696 $header_tpl->parseCurrentBlock();
700 if ($this->title !=
"") {
702 $header_tpl->setVariable(
"HEADER",
$title);
708 $header_tpl->setCurrentBlock(
"header_image");
709 $header_tpl->parseCurrentBlock();
712 if ($this->title_desc !=
"") {
713 $header_tpl->setCurrentBlock(
"header_desc");
714 $header_tpl->setVariable(
"H_DESCRIPTION", $this->title_desc);
715 $header_tpl->parseCurrentBlock();
720 $header_tpl->setCurrentBlock(
"head_action_inner");
721 $header_tpl->setVariable(
"HEAD_ACTION", $header);
722 $header_tpl->parseCurrentBlock();
723 $header_tpl->touchBlock(
"head_action");
726 if (count($this->title_alerts)) {
727 foreach ($this->title_alerts as $alert) {
728 $header_tpl->setCurrentBlock(
'header_alert');
729 if (!($alert[
'propertyNameVisible'] ===
false)) {
730 $header_tpl->setVariable(
'H_PROP', $alert[
'property'] .
':');
732 $header_tpl->setVariable(
'H_VALUE', $alert[
'value']);
733 $header_tpl->parseCurrentBlock();
738 if ($this->enable_fileupload !==
null) {
740 $this->enable_fileupload,
744 $this->
template->setVariable(
745 "IL_DROPZONE_HEADER",
746 $file_upload->getDropzoneHtml()
749 $this->
template->setVariable(
"IL_HEADER", $header_tpl->get());
772 $ilLocator =
$DIC[
"ilLocator"];
778 include_once(
"./Services/UIComponent/classes/class.ilUIHookProcessor.php");
779 $html = $ilLocator->getHTML();
783 [
"locator_gui" => $ilLocator,
"html" => $html]
785 $html = $uip->getHTML($html);
787 $html = $ilLocator->getHTML();
804 public function setTabs(
string $a_tabs_html): void
806 if ($a_tabs_html !=
"" && $this->
blockExists(
"tabs_outer_start")) {
831 if ($this->tabs_html !=
"") {
834 $this->
setVariable(
"SUB_TABS", $this->sub_tabs_html);
842 $ilTabs =
$DIC[
"ilTabs"];
845 $this->sub_tabs_html = $ilTabs->getSubTabHTML();
846 $this->tabs_html = $ilTabs->getHTML(
true);
863 $this->main_content = $a_html;
872 $this->left_content = $a_html;
880 $this->left_nav_content = $a_content;
888 if (trim($this->left_nav_content) !=
"") {
890 $this->
setVariable(
"LEFT_NAV_CONTENT", $this->left_nav_content);
901 $this->right_content = $a_html;
909 $center_column_class =
"";
910 if (trim($this->right_content) !=
"" && trim($this->left_content) !=
"") {
911 $center_column_class =
"two_side_col";
913 if (trim($this->right_content) !=
"" || trim($this->left_content) !=
"") {
914 $center_column_class =
"one_side_col";
918 switch ($center_column_class) {
920 $center_column_class =
"col-sm-9";
923 $center_column_class =
"col-sm-6";
926 $center_column_class =
"col-sm-12";
929 if (trim($this->left_content) !=
"") {
930 $center_column_class .=
" col-sm-push-3";
934 $this->
setVariable(
"CENTER_COL", $center_column_class);
940 if (trim($this->main_content) !=
"") {
941 $this->
setVariable(
"ADM_CONTENT", $this->main_content);
947 if (trim($this->left_content) !=
"") {
949 $this->
setVariable(
"LEFT_CONTENT", $this->left_content);
950 $left_col_class = (trim($this->right_content) ==
"")
951 ?
"col-sm-3 col-sm-pull-9"
952 :
"col-sm-3 col-sm-pull-6";
953 $this->
setVariable(
"LEFT_COL_CLASS", $left_col_class);
960 if (trim($this->right_content) !=
"") {
962 $this->
setVariable(
"RIGHT_CONTENT", $this->right_content);
978 $ilToolbar =
$DIC[
"ilToolbar"];
980 $thtml = $ilToolbar->getHTML();
1000 if (is_object(
$lng)) {
1001 $this->
setVariable(
'META_CONTENT_LANGUAGE',
$lng->getContentLanguage());
1012 if ($this->header_page_title !=
"") {
1017 if (
$ilSetting->get(
'short_inst_name') !=
"") {
1037 $this->page_form_action = $a_action;
1042 if ($this->page_form_action !=
"") {
1044 $this->
setVariable(
"PAGE_FORM_ACTION", $this->page_form_action);
1062 $this->login_target_par = $a_val;
1089 string $part = self::DEFAULT_BLOCK,
1090 bool $add_error_mess =
false,
1091 bool $handle_referer =
false,
1092 bool $add_ilias_footer =
false,
1093 bool $add_standard_elements =
false,
1094 bool $a_main_menu =
true,
1097 if ($add_error_mess) {
1101 if ($add_ilias_footer) {
1106 if ($add_standard_elements) {
1158 if ($part ==
"DEFAULT") {
1159 $html = $this->
template->get();
1161 $html = $this->
template->get($part);
1171 string $part = self::DEFAULT_BLOCK,
1172 bool $has_tabs =
true,
1173 bool $skip_main_menu =
false
1178 switch (
$http->request()->getHeaderLine(
'Accept')) {
1179 case 'application/json':
1180 $string = json_encode([
1181 self::MESSAGE_TYPE_SUCCESS => is_null($this->message[self::MESSAGE_TYPE_FAILURE]),
1185 $http->saveResponse(
$http->response()->withBody($stream));
1186 $http->sendResponse();
1192 header(
'P3P: CP="CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT CNT STA PRE"');
1193 header(
"Content-type: text/html; charset=UTF-8");
1195 $this->fillMessage();
1198 if ($part !==
false) {
1199 $this->fillFooter();
1203 $this->fillBodyClass();
1205 if ($this->blockExists(
"content")) {
1207 $this->getTabsHTML();
1211 if (!$skip_main_menu) {
1212 $this->getMainMenu();
1217 $this->fillCssFiles();
1218 $this->fillInlineCss();
1222 $this->setCurrentBlock(
"DEFAULT");
1223 $this->fillNewContentStyle();
1224 $this->fillContentLanguage();
1225 $this->fillWindowTitle();
1228 $this->fillHeader();
1229 $this->fillSideIcons();
1230 $this->fillLeftContent();
1231 $this->fillLeftNav();
1232 $this->fillRightContent();
1233 $this->fillAdminPanel();
1234 $this->fillToolbar();
1235 $this->fillPermanentLink();
1237 $this->setCenterColumnClass();
1240 $this->fillJavaScriptFiles();
1241 $this->fillOnLoadCode();
1244 if ($this->blockExists(
"content")) {
1245 $this->setCurrentBlock(
"content");
1247 $this->fillMainContent();
1248 $this->fillMainMenu();
1249 $this->fillLightbox();
1250 $this->parseCurrentBlock();
1254 if ($part ==
"DEFAULT" or is_bool($part)) {
1255 $html = $this->
template->getUnmodified();
1257 $html = $this->
template->getUnmodified($part);
1263 $component_factory =
$DIC[
"component.factory"];
1264 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as
$plugin) {
1265 $gui_class =
$plugin->getUIClassInstance();
1267 $resp = $gui_class->getHTML(
1270 array(
"tpl_id" => $this->tplIdentifier,
"tpl_obj" => $this,
"html" => $html)
1274 $html = $gui_class->modifyHTML($html,
$resp);
1299 if ($this->tree_flat_link !=
"") {
1300 if ($this->left_nav_content !=
"") {
1301 $this->touchBlock(
"tree_lns");
1304 $this->setCurrentBlock(
"tree_mode");
1305 $this->
setVariable(
"LINK_MODE", $this->tree_flat_link);
1306 if (
$ilSetting->get(
"tree_frame") ==
"right") {
1307 if ($this->tree_flat_mode ===
"tree") {
1315 if ($this->tree_flat_mode ==
"tree") {
1321 $this->
setVariable(
"ALT_TREE",
$lng->txt($this->tree_flat_mode .
"view"));
1323 $this->parseCurrentBlock();
1326 $this->setCurrentBlock(
"tree_icons");
1327 $this->parseCurrentBlock();
1332 $this->tree_flat_link = $a_link;
1333 $this->tree_flat_mode = $a_mode;
1338 $this->lightbox[$a_id] = $a_html;
1348 $html = implode(
'', $this->lightbox);
1360 protected ?
bool $admin_panel_arrow =
null;
1361 protected ?
bool $admin_panel_bottom =
null;
1365 bool $is_bottom_panel =
true,
1366 bool $has_arrow =
false
1368 $this->admin_panel_commands_toolbar = $toolbar;
1369 $this->admin_panel_arrow = $has_arrow;
1370 $this->admin_panel_bottom = $is_bottom_panel;
1383 if ($this->admin_panel_commands_toolbar ===
null) {
1387 $toolb = $this->admin_panel_commands_toolbar;
1390 if ($this->admin_panel_arrow) {
1394 $this->fillPageFormAction();
1397 $this->setCurrentBlock(
"adm_view_components");
1398 $this->
setVariable(
"ADM_PANEL1", $toolb->getHTML());
1399 $this->parseCurrentBlock();
1402 if ($this->admin_panel_bottom) {
1403 $this->setCurrentBlock(
"adm_view_components2");
1406 if ($this->admin_panel_arrow) {
1410 $this->
setVariable(
"ADM_PANEL2", $toolb->getHTML());
1411 $this->parseCurrentBlock();
1418 string $a_append =
"",
1419 string $a_target =
"",
1420 string $a_title =
""
1422 $this->permanent_link = array(
1425 "append" => $a_append,
1426 "target" => $a_target,
1427 "title" => $a_title,
1436 if (is_array($this->permanent_link)) {
1438 $this->permanent_link[
"type"],
1439 $this->permanent_link[
"id"],
1440 $this->permanent_link[
"append"],
1441 $this->permanent_link[
"target"]
1443 if ($this->permanent_link[
"title"] !=
"") {
1444 $plinkgui->setTitle($this->permanent_link[
"title"]);
1446 $this->
setVariable(
"PRMLINK", $plinkgui->getHTML());
1455 $this->setTitle(
null);
1456 $this->setTitleIcon(
null);
1457 $this->setDescription(
null);
1458 $this->setAlertProperties(array());
1459 $this->setFileUploadRefId(
null);
1462 if ($a_reset_header_action) {
1463 $this->setHeaderActionMenu(
null);
1472 $this->enable_fileupload = $a_ref_id;
1484 public function get(
string $part =
"DEFAULT"):
string
1486 return $this->
template->get($part);
1491 $this->
template->setVariable($variable, $value);
1496 return $this->
template->variableExists($a_variablename);
1501 return $this->
template->setCurrentBlock($part);
1506 return $this->
template->touchBlock($block);
1511 return $this->
template->parseCurrentBlock($block_name);
1514 public function addBlockFile(
string $var,
string $block,
string $template_name,
string $in_module =
null): bool
1516 return $this->
template->addBlockFile($var, $block, $template_name, $in_module);
1521 return $this->
template->blockExists($block_name);
static ofString(string $string)
Creates a new stream with an initial value.
setVariable(string $a_group_name, string $a_var_name, string $a_var_value)
sets a variable in a group
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillJavascriptFile(string $file, string $vers)
$inline_css
Stores CSS to be included directly.
fillLeftNav()
Fill left navigation frame.
fillNewContentStyle()
Fill Content Style.
loadStandardTemplate()
This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STA...
addInlineCss(string $a_css, string $media="screen")
Add a css file that should be included in the header.
setCurrentBlock(string $part="DEFAULT")
Sets the template to the given block.
fillAdminPanel()
Put admin panel into template:
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
setSubTabs(string $a_tabs_html)
sets subtabs in standard template
setContent(string $a_html)
Sets content for standard template.
fillCssFiles(bool $a_force=false)
Fill in the css file tags.
ILIAS Refinery Factory $refinery
fillOnLoadCode()
Fill add on load code.
fillFooter()
Fill the footer area.
getOnLoadCodeForAsynch()
Get js onload code for ajax calls.
addBlockFile(string $var, string $block, string $template_name, string $in_module=null)
overwrites ITX::addBlockFile
__construct(string $file, bool $flag1, bool $flag2, string $in_module="", string $vars=ilGlobalTemplateInterface::DEFAULT_BLOCK, bool $plugin=false, bool $a_use_cache=true)
constructor
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
getHeaderActionMenu()
Get header action menu.
resetJavascript()
Reset javascript files.
parseCurrentBlock(string $block_name="DEFAULT")
Parses the given block.
resetCss()
Reset css files.
addAdminPanelToolbar(ilToolbarGUI $toolbar, bool $is_bottom_panel=true, bool $has_arrow=false)
Add admin panel commands as toolbar.
$standard_template_loaded
setFileUploadRefId(int $a_ref_id)
Enables the file upload into this object by dropping a file.
setLeftNavContent(string $a_content)
Sets content of left navigation column.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setHeaderActionMenu(string $a_header)
Set header action menu.
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setHeaderPageTitle(string $a_title)
Sets the title of the page (for browser window).
resetHeaderBlock(bool $a_reset_header_action=true)
Reset all header properties: title, icon, description, alerts, action menu.
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
setLoginTargetPar(string $a_val)
Set target parameter for login (public sector).
getSpecial(string $part=self::DEFAULT_BLOCK, bool $add_error_mess=false, bool $handle_referer=false, bool $add_ilias_footer=false, bool $add_standard_elements=false, bool $a_main_menu=true, bool $a_tabs=true)
Renders the page with specific elements enabled.
setLeftContent(string $a_html)
Sets content of left column.
fillPermanentLink()
Fill in permanent link.
setLocator()
Insert locator.
variableExists(string $a_variablename)
fillMessage()
Fill message area.
getLoginTargetPar()
Get target parameter for login.
fillSideIcons()
Fill side icons (upper icon, tree icon, web folder icon)
hideFooter()
Make the template hide the footer.
printToString()
Use this method to get the finally rendered page as string.
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setRightContent(string $a_html)
Sets content of right column.
fillInlineCss()
Fill in the inline css.
clearHeader()
Clear header.
ILIAS HTTP Services $http
fillJavaScriptFiles(bool $a_force=false)
Probably adds javascript files.
fillContentLanguage()
Add current user language to meta tags.
touchBlock(string $block)
overwrites ITX::touchBlock.
addLightbox(string $a_html, string $a_id)
Add a lightbox html to the template.
setAlertProperties(array $alerts)
Set alert properties.
string $header_page_title
setTabs(string $a_tabs_html)
sets tabs in standard template
fillLightbox()
Fill lightbox content.
blockExists(string $block_name)
check if block exists in actual template
setDescription(string $a_descr)
Sets description below title in standard template.
getMessageTextForType(string $m)
printToStdout(string $part=self::DEFAULT_BLOCK, bool $has_tabs=true, bool $skip_main_menu=false)
setPageFormAction(string $a_action)
Sets the pages form action.
setTreeFlatIcon(string $a_link, string $a_mode)
Sets a tree or flat icon.
setBodyClass(string $a_class="")
Sets the body-tags class.
addCss(string $a_css_file, string $media="screen")
Add a css file that should be included in the header.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
Get static link.
static _saveUsages()
Store the collected language variable usages in the user session This should be called as late as pos...
static _checkTranslate()
Permission check for translations.
static _isPageTranslation()
Check if the current request is a page translation.
static _getTranslationLink()
Get the link to translate the current page.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
special template class to simplify handling of ITX/PEAR
static init(ilGlobalTemplateInterface $template=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
static secureUrl(string $url)
static getNewContentStyleSheetLocation(string $mode="output")
get full style sheet file name (path inclusive) of current user
static stripScriptHTML(string $a_str, string $a_allow="", bool $a_rm_js=true)
static initDom(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Dom.
static initjQueryUI(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components....
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.