19declare(strict_types=1);
53 string $in_module =
"",
56 bool $a_use_cache =
true
61 $this->
lng = $DIC->language();
62 $this->
http = $DIC->http();
63 $this->
locator = $DIC[
"ilLocator"];
64 $this->
tabs = $DIC->tabs();
65 $this->
toolbar = $DIC->toolbar();
67 $this->component_factory =
$DIC[
"component.factory"];
69 $this->
template =
new ilTemplate($file, $flag1, $flag2, $in_module, $vars,
$plugin, $a_use_cache);
126 if (!in_array($type, self::$message_types) || $a_txt ==
"") {
130 $this->message[$type] = $a_txt;
143 foreach (self::$message_types as $m) {
150 $request = $this->
http->request();
151 $accept_header = $request->getHeaderLine(
'Accept');
168 if (isset($this->message[$m])) {
169 $txt = $this->message[$m];
186 protected array
$js_files = [0 =>
"assets/js/Basic.js"];
201 public function addJavaScript(
string $a_js_file,
bool $a_add_version_parameter =
true,
int $a_batch = 2): void
204 if ($a_batch < 1 || $a_batch > 3) {
209 if (is_int(strpos($a_js_file,
"components/ILIAS/jQuery"))
210 || is_int(strpos($a_js_file,
"/jquery.js"))
211 || is_int(strpos($a_js_file,
"/jquery-min.js"))
216 if (!in_array($a_js_file, $this->js_files)) {
217 $this->js_files[] = $a_js_file;
218 $this->js_files_vp[$a_js_file] = $a_add_version_parameter;
219 $this->js_files_batch[$a_js_file] = $a_batch;
229 if ($a_batch < 1 || $a_batch > 3) {
232 $this->on_load_code[$a_batch][] = $a_code;
242 for ($i = 1; $i <= 3; $i++) {
243 if (is_array($this->on_load_code[$i])) {
244 foreach ($this->on_load_code[$i] as $code) {
250 return '<script type="text/javascript">' .
"\n" .
266 $this->js_files = [];
267 $this->js_files_vp = [];
268 $this->js_files_batch = [];
279 $vers =
"vers=" . str_replace([
".",
" "],
"-",
ILIAS_VERSION);
282 $vers .=
'-' . time();
287 for ($i = 0; $i <= 3; $i++) {
288 reset($this->js_files);
289 foreach ($this->js_files as $file) {
290 if ($this->js_files_batch[$file] == $i) {
291 if (is_file($file) || substr($file, 0, 4) ==
"http" || substr(
295 ) ==
"//" || $a_force) {
298 if (substr($file, 0, 2) ==
'./') {
299 $url_parts = parse_url($file);
300 if (is_file($url_parts[
'path'])) {
316 for ($i = 1; $i <= 3; $i++) {
317 if (is_array($this->on_load_code[$i])) {
319 foreach ($this->on_load_code[$i] as $code) {
333 if ($this->js_files_vp[$file]) {
360 public function addCss(
string $a_css_file,
string $media =
"screen"): void
362 if (!array_key_exists($a_css_file . $media, $this->css_files)) {
363 $this->css_files[$a_css_file . $media] = [
"file" => $a_css_file,
"media" => $media];
374 public function addInlineCss(
string $a_css,
string $media =
"screen"): void
376 $this->inline_css[] = [
"css" => $a_css,
"media" => $media];
393 foreach ($this->css_files as $css) {
419 $this->body_class = $a_class;
424 if ($this->body_class !=
"" && $this->
blockExists(
"body_class")) {
426 $this->
setVariable(
"BODY_CLASS", $this->body_class);
439 foreach ($this->inline_css as $css) {
452 "LOCATION_NEWCONTENT_STYLESHEET_TAG",
453 '<link rel="stylesheet" type="text/css" href="' .
470 if ($this->standard_template_loaded) {
477 $this->
addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
478 $this->
addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
480 $this->standard_template_loaded =
true;
496 public function setTitle(
string $a_title,
bool $hidden =
false): void
498 $this->title = $a_title;
499 $this->header_page_title = $a_title;
504 $this->title_desc = $a_descr;
507 public function setTitleIcon(
string $a_icon_path,
string $a_icon_desc =
""): void
509 $this->icon_desc = $a_icon_desc;
510 $this->icon_path = $a_icon_path;
515 $this->title_alerts = $alerts;
540 $this->header_action = $a_header;
550 $this->header_page_title = $a_title;
558 $header_tpl =
new ilTemplate(
'tpl.il_header.html',
true,
true);
562 if ($this->icon_path !=
"") {
563 $header_tpl->setCurrentBlock(
"header_image");
564 if ($this->icon_desc !=
"") {
565 $header_tpl->setVariable(
"IMAGE_DESC", $this->
lng->txt(
"icon") .
" " . $this->icon_desc);
566 $header_tpl->setVariable(
"IMAGE_ALT", $this->
lng->txt(
"icon") .
" " . $this->icon_desc);
569 $header_tpl->setVariable(
"IMG_HEADER", $this->icon_path);
570 $header_tpl->parseCurrentBlock();
574 if ($this->title !=
"") {
576 $header_tpl->setVariable(
"HEADER",
$title);
582 $header_tpl->setCurrentBlock(
"header_image");
583 $header_tpl->parseCurrentBlock();
586 if ($this->title_desc !=
"") {
587 $header_tpl->setCurrentBlock(
"header_desc");
588 $header_tpl->setVariable(
"H_DESCRIPTION", $this->title_desc);
589 $header_tpl->parseCurrentBlock();
594 $header_tpl->setCurrentBlock(
"head_action_inner");
595 $header_tpl->setVariable(
"HEAD_ACTION", $header);
596 $header_tpl->parseCurrentBlock();
597 $header_tpl->touchBlock(
"head_action");
600 if (count($this->title_alerts)) {
601 foreach ($this->title_alerts as $alert) {
602 $header_tpl->setCurrentBlock(
'header_alert');
603 if (!($alert[
'propertyNameVisible'] ===
false)) {
604 $header_tpl->setVariable(
'H_PROP', $alert[
'property'] .
':');
606 $header_tpl->setVariable(
'H_VALUE', $alert[
'value']);
607 $header_tpl->parseCurrentBlock();
611 $this->
template->setVariable(
"IL_HEADER", $header_tpl->get());
633 include_once(
"./components/ILIAS/UIComponent/classes/class.ilUIHookProcessor.php");
634 $html = $this->
locator->getHTML();
636 "components/ILIAS/Locator",
638 [
"locator_gui" => $this->
locator,
"html" => $html]
640 $html = $uip->getHTML($html);
657 public function setTabs(
string $a_tabs_html): void
659 if ($a_tabs_html !=
"" && $this->
blockExists(
"tabs_outer_start")) {
684 if ($this->tabs_html !=
"") {
687 $this->
setVariable(
"SUB_TABS", $this->sub_tabs_html);
694 $this->sub_tabs_html = $this->
tabs->getSubTabHTML();
695 $this->tabs_html = $this->
tabs->getHTML(
true);
712 $this->main_content = $a_html;
721 $this->left_content = $a_html;
729 $this->left_nav_content = $a_content;
737 if (trim($this->left_nav_content) !=
"") {
739 $this->
setVariable(
"LEFT_NAV_CONTENT", $this->left_nav_content);
750 $this->right_content = $a_html;
758 $center_column_class =
"";
759 if (trim($this->right_content) !=
"" && trim($this->left_content) !=
"") {
760 $center_column_class =
"two_side_col";
762 if (trim($this->right_content) !=
"" || trim($this->left_content) !=
"") {
763 $center_column_class =
"one_side_col";
767 switch ($center_column_class) {
769 $center_column_class =
"col-sm-9";
772 $center_column_class =
"col-sm-6";
775 $center_column_class =
"col-sm-12";
778 if (trim($this->left_content) !=
"") {
779 $center_column_class .=
" col-sm-push-3";
783 $this->
setVariable(
"CENTER_COL", $center_column_class);
789 if (trim($this->main_content) !=
"") {
790 $this->
setVariable(
"ADM_CONTENT", $this->main_content);
796 if (trim($this->left_content) !=
"") {
798 $this->
setVariable(
"LEFT_CONTENT", $this->left_content);
799 $left_col_class = (trim($this->right_content) ==
"")
800 ?
"col-sm-3 col-sm-pull-9"
801 :
"col-sm-3 col-sm-pull-6";
802 $this->
setVariable(
"LEFT_COL_CLASS", $left_col_class);
809 if (trim($this->right_content) !=
"") {
811 $this->
setVariable(
"RIGHT_CONTENT", $this->right_content);
825 $thtml = $this->
toolbar->getHTML();
842 $this->
setVariable(
'META_CONTENT_LANGUAGE', $this->
lng->getContentLanguage());
843 $this->
setVariable(
'LANGUAGE_DIRECTION', $this->
lng->getTextDirection());
848 if ($this->header_page_title !=
"") {
853 if ($this->
settings->get(
'short_inst_name') !=
"") {
856 $this->
settings->get(
'short_inst_name')
873 $this->page_form_action = $a_action;
878 if ($this->page_form_action !=
"") {
880 $this->
setVariable(
"PAGE_FORM_ACTION", $this->page_form_action);
898 $this->login_target_par = $a_val;
917 string $part = self::DEFAULT_BLOCK,
918 bool $add_error_mess =
false,
919 bool $handle_referer =
false,
920 bool $add_ilias_footer =
false,
921 bool $add_standard_elements =
false,
922 bool $a_main_menu =
true,
925 if ($add_error_mess) {
930 if ($add_standard_elements) {
980 if ($part ==
"DEFAULT") {
981 $html = $this->
template->get();
983 $html = $this->
template->get($part);
993 string $part = self::DEFAULT_BLOCK,
994 bool $has_tabs =
true,
995 bool $skip_main_menu =
false
997 switch ($this->
http->request()->getHeaderLine(
'Accept')) {
998 case 'application/json':
999 $string = json_encode([
1000 self::MESSAGE_TYPE_SUCCESS => is_null($this->message[self::MESSAGE_TYPE_FAILURE]),
1004 $this->
http->saveResponse($this->
http->response()->withBody($stream));
1005 $this->
http->sendResponse();
1008 header(
'P3P: CP="CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT CNT STA PRE"');
1009 header(
"Content-type: text/html; charset=UTF-8");
1011 $this->fillMessage();
1014 $this->fillBodyClass();
1016 if ($this->blockExists(
"content")) {
1018 $this->getTabsHTML();
1022 if (!$skip_main_menu) {
1023 $this->getMainMenu();
1028 $this->fillCssFiles();
1029 $this->fillInlineCss();
1033 $this->setCurrentBlock();
1034 $this->fillNewContentStyle();
1035 $this->fillContentLanguage();
1036 $this->fillWindowTitle();
1039 $this->fillHeader();
1040 $this->fillSideIcons();
1041 $this->fillLeftContent();
1042 $this->fillLeftNav();
1043 $this->fillRightContent();
1044 $this->fillAdminPanel();
1045 $this->fillToolbar();
1047 $this->setCenterColumnClass();
1050 $this->fillJavaScriptFiles();
1051 $this->fillOnLoadCode();
1054 if ($this->blockExists(
"content")) {
1055 $this->setCurrentBlock(
"content");
1057 $this->fillMainContent();
1058 $this->fillMainMenu();
1059 $this->parseCurrentBlock();
1063 if ($part ==
"DEFAULT" or is_bool($part)) {
1064 $html = $this->
template->getUnmodified();
1066 $html = $this->
template->getUnmodified($part);
1072 foreach ($this->component_factory->getActivePluginsInSlot(
"uihk") as
$plugin) {
1073 $gui_class =
$plugin->getUIClassInstance();
1075 $resp = $gui_class->getHTML(
1078 [
"tpl_id" => $this->tplIdentifier,
"tpl_obj" => $this,
"html" => $html]
1082 $html = $gui_class->modifyHTML($html,
$resp);
1101 if ($this->tree_flat_link !=
"") {
1102 if ($this->left_nav_content !=
"") {
1103 $this->touchBlock(
"tree_lns");
1106 $this->setCurrentBlock(
"tree_mode");
1107 $this->
setVariable(
"LINK_MODE", $this->tree_flat_link);
1108 if ($this->
settings->get(
"tree_frame") ==
"right") {
1114 $this->
setVariable(
"ALT_TREE", $this->
lng->txt($this->tree_flat_mode .
"view"));
1116 $this->parseCurrentBlock();
1119 $this->setCurrentBlock(
"tree_icons");
1120 $this->parseCurrentBlock();
1125 $this->tree_flat_link = $a_link;
1126 $this->tree_flat_mode = $a_mode;
1137 protected ?
bool $admin_panel_arrow =
null;
1138 protected ?
bool $admin_panel_bottom =
null;
1142 bool $is_bottom_panel =
true,
1143 bool $has_arrow =
false
1145 $this->admin_panel_commands_toolbar = $toolbar;
1146 $this->admin_panel_arrow = $has_arrow;
1147 $this->admin_panel_bottom = $is_bottom_panel;
1157 if ($this->admin_panel_commands_toolbar ===
null) {
1161 $toolb = $this->admin_panel_commands_toolbar;
1164 if ($this->admin_panel_arrow) {
1168 $this->fillPageFormAction();
1171 $this->setCurrentBlock(
"adm_view_components");
1172 $this->
setVariable(
"ADM_PANEL1", $toolb->getHTML());
1173 $this->parseCurrentBlock();
1176 if ($this->admin_panel_bottom) {
1177 $this->setCurrentBlock(
"adm_view_components2");
1180 if ($this->admin_panel_arrow) {
1184 $this->
setVariable(
"ADM_PANEL2", $toolb->getHTML());
1185 $this->parseCurrentBlock();
1192 string $a_append =
"",
1193 string $a_target =
"",
1194 string $a_title =
""
1196 $this->permanent_link = [
1199 "append" => $a_append,
1200 "target" => $a_target,
1201 "title" => $a_title,
1210 $this->setTitle(
"");
1211 $this->setTitleIcon(
"");
1212 $this->setDescription(
"");
1213 $this->setAlertProperties([]);
1214 $this->setFileUploadRefId(0);
1217 if ($a_reset_header_action) {
1218 $this->setHeaderActionMenu(
"");
1227 $this->enable_fileupload =
false;
1239 public function get(
string $part =
"DEFAULT"):
string
1241 return $this->
template->get($part);
1246 $this->
template->setVariable($variable, $value);
1251 return $this->
template->setCurrentBlock($part);
1256 return $this->
template->touchBlock($block);
1261 return $this->
template->parseCurrentBlock($block_name);
1264 public function addBlockFile(
string $var,
string $block,
string $template_name, ?
string $in_module =
null): bool
1266 return $this->
template->addBlockFile($var, $block, $template_name, $in_module);
1271 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
fillJavascriptFile(string $file, string $vers)
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.
ilComponentFactory $component_factory
fillAdminPanel()
Put admin panel into template:
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
array $css_files
Stores CSS-files to be included.
setSubTabs(string $a_tabs_html)
sets subtabs in standard template
bool $standard_template_loaded
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.
getOnLoadCodeForAsynch()
Get js onload code for ajax calls.
__construct(string $file, bool $flag1, bool $flag2, string $in_module="", string $vars=ilGlobalTemplateInterface::DEFAULT_BLOCK, bool $plugin=false, bool $a_use_cache=true)
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.
static array $message_types
addAdminPanelToolbar(ilToolbarGUI $toolbar, bool $is_bottom_panel=true, bool $has_arrow=false)
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).
array $inline_css
Stores CSS to be included directly.
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.
setLocator()
Insert locator.
fillMessage()
Fill message area.
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.
addBlockFile(string $var, string $block, string $template_name, ?string $in_module=null)
overwrites ITX::addBlockFile
fillContentLanguage()
Add current user language to meta tags.
touchBlock(string $block)
overwrites ITX::touchBlock.
setAlertProperties(array $alerts)
Set alert properties.
string $header_page_title
setTabs(string $a_tabs_html)
sets tabs in standard template
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.
Base class for ILIAS Exception handling.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _saveUsages()
Store the collected language variable usages in the user session This should be called as late as pos...
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $image_name, 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 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 initjQuery(?ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
const MESSAGE_TYPE_QUESTION
const MESSAGE_TYPE_SUCCESS
const MESSAGE_TYPE_FAILURE
static http()
Fetches the global http state from ILIAS.
if(!file_exists('../ilias.ini.php'))