20 declare(strict_types=1);
54 string $in_module =
"",
57 bool $a_use_cache =
true 62 $this->
lng = $DIC->language();
63 $this->
http = $DIC->http();
64 $this->
locator = $DIC[
"ilLocator"];
65 $this->
tabs = $DIC->tabs();
66 $this->
toolbar = $DIC->toolbar();
68 $this->component_factory = $DIC[
"component.factory"];
70 $this->
template =
new ilTemplate($file, $flag1, $flag2, $in_module, $vars,
$plugin, $a_use_cache);
118 self::MESSAGE_TYPE_FAILURE,
119 self::MESSAGE_TYPE_INFO,
120 self::MESSAGE_TYPE_SUCCESS,
121 self::MESSAGE_TYPE_QUESTION,
127 if (!in_array($type, self::$message_types) || $a_txt ==
"") {
131 $this->message[$type] = $a_txt;
144 foreach (self::$message_types as $m) {
151 $request = $this->
http->request();
152 $accept_header = $request->getHeaderLine(
'Accept');
169 if (isset($this->message[$m])) {
170 $txt = $this->message[$m];
187 protected array
$js_files = [0 =>
"assets/js/Basic.js"];
202 public function addJavaScript(
string $a_js_file,
bool $a_add_version_parameter =
true,
int $a_batch = 2): void
205 if ($a_batch < 1 || $a_batch > 3) {
210 if (is_int(strpos($a_js_file,
"components/ILIAS/jQuery"))
211 || is_int(strpos($a_js_file,
"/jquery.js"))
212 || is_int(strpos($a_js_file,
"/jquery-min.js"))
217 if (!in_array($a_js_file, $this->js_files)) {
218 $this->js_files[] = $a_js_file;
219 $this->js_files_vp[$a_js_file] = $a_add_version_parameter;
220 $this->js_files_batch[$a_js_file] = $a_batch;
230 if ($a_batch < 1 || $a_batch > 3) {
233 $this->on_load_code[$a_batch][] = $a_code;
243 for ($i = 1; $i <= 3; $i++) {
244 if (is_array($this->on_load_code[$i])) {
245 foreach ($this->on_load_code[$i] as $code) {
251 return '<script type="text/javascript">' .
"\n" .
267 $this->js_files = [];
268 $this->js_files_vp = [];
269 $this->js_files_batch = [];
280 $vers =
"vers=" . str_replace([
".",
" "],
"-",
ILIAS_VERSION);
283 $vers .=
'-' . time();
288 for ($i = 0; $i <= 3; $i++) {
289 reset($this->js_files);
290 foreach ($this->js_files as $file) {
291 if ($this->js_files_batch[$file] == $i) {
292 if (is_file($file) || substr($file, 0, 4) ==
"http" || substr(
296 ) ==
"//" || $a_force) {
299 if (substr($file, 0, 2) ==
'./') {
300 $url_parts = parse_url($file);
301 if (is_file($url_parts[
'path'])) {
317 for ($i = 1; $i <= 3; $i++) {
318 if (is_array($this->on_load_code[$i])) {
320 foreach ($this->on_load_code[$i] as $code) {
334 if ($this->js_files_vp[$file]) {
361 public function addCss(
string $a_css_file,
string $media =
"screen"): void
363 if (!array_key_exists($a_css_file . $media, $this->css_files)) {
364 $this->css_files[$a_css_file . $media] = [
"file" => $a_css_file,
"media" => $media];
375 public function addInlineCss(
string $a_css,
string $media =
"screen"): void
377 $this->inline_css[] = [
"css" => $a_css,
"media" => $media];
394 foreach ($this->css_files as $css) {
420 $this->body_class = $a_class;
425 if ($this->body_class !=
"" && $this->
blockExists(
"body_class")) {
427 $this->
setVariable(
"BODY_CLASS", $this->body_class);
440 foreach ($this->inline_css as $css) {
453 "LOCATION_NEWCONTENT_STYLESHEET_TAG",
454 '<link rel="stylesheet" type="text/css" href="' .
471 if ($this->standard_template_loaded) {
479 $this->
addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
480 $this->
addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
482 $this->standard_template_loaded =
true;
498 public function setTitle(
string $a_title,
bool $hidden =
false): void
500 $this->title = $a_title;
501 $this->header_page_title = $a_title;
506 $this->title_desc = $a_descr;
509 public function setTitleIcon(
string $a_icon_path,
string $a_icon_desc =
""): void
511 $this->icon_desc = $a_icon_desc;
512 $this->icon_path = $a_icon_path;
517 $this->title_alerts = $alerts;
542 $this->header_action = $a_header;
552 $this->header_page_title = $a_title;
560 $header_tpl =
new ilTemplate(
'tpl.il_header.html',
true,
true);
564 if ($this->icon_path !=
"") {
565 $header_tpl->setCurrentBlock(
"header_image");
566 if ($this->icon_desc !=
"") {
571 $header_tpl->setVariable(
"IMG_HEADER", $this->icon_path);
572 $header_tpl->parseCurrentBlock();
576 if ($this->title !=
"") {
578 $header_tpl->setVariable(
"HEADER", $title);
584 $header_tpl->setCurrentBlock(
"header_image");
585 $header_tpl->parseCurrentBlock();
588 if ($this->title_desc !=
"") {
589 $header_tpl->setCurrentBlock(
"header_desc");
590 $header_tpl->setVariable(
"H_DESCRIPTION", $this->title_desc);
591 $header_tpl->parseCurrentBlock();
596 $header_tpl->setCurrentBlock(
"head_action_inner");
597 $header_tpl->setVariable(
"HEAD_ACTION", $header);
598 $header_tpl->parseCurrentBlock();
599 $header_tpl->touchBlock(
"head_action");
602 if (count($this->title_alerts)) {
603 foreach ($this->title_alerts as $alert) {
604 $header_tpl->setCurrentBlock(
'header_alert');
605 if (!($alert[
'propertyNameVisible'] ===
false)) {
606 $header_tpl->setVariable(
'H_PROP', $alert[
'property'] .
':');
608 $header_tpl->setVariable(
'H_VALUE', $alert[
'value']);
609 $header_tpl->parseCurrentBlock();
613 $this->
template->setVariable(
"IL_HEADER", $header_tpl->get());
635 include_once(
"./components/ILIAS/UIComponent/classes/class.ilUIHookProcessor.php");
636 $html = $this->
locator->getHTML();
638 "components/ILIAS/Locator",
640 [
"locator_gui" => $this->
locator,
"html" => $html]
642 $html = $uip->getHTML($html);
659 public function setTabs(
string $a_tabs_html): void
661 if ($a_tabs_html !=
"" && $this->
blockExists(
"tabs_outer_start")) {
686 if ($this->tabs_html !=
"") {
689 $this->
setVariable(
"SUB_TABS", $this->sub_tabs_html);
696 $this->sub_tabs_html = $this->
tabs->getSubTabHTML();
697 $this->tabs_html = $this->
tabs->getHTML(
true);
714 $this->main_content = $a_html;
723 $this->left_content = $a_html;
731 $this->left_nav_content = $a_content;
739 if (trim($this->left_nav_content) !=
"") {
741 $this->
setVariable(
"LEFT_NAV_CONTENT", $this->left_nav_content);
752 $this->right_content = $a_html;
760 $center_column_class =
"";
761 if (trim($this->right_content) !=
"" && trim($this->left_content) !=
"") {
762 $center_column_class =
"two_side_col";
764 if (trim($this->right_content) !=
"" || trim($this->left_content) !=
"") {
765 $center_column_class =
"one_side_col";
769 switch ($center_column_class) {
771 $center_column_class =
"col-sm-9";
774 $center_column_class =
"col-sm-6";
777 $center_column_class =
"col-sm-12";
780 if (trim($this->left_content) !=
"") {
781 $center_column_class .=
" col-sm-push-3";
785 $this->
setVariable(
"CENTER_COL", $center_column_class);
791 if (trim($this->main_content) !=
"") {
792 $this->
setVariable(
"ADM_CONTENT", $this->main_content);
798 if (trim($this->left_content) !=
"") {
800 $this->
setVariable(
"LEFT_CONTENT", $this->left_content);
801 $left_col_class = (trim($this->right_content) ==
"")
802 ?
"col-sm-3 col-sm-pull-9" 803 :
"col-sm-3 col-sm-pull-6";
804 $this->
setVariable(
"LEFT_COL_CLASS", $left_col_class);
811 if (trim($this->right_content) !=
"") {
813 $this->
setVariable(
"RIGHT_CONTENT", $this->right_content);
827 $thtml = $this->
toolbar->getHTML();
844 $this->
setVariable(
'META_CONTENT_LANGUAGE', $this->
lng->getContentLanguage());
845 $this->
setVariable(
'LANGUAGE_DIRECTION', $this->
lng->getTextDirection());
850 if ($this->header_page_title !=
"") {
855 if ($this->
settings->get(
'short_inst_name') !=
"") {
858 $this->
settings->get(
'short_inst_name')
875 $this->page_form_action = $a_action;
880 if ($this->page_form_action !=
"") {
882 $this->
setVariable(
"PAGE_FORM_ACTION", $this->page_form_action);
900 $this->login_target_par = $a_val;
919 string $part = self::DEFAULT_BLOCK,
920 bool $add_error_mess =
false,
921 bool $handle_referer =
false,
922 bool $add_ilias_footer =
false,
923 bool $add_standard_elements =
false,
924 bool $a_main_menu =
true,
927 if ($add_error_mess) {
932 if ($add_standard_elements) {
982 if ($part ==
"DEFAULT") {
983 $html = $this->
template->get();
985 $html = $this->
template->get($part);
995 string $part = self::DEFAULT_BLOCK,
996 bool $has_tabs =
true,
997 bool $skip_main_menu =
false 999 switch ($this->
http->request()->getHeaderLine(
'Accept')) {
1000 case 'application/json':
1001 $string = json_encode([
1002 self::MESSAGE_TYPE_SUCCESS => is_null($this->message[self::MESSAGE_TYPE_FAILURE]),
1006 $this->
http->saveResponse($this->
http->response()->withBody($stream));
1007 $this->
http->sendResponse();
1013 header(
'P3P: CP="CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT CNT STA PRE"');
1014 header(
"Content-type: text/html; charset=UTF-8");
1027 if (!$skip_main_menu) {
1068 if ($part ==
"DEFAULT" or is_bool($part)) {
1069 $html = $this->
template->getUnmodified();
1071 $html = $this->
template->getUnmodified($part);
1077 foreach ($this->component_factory->getActivePluginsInSlot(
"uihk") as
$plugin) {
1078 $gui_class =
$plugin->getUIClassInstance();
1080 $resp = $gui_class->getHTML(
1083 [
"tpl_id" => $this->tplIdentifier,
"tpl_obj" => $this,
"html" => $html]
1087 $html = $gui_class->modifyHTML($html,
$resp);
1106 if ($this->tree_flat_link !=
"") {
1107 if ($this->left_nav_content !=
"") {
1112 $this->
setVariable(
"LINK_MODE", $this->tree_flat_link);
1113 if ($this->
settings->get(
"tree_frame") ==
"right") {
1119 $this->
setVariable(
"ALT_TREE", $this->
lng->txt($this->tree_flat_mode .
"view"));
1130 $this->tree_flat_link = $a_link;
1131 $this->tree_flat_mode = $a_mode;
1147 bool $is_bottom_panel =
true,
1148 bool $has_arrow =
false 1150 $this->admin_panel_commands_toolbar =
$toolbar;
1151 $this->admin_panel_arrow = $has_arrow;
1152 $this->admin_panel_bottom = $is_bottom_panel;
1162 if ($this->admin_panel_commands_toolbar === null) {
1169 if ($this->admin_panel_arrow) {
1177 $this->
setVariable(
"ADM_PANEL1", $toolb->getHTML());
1181 if ($this->admin_panel_bottom) {
1185 if ($this->admin_panel_arrow) {
1189 $this->
setVariable(
"ADM_PANEL2", $toolb->getHTML());
1197 string $a_append =
"",
1198 string $a_target =
"",
1199 string $a_title =
"" 1201 $this->permanent_link = [
1204 "append" => $a_append,
1205 "target" => $a_target,
1206 "title" => $a_title,
1222 if ($a_reset_header_action) {
1232 $this->enable_fileupload =
false;
1244 public function get(
string $part =
"DEFAULT"):
string 1246 return $this->
template->get($part);
1251 $this->
template->setVariable($variable, $value);
1256 return $this->
template->setCurrentBlock($part);
1261 return $this->
template->touchBlock($block);
1266 return $this->
template->parseCurrentBlock($block_name);
1269 public function addBlockFile(
string $var,
string $block,
string $template_name,
string $in_module = null): bool
1271 return $this->
template->addBlockFile($var, $block, $template_name, $in_module);
1276 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.
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 getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
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
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.