19 declare(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);
117 self::MESSAGE_TYPE_FAILURE,
118 self::MESSAGE_TYPE_INFO,
119 self::MESSAGE_TYPE_SUCCESS,
120 self::MESSAGE_TYPE_QUESTION,
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) {
481 $this->
addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
482 $this->
addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
484 $this->standard_template_loaded =
true;
500 public function setTitle(
string $a_title,
bool $hidden =
false): void
502 $this->title = $a_title;
503 $this->header_page_title = $a_title;
508 $this->title_desc = $a_descr;
511 public function setTitleIcon(
string $a_icon_path,
string $a_icon_desc =
""): void
513 $this->icon_desc = $a_icon_desc;
514 $this->icon_path = $a_icon_path;
519 $this->title_alerts = $alerts;
544 $this->header_action = $a_header;
554 $this->header_page_title = $a_title;
562 $header_tpl =
new ilTemplate(
'tpl.il_header.html',
true,
true);
566 if ($this->icon_path !=
"") {
567 $header_tpl->setCurrentBlock(
"header_image");
568 if ($this->icon_desc !=
"") {
573 $header_tpl->setVariable(
"IMG_HEADER", $this->icon_path);
574 $header_tpl->parseCurrentBlock();
578 if ($this->title !=
"") {
580 $header_tpl->setVariable(
"HEADER", $title);
586 $header_tpl->setCurrentBlock(
"header_image");
587 $header_tpl->parseCurrentBlock();
590 if ($this->title_desc !=
"") {
591 $header_tpl->setCurrentBlock(
"header_desc");
592 $header_tpl->setVariable(
"H_DESCRIPTION", $this->title_desc);
593 $header_tpl->parseCurrentBlock();
598 $header_tpl->setCurrentBlock(
"head_action_inner");
599 $header_tpl->setVariable(
"HEAD_ACTION", $header);
600 $header_tpl->parseCurrentBlock();
601 $header_tpl->touchBlock(
"head_action");
604 if (count($this->title_alerts)) {
605 foreach ($this->title_alerts as $alert) {
606 $header_tpl->setCurrentBlock(
'header_alert');
607 if (!($alert[
'propertyNameVisible'] ===
false)) {
608 $header_tpl->setVariable(
'H_PROP', $alert[
'property'] .
':');
610 $header_tpl->setVariable(
'H_VALUE', $alert[
'value']);
611 $header_tpl->parseCurrentBlock();
615 $this->
template->setVariable(
"IL_HEADER", $header_tpl->get());
637 include_once(
"./components/ILIAS/UIComponent/classes/class.ilUIHookProcessor.php");
638 $html = $this->
locator->getHTML();
640 "components/ILIAS/Locator",
642 [
"locator_gui" => $this->
locator,
"html" => $html]
644 $html = $uip->getHTML($html);
661 public function setTabs(
string $a_tabs_html): void
663 if ($a_tabs_html !=
"" && $this->
blockExists(
"tabs_outer_start")) {
688 if ($this->tabs_html !=
"") {
691 $this->
setVariable(
"SUB_TABS", $this->sub_tabs_html);
698 $this->sub_tabs_html = $this->
tabs->getSubTabHTML();
699 $this->tabs_html = $this->
tabs->getHTML(
true);
716 $this->main_content = $a_html;
725 $this->left_content = $a_html;
733 $this->left_nav_content = $a_content;
741 if (trim($this->left_nav_content) !=
"") {
743 $this->
setVariable(
"LEFT_NAV_CONTENT", $this->left_nav_content);
754 $this->right_content = $a_html;
762 $center_column_class =
"";
763 if (trim($this->right_content) !=
"" && trim($this->left_content) !=
"") {
764 $center_column_class =
"two_side_col";
766 if (trim($this->right_content) !=
"" || trim($this->left_content) !=
"") {
767 $center_column_class =
"one_side_col";
771 switch ($center_column_class) {
773 $center_column_class =
"col-sm-9";
776 $center_column_class =
"col-sm-6";
779 $center_column_class =
"col-sm-12";
782 if (trim($this->left_content) !=
"") {
783 $center_column_class .=
" col-sm-push-3";
787 $this->
setVariable(
"CENTER_COL", $center_column_class);
793 if (trim($this->main_content) !=
"") {
794 $this->
setVariable(
"ADM_CONTENT", $this->main_content);
800 if (trim($this->left_content) !=
"") {
802 $this->
setVariable(
"LEFT_CONTENT", $this->left_content);
803 $left_col_class = (trim($this->right_content) ==
"")
804 ?
"col-sm-3 col-sm-pull-9" 805 :
"col-sm-3 col-sm-pull-6";
806 $this->
setVariable(
"LEFT_COL_CLASS", $left_col_class);
813 if (trim($this->right_content) !=
"") {
815 $this->
setVariable(
"RIGHT_CONTENT", $this->right_content);
829 $thtml = $this->
toolbar->getHTML();
846 $this->
setVariable(
'META_CONTENT_LANGUAGE', $this->
lng->getContentLanguage());
847 $this->
setVariable(
'LANGUAGE_DIRECTION', $this->
lng->getTextDirection());
852 if ($this->header_page_title !=
"") {
857 if ($this->
settings->get(
'short_inst_name') !=
"") {
860 $this->
settings->get(
'short_inst_name')
877 $this->page_form_action = $a_action;
882 if ($this->page_form_action !=
"") {
884 $this->
setVariable(
"PAGE_FORM_ACTION", $this->page_form_action);
902 $this->login_target_par = $a_val;
921 string $part = self::DEFAULT_BLOCK,
922 bool $add_error_mess =
false,
923 bool $handle_referer =
false,
924 bool $add_ilias_footer =
false,
925 bool $add_standard_elements =
false,
926 bool $a_main_menu =
true,
929 if ($add_error_mess) {
934 if ($add_standard_elements) {
984 if ($part ==
"DEFAULT") {
985 $html = $this->
template->get();
987 $html = $this->
template->get($part);
997 string $part = self::DEFAULT_BLOCK,
998 bool $has_tabs =
true,
999 bool $skip_main_menu =
false 1001 switch ($this->
http->request()->getHeaderLine(
'Accept')) {
1002 case 'application/json':
1003 $string = json_encode([
1004 self::MESSAGE_TYPE_SUCCESS => is_null($this->message[self::MESSAGE_TYPE_FAILURE]),
1008 $this->
http->saveResponse($this->
http->response()->withBody($stream));
1009 $this->
http->sendResponse();
1015 header(
'P3P: CP="CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT CNT STA PRE"');
1016 header(
"Content-type: text/html; charset=UTF-8");
1029 if (!$skip_main_menu) {
1070 if ($part ==
"DEFAULT" or is_bool($part)) {
1071 $html = $this->
template->getUnmodified();
1073 $html = $this->
template->getUnmodified($part);
1079 foreach ($this->component_factory->getActivePluginsInSlot(
"uihk") as
$plugin) {
1080 $gui_class =
$plugin->getUIClassInstance();
1082 $resp = $gui_class->getHTML(
1085 [
"tpl_id" => $this->tplIdentifier,
"tpl_obj" => $this,
"html" => $html]
1089 $html = $gui_class->modifyHTML($html,
$resp);
1108 if ($this->tree_flat_link !=
"") {
1109 if ($this->left_nav_content !=
"") {
1114 $this->
setVariable(
"LINK_MODE", $this->tree_flat_link);
1115 if ($this->
settings->get(
"tree_frame") ==
"right") {
1121 $this->
setVariable(
"ALT_TREE", $this->
lng->txt($this->tree_flat_mode .
"view"));
1132 $this->tree_flat_link = $a_link;
1133 $this->tree_flat_mode = $a_mode;
1149 bool $is_bottom_panel =
true,
1150 bool $has_arrow =
false 1152 $this->admin_panel_commands_toolbar =
$toolbar;
1153 $this->admin_panel_arrow = $has_arrow;
1154 $this->admin_panel_bottom = $is_bottom_panel;
1164 if ($this->admin_panel_commands_toolbar ===
null) {
1171 if ($this->admin_panel_arrow) {
1179 $this->
setVariable(
"ADM_PANEL1", $toolb->getHTML());
1183 if ($this->admin_panel_bottom) {
1187 if ($this->admin_panel_arrow) {
1191 $this->
setVariable(
"ADM_PANEL2", $toolb->getHTML());
1199 string $a_append =
"",
1200 string $a_target =
"",
1201 string $a_title =
"" 1203 $this->permanent_link = [
1206 "append" => $a_append,
1207 "target" => $a_target,
1208 "title" => $a_title,
1224 if ($a_reset_header_action) {
1234 $this->enable_fileupload =
false;
1246 public function get(
string $part =
"DEFAULT"):
string 1248 return $this->
template->get($part);
1253 $this->
template->setVariable($variable, $value);
1258 return $this->
template->setCurrentBlock($part);
1263 return $this->
template->touchBlock($block);
1268 return $this->
template->parseCurrentBlock($block_name);
1271 public function addBlockFile(
string $var,
string $block,
string $template_name, ?
string $in_module =
null): bool
1273 return $this->
template->addBlockFile($var, $block, $template_name, $in_module);
1278 return $this->
template->blockExists($block_name);
static init(?ilGlobalTemplateInterface $template=null)
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 initjQueryUI(?ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components.txt for included components)
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)
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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
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
static initjQuery(?ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
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)
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.
addBlockFile(string $var, string $block, string $template_name, ?string $in_module=null)
overwrites ITX::addBlockFile
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.
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.