20 declare(strict_types=1);
22 include_once(
"./Services/UICore/lib/html-it/IT.php");
23 include_once(
"./Services/UICore/lib/html-it/ITX.php");
57 string $in_module =
"",
60 bool $a_use_cache =
true 65 $this->
lng = $DIC->language();
66 $this->
http = $DIC->http();
67 $this->
locator = $DIC[
"ilLocator"];
68 $this->
tabs = $DIC->tabs();
69 $this->
toolbar = $DIC->toolbar();
71 $this->component_factory = $DIC[
"component.factory"];
73 $this->
template =
new ilTemplate($file, $flag1, $flag2, $in_module, $vars,
$plugin, $a_use_cache);
121 self::MESSAGE_TYPE_FAILURE,
122 self::MESSAGE_TYPE_INFO,
123 self::MESSAGE_TYPE_SUCCESS,
124 self::MESSAGE_TYPE_QUESTION,
130 if (!in_array($type, self::$message_types) || $a_txt ==
"") {
134 $this->message[$type] = $a_txt;
147 foreach (self::$message_types as $m) {
154 $request = $this->
http->request();
155 $accept_header = $request->getHeaderLine(
'Accept');
172 if (isset($this->message[$m])) {
173 $txt = $this->message[$m];
190 protected array
$js_files = [0 =>
"./Services/JavaScript/js/Basic.js"];
195 protected array
$js_files_vp = [
"./Services/JavaScript/js/Basic.js" =>
true];
205 public function addJavaScript(
string $a_js_file,
bool $a_add_version_parameter =
true,
int $a_batch = 2): void
208 if ($a_batch < 1 || $a_batch > 3) {
213 if (is_int(strpos($a_js_file,
"Services/jQuery"))
214 || is_int(strpos($a_js_file,
"/jquery.js"))
215 || is_int(strpos($a_js_file,
"/jquery-min.js"))
220 if (!in_array($a_js_file, $this->js_files)) {
221 $this->js_files[] = $a_js_file;
222 $this->js_files_vp[$a_js_file] = $a_add_version_parameter;
223 $this->js_files_batch[$a_js_file] = $a_batch;
233 if ($a_batch < 1 || $a_batch > 3) {
236 $this->on_load_code[$a_batch][] = $a_code;
246 for ($i = 1; $i <= 3; $i++) {
247 if (is_array($this->on_load_code[$i])) {
248 foreach ($this->on_load_code[$i] as $code) {
254 return '<script type="text/javascript">' .
"\n" .
270 $this->js_files = [];
271 $this->js_files_vp = [];
272 $this->js_files_batch = [];
283 $vers =
"vers=" . str_replace([
".",
" "],
"-",
ILIAS_VERSION);
286 $vers .=
'-' . time();
291 for ($i = 0; $i <= 3; $i++) {
292 reset($this->js_files);
293 foreach ($this->js_files as $file) {
294 if ($this->js_files_batch[$file] == $i) {
295 if (is_file($file) || substr($file, 0, 4) ==
"http" || substr(
299 ) ==
"//" || $a_force) {
302 if (substr($file, 0, 2) ==
'./') {
303 $url_parts = parse_url($file);
304 if (is_file($url_parts[
'path'])) {
320 for ($i = 1; $i <= 3; $i++) {
321 if (is_array($this->on_load_code[$i])) {
323 foreach ($this->on_load_code[$i] as $code) {
337 if ($this->js_files_vp[$file]) {
364 public function addCss(
string $a_css_file,
string $media =
"screen"): void
366 if (!array_key_exists($a_css_file . $media, $this->css_files)) {
367 $this->css_files[$a_css_file . $media] = [
"file" => $a_css_file,
"media" => $media];
378 public function addInlineCss(
string $a_css,
string $media =
"screen"): void
380 $this->inline_css[] = [
"css" => $a_css,
"media" => $media];
397 foreach ($this->css_files as $css) {
423 $this->body_class = $a_class;
428 if ($this->body_class !=
"" && $this->
blockExists(
"body_class")) {
430 $this->
setVariable(
"BODY_CLASS", $this->body_class);
443 foreach ($this->inline_css as $css) {
456 "LOCATION_NEWCONTENT_STYLESHEET_TAG",
457 '<link rel="stylesheet" type="text/css" href="' .
474 if ($this->standard_template_loaded) {
485 $this->
addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
486 $this->
addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
488 $this->standard_template_loaded =
true;
504 public function setTitle(
string $a_title,
bool $hidden =
false): void
506 $this->title = $a_title;
507 $this->header_page_title = $a_title;
512 $this->title_desc = $a_descr;
515 public function setTitleIcon(
string $a_icon_path,
string $a_icon_desc =
""): void
517 $this->icon_desc = $a_icon_desc;
518 $this->icon_path = $a_icon_path;
523 $this->title_alerts = $alerts;
548 $this->header_action = $a_header;
558 $this->header_page_title = $a_title;
566 $header_tpl =
new ilTemplate(
'tpl.il_header.html',
true,
true);
570 if ($this->icon_path !=
"") {
571 $header_tpl->setCurrentBlock(
"header_image");
572 if ($this->icon_desc !=
"") {
577 $header_tpl->setVariable(
"IMG_HEADER", $this->icon_path);
578 $header_tpl->parseCurrentBlock();
582 if ($this->title !=
"") {
584 $header_tpl->setVariable(
"HEADER", $title);
590 $header_tpl->setCurrentBlock(
"header_image");
591 $header_tpl->parseCurrentBlock();
594 if ($this->title_desc !=
"") {
595 $header_tpl->setCurrentBlock(
"header_desc");
596 $header_tpl->setVariable(
"H_DESCRIPTION", $this->title_desc);
597 $header_tpl->parseCurrentBlock();
602 $header_tpl->setCurrentBlock(
"head_action_inner");
603 $header_tpl->setVariable(
"HEAD_ACTION", $header);
604 $header_tpl->parseCurrentBlock();
605 $header_tpl->touchBlock(
"head_action");
608 if (count($this->title_alerts)) {
609 foreach ($this->title_alerts as $alert) {
610 $header_tpl->setCurrentBlock(
'header_alert');
611 if (!($alert[
'propertyNameVisible'] ===
false)) {
612 $header_tpl->setVariable(
'H_PROP', $alert[
'property'] .
':');
614 $header_tpl->setVariable(
'H_VALUE', $alert[
'value']);
615 $header_tpl->parseCurrentBlock();
619 $this->
template->setVariable(
"IL_HEADER", $header_tpl->get());
641 include_once(
"./Services/UIComponent/classes/class.ilUIHookProcessor.php");
642 $html = $this->
locator->getHTML();
646 [
"locator_gui" => $this->
locator,
"html" => $html]
648 $html = $uip->getHTML($html);
665 public function setTabs(
string $a_tabs_html): void
667 if ($a_tabs_html !=
"" && $this->
blockExists(
"tabs_outer_start")) {
692 if ($this->tabs_html !=
"") {
695 $this->
setVariable(
"SUB_TABS", $this->sub_tabs_html);
702 $this->sub_tabs_html = $this->
tabs->getSubTabHTML();
703 $this->tabs_html = $this->
tabs->getHTML(
true);
720 $this->main_content = $a_html;
729 $this->left_content = $a_html;
737 $this->left_nav_content = $a_content;
745 if (trim($this->left_nav_content) !=
"") {
747 $this->
setVariable(
"LEFT_NAV_CONTENT", $this->left_nav_content);
758 $this->right_content = $a_html;
766 $center_column_class =
"";
767 if (trim($this->right_content) !=
"" && trim($this->left_content) !=
"") {
768 $center_column_class =
"two_side_col";
770 if (trim($this->right_content) !=
"" || trim($this->left_content) !=
"") {
771 $center_column_class =
"one_side_col";
775 switch ($center_column_class) {
777 $center_column_class =
"col-sm-9";
780 $center_column_class =
"col-sm-6";
783 $center_column_class =
"col-sm-12";
786 if (trim($this->left_content) !=
"") {
787 $center_column_class .=
" col-sm-push-3";
791 $this->
setVariable(
"CENTER_COL", $center_column_class);
797 if (trim($this->main_content) !=
"") {
798 $this->
setVariable(
"ADM_CONTENT", $this->main_content);
804 if (trim($this->left_content) !=
"") {
806 $this->
setVariable(
"LEFT_CONTENT", $this->left_content);
807 $left_col_class = (trim($this->right_content) ==
"")
808 ?
"col-sm-3 col-sm-pull-9" 809 :
"col-sm-3 col-sm-pull-6";
810 $this->
setVariable(
"LEFT_COL_CLASS", $left_col_class);
817 if (trim($this->right_content) !=
"") {
819 $this->
setVariable(
"RIGHT_CONTENT", $this->right_content);
833 $thtml = $this->
toolbar->getHTML();
850 $this->
setVariable(
'META_CONTENT_LANGUAGE', $this->
lng->getContentLanguage());
851 $this->
setVariable(
'LANGUAGE_DIRECTION', $this->
lng->getTextDirection());
856 if ($this->header_page_title !=
"") {
861 if ($this->
settings->get(
'short_inst_name') !=
"") {
864 $this->
settings->get(
'short_inst_name')
881 $this->page_form_action = $a_action;
886 if ($this->page_form_action !=
"") {
888 $this->
setVariable(
"PAGE_FORM_ACTION", $this->page_form_action);
906 $this->login_target_par = $a_val;
925 string $part = self::DEFAULT_BLOCK,
926 bool $add_error_mess =
false,
927 bool $handle_referer =
false,
928 bool $add_ilias_footer =
false,
929 bool $add_standard_elements =
false,
930 bool $a_main_menu =
true,
933 if ($add_error_mess) {
938 if ($add_standard_elements) {
988 if ($part ==
"DEFAULT") {
989 $html = $this->
template->get();
991 $html = $this->
template->get($part);
1001 string $part = self::DEFAULT_BLOCK,
1002 bool $has_tabs =
true,
1003 bool $skip_main_menu =
false 1005 switch ($this->
http->request()->getHeaderLine(
'Accept')) {
1006 case 'application/json':
1007 $string = json_encode([
1008 self::MESSAGE_TYPE_SUCCESS => is_null($this->message[self::MESSAGE_TYPE_FAILURE]),
1012 $this->
http->saveResponse($this->
http->response()->withBody($stream));
1013 $this->
http->sendResponse();
1019 header(
'P3P: CP="CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT CNT STA PRE"');
1020 header(
"Content-type: text/html; charset=UTF-8");
1033 if (!$skip_main_menu) {
1074 if ($part ==
"DEFAULT" or is_bool($part)) {
1075 $html = $this->
template->getUnmodified();
1077 $html = $this->
template->getUnmodified($part);
1083 foreach ($this->component_factory->getActivePluginsInSlot(
"uihk") as
$plugin) {
1084 $gui_class =
$plugin->getUIClassInstance();
1086 $resp = $gui_class->getHTML(
1089 [
"tpl_id" => $this->tplIdentifier,
"tpl_obj" => $this,
"html" => $html]
1093 $html = $gui_class->modifyHTML($html,
$resp);
1112 if ($this->tree_flat_link !=
"") {
1113 if ($this->left_nav_content !=
"") {
1118 $this->
setVariable(
"LINK_MODE", $this->tree_flat_link);
1119 if ($this->
settings->get(
"tree_frame") ==
"right") {
1125 $this->
setVariable(
"ALT_TREE", $this->
lng->txt($this->tree_flat_mode .
"view"));
1136 $this->tree_flat_link = $a_link;
1137 $this->tree_flat_mode = $a_mode;
1153 bool $is_bottom_panel =
true,
1154 bool $has_arrow =
false 1156 $this->admin_panel_commands_toolbar =
$toolbar;
1157 $this->admin_panel_arrow = $has_arrow;
1158 $this->admin_panel_bottom = $is_bottom_panel;
1168 if ($this->admin_panel_commands_toolbar === null) {
1175 if ($this->admin_panel_arrow) {
1183 $this->
setVariable(
"ADM_PANEL1", $toolb->getHTML());
1187 if ($this->admin_panel_bottom) {
1191 if ($this->admin_panel_arrow) {
1195 $this->
setVariable(
"ADM_PANEL2", $toolb->getHTML());
1203 string $a_append =
"",
1204 string $a_target =
"",
1205 string $a_title =
"" 1207 $this->permanent_link = [
1210 "append" => $a_append,
1211 "target" => $a_target,
1212 "title" => $a_title,
1228 if ($a_reset_header_action) {
1238 $this->enable_fileupload =
false;
1250 public function get(
string $part =
"DEFAULT"):
string 1252 return $this->
template->get($part);
1257 $this->
template->setVariable($variable, $value);
1262 return $this->
template->setCurrentBlock($part);
1267 return $this->
template->touchBlock($block);
1272 return $this->
template->parseCurrentBlock($block_name);
1275 public function addBlockFile(
string $var,
string $block,
string $template_name,
string $in_module = null): bool
1277 return $this->
template->addBlockFile($var, $block, $template_name, $in_module);
1282 return $this->
template->blockExists($block_name);
static get(string $a_var)
setPageFormAction(string $a_action)
Sets the pages form action.
ilToolbarGUI $admin_panel_commands_toolbar
fillAdminPanel()
Put admin panel into template:
setTreeFlatIcon(string $a_link, string $a_mode)
Sets a tree or flat icon.
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
static getSystemMessageHTML(string $a_txt, string $a_type="info")
Get HTML for a system message.
setAlertProperties(array $alerts)
Set alert properties.
loadStandardTemplate()
This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STA...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFileUploadRefId(int $a_ref_id)
Enables the file upload into this object by dropping a file.
setHeaderPageTitle(string $a_title)
Sets the title of the page (for browser window).
string $header_page_title
setDescription(string $a_descr)
Sets description below title in standard template.
array $inline_css
Stores CSS to be included directly.
hideFooter()
Make the template hide the footer.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
getHeaderActionMenu()
Get header action menu.
static stripScriptHTML(string $a_str, string $a_allow="", bool $a_rm_js=true)
setCurrentBlock(string $part="DEFAULT")
Sets the template to the given block.
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
clearHeader()
Clear header.
ilComponentFactory $component_factory
printToString()
Use this method to get the finally rendered page as string.
getOnLoadCodeForAsynch()
Get js onload code for ajax calls.
setLeftNavContent(string $a_content)
Sets content of left navigation column.
fillJavaScriptFiles(bool $a_force=false)
Probably adds javascript files.
ILIAS Refinery Factory $refinery
parseCurrentBlock(string $block_name="DEFAULT")
Parses the given block.
fillSideIcons()
Fill side icons (upper icon, tree icon, web folder icon)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fillJavascriptFile(string $file, string $vers)
addAdminPanelToolbar(ilToolbarGUI $toolbar, bool $is_bottom_panel=true, bool $has_arrow=false)
Add admin panel commands as toolbar.
printToStdout(string $part=self::DEFAULT_BLOCK, bool $has_tabs=true, bool $skip_main_menu=false)
static getNewContentStyleSheetLocation(string $mode="output")
get full style sheet file name (path inclusive) of current user
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
array $css_files
Stores CSS-files to be included.
static initDom(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Dom.
bool $standard_template_loaded
getMessageTextForType(string $m)
addBlockFile(string $var, string $block, string $template_name, string $in_module=null)
overwrites ITX::addBlockFile
static http()
Fetches the global http state from ILIAS.
fillCssFiles(bool $a_force=false)
Fill in the css file tags.
setBodyClass(string $a_class="")
Sets the body-tags class.
setContent(string $a_html)
Sets content for standard template.
ILIAS HTTP Services $http
setRightContent(string $a_html)
Sets content of right column.
static initjQueryUI(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components)
fillContentLanguage()
Add current user language to meta tags.
setTabs(string $a_tabs_html)
sets tabs in standard template
resetJavascript()
Reset javascript files.
__construct(string $file, bool $flag1, bool $flag2, string $in_module="", string $vars=ilGlobalTemplateInterface::DEFAULT_BLOCK, bool $plugin=false, bool $a_use_cache=true)
static ofString(string $string)
Creates a new stream with an initial value.
fillLeftNav()
Fill left navigation frame.
setSubTabs(string $a_tabs_html)
sets subtabs in standard template
static init(ilGlobalTemplateInterface $template=null)
fillMessage()
Fill message area.
setLeftContent(string $a_html)
Sets content of left column.
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
fillOnLoadCode()
Fill add on load code.
static _saveUsages()
Store the collected language variable usages in the user session This should be called as late as pos...
setLocator()
Insert locator.
resetHeaderBlock(bool $a_reset_header_action=true)
Reset all header properties: title, icon, description, alerts, action menu.
fillInlineCss()
Fill in the inline css.
fillNewContentStyle()
Fill Content Style.
blockExists(string $block_name)
check if block exists in actual template
addCss(string $a_css_file, string $media="screen")
Add a css file that should be included in the header.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
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.
touchBlock(string $block)
overwrites ITX::touchBlock.
static array $message_types
static clear(string $a_var)
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
setLoginTargetPar(string $a_val)
Set target parameter for login (public sector).
static set(string $a_var, $a_val)
Set a value.
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.
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setHeaderActionMenu(string $a_header)
Set header action menu.
addInlineCss(string $a_css, string $media="screen")
Add a css file that should be included in the header.