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) {
478 $this->
addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
479 $this->
addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
481 $this->standard_template_loaded =
true;
497 public function setTitle(
string $a_title,
bool $hidden =
false): void
499 $this->title = $a_title;
500 $this->header_page_title = $a_title;
505 $this->title_desc = $a_descr;
508 public function setTitleIcon(
string $a_icon_path,
string $a_icon_desc =
""): void
510 $this->icon_desc = $a_icon_desc;
511 $this->icon_path = $a_icon_path;
516 $this->title_alerts = $alerts;
541 $this->header_action = $a_header;
551 $this->header_page_title = $a_title;
559 $header_tpl =
new ilTemplate(
'tpl.il_header.html',
true,
true);
563 if ($this->icon_path !=
"") {
564 $header_tpl->setCurrentBlock(
"header_image");
565 if ($this->icon_desc !=
"") {
566 $header_tpl->setVariable(
"IMAGE_DESC", $this->
lng->txt(
"icon") .
" " . $this->icon_desc);
567 $header_tpl->setVariable(
"IMAGE_ALT", $this->
lng->txt(
"icon") .
" " . $this->icon_desc);
570 $header_tpl->setVariable(
"IMG_HEADER", $this->icon_path);
571 $header_tpl->parseCurrentBlock();
575 if ($this->title !=
"") {
577 $header_tpl->setVariable(
"HEADER",
$title);
583 $header_tpl->setCurrentBlock(
"header_image");
584 $header_tpl->parseCurrentBlock();
587 if ($this->title_desc !=
"") {
588 $header_tpl->setCurrentBlock(
"header_desc");
589 $header_tpl->setVariable(
"H_DESCRIPTION", $this->title_desc);
590 $header_tpl->parseCurrentBlock();
595 $header_tpl->setCurrentBlock(
"head_action_inner");
596 $header_tpl->setVariable(
"HEAD_ACTION", $header);
597 $header_tpl->parseCurrentBlock();
598 $header_tpl->touchBlock(
"head_action");
601 if (count($this->title_alerts)) {
602 foreach ($this->title_alerts as $alert) {
603 $header_tpl->setCurrentBlock(
'header_alert');
604 if (!($alert[
'propertyNameVisible'] ===
false)) {
605 $header_tpl->setVariable(
'H_PROP', $alert[
'property'] .
':');
607 $header_tpl->setVariable(
'H_VALUE', $alert[
'value']);
608 $header_tpl->parseCurrentBlock();
612 $this->
template->setVariable(
"IL_HEADER", $header_tpl->get());
634 include_once(
"./components/ILIAS/UIComponent/classes/class.ilUIHookProcessor.php");
635 $html = $this->
locator->getHTML();
637 "components/ILIAS/Locator",
639 [
"locator_gui" => $this->
locator,
"html" => $html]
641 $html = $uip->getHTML($html);
658 public function setTabs(
string $a_tabs_html): void
660 if ($a_tabs_html !=
"" && $this->
blockExists(
"tabs_outer_start")) {
685 if ($this->tabs_html !=
"") {
688 $this->
setVariable(
"SUB_TABS", $this->sub_tabs_html);
695 $this->sub_tabs_html = $this->
tabs->getSubTabHTML();
696 $this->tabs_html = $this->
tabs->getHTML(
true);
713 $this->main_content = $a_html;
722 $this->left_content = $a_html;
730 $this->left_nav_content = $a_content;
738 if (trim($this->left_nav_content) !=
"") {
740 $this->
setVariable(
"LEFT_NAV_CONTENT", $this->left_nav_content);
751 $this->right_content = $a_html;
759 $center_column_class =
"";
760 if (trim($this->right_content) !=
"" && trim($this->left_content) !=
"") {
761 $center_column_class =
"two_side_col";
763 if (trim($this->right_content) !=
"" || trim($this->left_content) !=
"") {
764 $center_column_class =
"one_side_col";
768 switch ($center_column_class) {
770 $center_column_class =
"col-sm-9";
773 $center_column_class =
"col-sm-6";
776 $center_column_class =
"col-sm-12";
779 if (trim($this->left_content) !=
"") {
780 $center_column_class .=
" col-sm-push-3";
784 $this->
setVariable(
"CENTER_COL", $center_column_class);
790 if (trim($this->main_content) !=
"") {
791 $this->
setVariable(
"ADM_CONTENT", $this->main_content);
797 if (trim($this->left_content) !=
"") {
799 $this->
setVariable(
"LEFT_CONTENT", $this->left_content);
800 $left_col_class = (trim($this->right_content) ==
"")
801 ?
"col-sm-3 col-sm-pull-9"
802 :
"col-sm-3 col-sm-pull-6";
803 $this->
setVariable(
"LEFT_COL_CLASS", $left_col_class);
810 if (trim($this->right_content) !=
"") {
812 $this->
setVariable(
"RIGHT_CONTENT", $this->right_content);
826 $thtml = $this->
toolbar->getHTML();
843 $this->
setVariable(
'META_CONTENT_LANGUAGE', $this->
lng->getContentLanguage());
844 $this->
setVariable(
'LANGUAGE_DIRECTION', $this->
lng->getTextDirection());
849 if ($this->header_page_title !=
"") {
854 if ($this->
settings->get(
'short_inst_name') !=
"") {
857 $this->
settings->get(
'short_inst_name')
874 $this->page_form_action = $a_action;
879 if ($this->page_form_action !=
"") {
881 $this->
setVariable(
"PAGE_FORM_ACTION", $this->page_form_action);
899 $this->login_target_par = $a_val;
918 string $part = self::DEFAULT_BLOCK,
919 bool $add_error_mess =
false,
920 bool $handle_referer =
false,
921 bool $add_ilias_footer =
false,
922 bool $add_standard_elements =
false,
923 bool $a_main_menu =
true,
926 if ($add_error_mess) {
931 if ($add_standard_elements) {
981 if ($part ==
"DEFAULT") {
982 $html = $this->
template->get();
984 $html = $this->
template->get($part);
994 string $part = self::DEFAULT_BLOCK,
995 bool $has_tabs =
true,
996 bool $skip_main_menu =
false
998 switch ($this->
http->request()->getHeaderLine(
'Accept')) {
999 case 'application/json':
1000 $string = json_encode([
1001 self::MESSAGE_TYPE_SUCCESS => is_null($this->message[self::MESSAGE_TYPE_FAILURE]),
1005 $this->
http->saveResponse($this->
http->response()->withBody($stream));
1006 $this->
http->sendResponse();
1012 header(
'P3P: CP="CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT CNT STA PRE"');
1013 header(
"Content-type: text/html; charset=UTF-8");
1015 $this->fillMessage();
1018 $this->fillBodyClass();
1020 if ($this->blockExists(
"content")) {
1022 $this->getTabsHTML();
1026 if (!$skip_main_menu) {
1027 $this->getMainMenu();
1032 $this->fillCssFiles();
1033 $this->fillInlineCss();
1037 $this->setCurrentBlock();
1038 $this->fillNewContentStyle();
1039 $this->fillContentLanguage();
1040 $this->fillWindowTitle();
1043 $this->fillHeader();
1044 $this->fillSideIcons();
1045 $this->fillLeftContent();
1046 $this->fillLeftNav();
1047 $this->fillRightContent();
1048 $this->fillAdminPanel();
1049 $this->fillToolbar();
1051 $this->setCenterColumnClass();
1054 $this->fillJavaScriptFiles();
1055 $this->fillOnLoadCode();
1058 if ($this->blockExists(
"content")) {
1059 $this->setCurrentBlock(
"content");
1061 $this->fillMainContent();
1062 $this->fillMainMenu();
1063 $this->parseCurrentBlock();
1067 if ($part ==
"DEFAULT" or is_bool($part)) {
1068 $html = $this->
template->getUnmodified();
1070 $html = $this->
template->getUnmodified($part);
1076 foreach ($this->component_factory->getActivePluginsInSlot(
"uihk") as
$plugin) {
1077 $gui_class =
$plugin->getUIClassInstance();
1079 $resp = $gui_class->getHTML(
1082 [
"tpl_id" => $this->tplIdentifier,
"tpl_obj" => $this,
"html" => $html]
1086 $html = $gui_class->modifyHTML($html,
$resp);
1105 if ($this->tree_flat_link !=
"") {
1106 if ($this->left_nav_content !=
"") {
1107 $this->touchBlock(
"tree_lns");
1110 $this->setCurrentBlock(
"tree_mode");
1111 $this->
setVariable(
"LINK_MODE", $this->tree_flat_link);
1112 if ($this->
settings->get(
"tree_frame") ==
"right") {
1118 $this->
setVariable(
"ALT_TREE", $this->
lng->txt($this->tree_flat_mode .
"view"));
1120 $this->parseCurrentBlock();
1123 $this->setCurrentBlock(
"tree_icons");
1124 $this->parseCurrentBlock();
1129 $this->tree_flat_link = $a_link;
1130 $this->tree_flat_mode = $a_mode;
1141 protected ?
bool $admin_panel_arrow =
null;
1142 protected ?
bool $admin_panel_bottom =
null;
1146 bool $is_bottom_panel =
true,
1147 bool $has_arrow =
false
1149 $this->admin_panel_commands_toolbar = $toolbar;
1150 $this->admin_panel_arrow = $has_arrow;
1151 $this->admin_panel_bottom = $is_bottom_panel;
1161 if ($this->admin_panel_commands_toolbar ===
null) {
1165 $toolb = $this->admin_panel_commands_toolbar;
1168 if ($this->admin_panel_arrow) {
1172 $this->fillPageFormAction();
1175 $this->setCurrentBlock(
"adm_view_components");
1176 $this->
setVariable(
"ADM_PANEL1", $toolb->getHTML());
1177 $this->parseCurrentBlock();
1180 if ($this->admin_panel_bottom) {
1181 $this->setCurrentBlock(
"adm_view_components2");
1184 if ($this->admin_panel_arrow) {
1188 $this->
setVariable(
"ADM_PANEL2", $toolb->getHTML());
1189 $this->parseCurrentBlock();
1196 string $a_append =
"",
1197 string $a_target =
"",
1198 string $a_title =
""
1200 $this->permanent_link = [
1203 "append" => $a_append,
1204 "target" => $a_target,
1205 "title" => $a_title,
1214 $this->setTitle(
"");
1215 $this->setTitleIcon(
"");
1216 $this->setDescription(
"");
1217 $this->setAlertProperties([]);
1218 $this->setFileUploadRefId(0);
1221 if ($a_reset_header_action) {
1222 $this->setHeaderActionMenu(
"");
1231 $this->enable_fileupload =
false;
1243 public function get(
string $part =
"DEFAULT"):
string
1245 return $this->
template->get($part);
1250 $this->
template->setVariable($variable, $value);
1255 return $this->
template->setCurrentBlock($part);
1260 return $this->
template->touchBlock($block);
1265 return $this->
template->parseCurrentBlock($block_name);
1268 public function addBlockFile(
string $var,
string $block,
string $template_name, ?
string $in_module =
null): bool
1270 return $this->
template->addBlockFile($var, $block, $template_name, $in_module);
1275 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 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
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'))