19declare(strict_types=1);
47 "assets/js/Basic.js" =>
true,
55 "assets/js/Basic.js" => 1,
110 string $vars = self::DEFAULT_BLOCK,
112 bool $a_use_cache =
true
115 $this->template_name = $file;
136 $this->show_footer =
false;
155 !in_array($a_type, self::MESSAGE_TYPES,
true)
161 $this->messages[$a_type] = $a_txt;
170 foreach (self::MESSAGE_TYPES as $type) {
190 return $this->messages[$type] ??
null;
193 public function addJavaScript(
string $a_js_file,
bool $a_add_version_parameter =
true,
int $a_batch = 2): void
196 if ($a_batch < 1 || $a_batch > 3) {
201 if (is_int(strpos($a_js_file,
"components/ILIAS/jQuery")) ||
202 is_int(strpos($a_js_file,
"/jquery.js")) ||
203 is_int(strpos($a_js_file,
"/jquery/")) ||
204 is_int(strpos($a_js_file,
"/jquery-ui/")) ||
205 is_int(strpos($a_js_file,
"/jquery-min.js"))
210 if (!in_array($a_js_file, $this->js_files,
true)) {
211 $this->js_files[] = $a_js_file;
212 $this->js_files_vp[$a_js_file] = $a_add_version_parameter;
213 $this->js_files_batch[$a_js_file] = $a_batch;
220 if ($a_batch < 1 || $a_batch > 3) {
224 $this->on_load_code[$a_batch][] = $a_code;
230 for ($i = 1; $i <= 3; $i++) {
231 if (isset($this->on_load_code[$i])) {
232 foreach ($this->on_load_code[$i] as $code) {
238 return '<script type="text/javascript">' .
"\n" .
248 $this->js_files = [];
249 $this->js_files_vp = [];
250 $this->js_files_batch = [];
261 $vers =
"vers=" . str_replace([
".",
" "],
"-",
ILIAS_VERSION);
264 $vers .=
'-' . time();
269 for ($i = 0; $i <= 3; $i++) {
270 reset($this->js_files);
271 foreach ($this->js_files as $file) {
272 if ($this->js_files_batch[$file] === $i) {
275 strpos($file,
"http") === 0 ||
276 strpos($file,
"//") === 0
279 } elseif (strpos($file,
'./') === 0) {
280 $url_parts = parse_url($file);
281 if (is_file($url_parts[
'path'])) {
293 for ($i = 1; $i <= 3; $i++) {
294 if (isset($this->on_load_code[$i])) {
296 foreach ($this->on_load_code[$i] as $code) {
310 if ($this->js_files_vp[$file]) {
318 public function addCss(
string $a_css_file,
string $media =
"screen"): void
320 if (!array_key_exists($a_css_file . $media, $this->css_files)) {
321 $this->css_files[$a_css_file . $media] = [
322 "file" => $a_css_file,
328 public function addInlineCss(
string $a_css,
string $media =
"screen"): void
330 $this->inline_css[] = [
344 foreach ($this->css_files as $css) {
360 $this->body_class = $a_class;
368 if ($this->body_class !==
"" && $this->
blockExists(
"body_class")) {
370 $this->
setVariable(
"BODY_CLASS", $this->body_class);
382 bool $a_skip_main_menu,
399 if (!$a_skip_main_menu) {
441 if ($part === self::DEFAULT_BLOCK) {
442 $html = $this->
template->getUnmodified();
444 $html = $this->
template->getUnmodified($part);
450 $component_factory =
$DIC[
"component.factory"];
453 $id = $this->
template->getTemplateIdentifier(
454 $this->template_name,
458 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as $ui_plugin) {
459 $gui_class = $ui_plugin->getUIClassInstance();
460 $resp = $gui_class->getHTML(
471 $html = $gui_class->modifyHTML($html,
$resp);
483 $this->css_files = [];
491 if (!$this->blockExists(
"css_inline")) {
494 foreach ($this->inline_css as $css) {
495 $this->setCurrentBlock(
"css_inline");
497 $this->parseCurrentBlock();
504 "LOCATION_NEWCONTENT_STYLESHEET_TAG",
505 '<link rel="stylesheet" type="text/css" href="' .
519 if ($this->standard_template_loaded) {
526 $this->addBlockFile(
"CONTENT",
"content",
"tpl.adm_content.html");
527 $this->addBlockFile(
"STATUSLINE",
"statusline",
"tpl.statusline.html");
529 $this->standard_template_loaded =
true;
536 public function setTitle(
string $a_title,
bool $hidden =
false): void
538 $this->title = $a_title;
539 $this->header_page_title = $a_title;
547 $this->title_desc = $a_descr;
553 public function setTitleIcon(
string $a_icon_path,
string $a_icon_desc =
""): void
555 $this->icon_desc = $a_icon_desc;
556 $this->icon_path = $a_icon_path;
561 $this->title_alerts = $a_props;
567 $this->setTitleIcon(
"");
568 $this->setDescription(
"");
569 $this->setAlertProperties([]);
574 $this->header_action = $a_header;
579 $this->header_page_title = $a_title;
590 $header = $this->getHeaderActionMenu();
592 $header_tpl =
new ilTemplate(
'tpl.il_header.html',
true,
true);
594 if ($this->icon_path !==
"") {
595 $header_tpl->setCurrentBlock(
"header_image");
596 $header_tpl->setVariable(
"IMG_HEADER", $this->icon_path);
597 $header_tpl->parseCurrentBlock();
601 if ($this->title !==
"") {
603 $header_tpl->setVariable(
"HEADER", $title);
608 if ($header !==
'') {
609 $header_tpl->setCurrentBlock(
"header_image");
610 $header_tpl->parseCurrentBlock();
613 if ($this->title_desc !==
"") {
614 $header_tpl->setCurrentBlock(
"header_desc");
615 $header_tpl->setVariable(
"H_DESCRIPTION", $this->title_desc);
616 $header_tpl->parseCurrentBlock();
619 if ($header !==
'') {
620 $header_tpl->setCurrentBlock(
"head_action_inner");
621 $header_tpl->setVariable(
"HEAD_ACTION", $header);
622 $header_tpl->parseCurrentBlock();
625 foreach ($this->title_alerts as $alert) {
626 $header_tpl->setCurrentBlock(
'header_alert');
627 if (!($alert[
'propertyNameVisible'] ===
false)) {
628 $header_tpl->setVariable(
'H_PROP', $alert[
'property'] .
':');
630 $header_tpl->setVariable(
'H_VALUE', $alert[
'value']);
631 $header_tpl->parseCurrentBlock();
635 if ($this->enable_fileupload !==
null) {
637 $this->enable_fileupload,
642 "IL_DROPZONE_HEADER",
643 $file_upload->getDropzoneHtml()
646 $this->
setVariable(
"IL_HEADER", $header_tpl->get());
652 return $this->header_action;
659 $ilLocator =
$DIC[
"ilLocator"];
663 "components/ILIAS/Locator",
665 [
"locator_gui" => $ilLocator]
667 if (!$uip->replaced()) {
668 $html = $ilLocator->getHTML();
670 $html = $uip->getHTML($html);
678 public function setTabs(
string $a_tabs_html): void
680 if ($a_tabs_html !==
"" && $this->blockExists(
"tabs_outer_start")) {
681 $this->touchBlock(
"tabs_outer_start");
682 $this->touchBlock(
"tabs_outer_end");
683 $this->touchBlock(
"tabs_inner_start");
684 $this->touchBlock(
"tabs_inner_end");
699 if ($this->blockExists(
"tabs_outer_start")) {
700 $this->touchBlock(
"tabs_outer_start");
701 $this->touchBlock(
"tabs_outer_end");
702 $this->touchBlock(
"tabs_inner_start");
703 $this->touchBlock(
"tabs_inner_end");
705 if ($this->tabs_html !==
"") {
708 $this->
setVariable(
"SUB_TABS", $this->sub_tabs_html);
716 $ilTabs =
$DIC[
"ilTabs"];
718 if ($this->blockExists(
"tabs_outer_start")) {
719 $this->sub_tabs_html = $ilTabs->getSubTabHTML();
720 $this->tabs_html = $ilTabs->getHTML(
true);
726 if ($a_html !==
"") {
727 $this->main_content = $a_html;
733 if ($a_html !==
"") {
734 $this->left_content = $a_html;
740 if ($a_content !==
"") {
741 $this->left_nav_content = $a_content;
750 if (trim($this->left_nav_content) !==
"") {
751 $this->setCurrentBlock(
"left_nav");
752 $this->
setVariable(
"LEFT_NAV_CONTENT", trim($this->left_nav_content));
753 $this->parseCurrentBlock();
754 $this->touchBlock(
"left_nav_space");
760 if ($a_html !==
'') {
761 $this->right_content = $a_html;
770 if (!$this->blockExists(
"center_col_width")) {
774 $left = trim($this->left_content);
775 $right = trim($this->right_content);
778 case (
'' !== $left &&
'' !== $right):
779 $center_column_class =
'col-sm-6';
782 case (
'' !== $left ||
'' !== $right):
783 $center_column_class =
'col-sm-9';
787 $center_column_class =
"col-sm-12";
792 $center_column_class .=
" col-sm-push-3";
795 $this->setCurrentBlock(
"center_col_width");
796 $this->
setVariable(
"CENTER_COL", $center_column_class);
797 $this->parseCurrentBlock();
802 if (trim($this->main_content) !==
"") {
803 $this->
setVariable(
"ADM_CONTENT", trim($this->main_content));
812 if (trim($this->left_content) !==
"") {
813 $this->setCurrentBlock(
"left_column");
814 $this->
setVariable(
"LEFT_CONTENT", trim($this->left_content));
815 $left_col_class = (trim($this->right_content) ===
"")
816 ?
"col-sm-3 col-sm-pull-9"
817 :
"col-sm-3 col-sm-pull-6";
818 $this->
setVariable(
"LEFT_COL_CLASS", $left_col_class);
819 $this->parseCurrentBlock();
828 if (trim($this->right_content) !==
"") {
829 $this->setCurrentBlock(
"right_column");
830 $this->
setVariable(
"RIGHT_CONTENT", trim($this->right_content));
831 $this->parseCurrentBlock();
842 $ilToolbar =
$DIC[
"ilToolbar"];
843 $thtml = $ilToolbar->getHTML();
846 $this->setCurrentBlock(
"toolbar_buttons");
848 $this->parseCurrentBlock();
857 if (is_object(
$lng)) {
858 $this->
setVariable(
'META_CONTENT_LANGUAGE',
$lng->getContentLanguage());
869 if ($this->header_page_title !==
"") {
874 if (
$ilSetting->get(
'short_inst_name') !==
"") {
889 $this->page_form_action = $a_action;
897 if ($this->page_form_action !==
"") {
898 $this->setCurrentBlock(
"page_form_start");
899 $this->
setVariable(
"PAGE_FORM_ACTION", $this->page_form_action);
900 $this->parseCurrentBlock();
901 $this->touchBlock(
"page_form_end");
911 $this->login_target_par = $a_val;
916 return $this->login_target_par;
924 string $part = self::DEFAULT_BLOCK,
925 bool $add_error_mess =
false,
926 bool $handle_referer =
false,
927 bool $add_ilias_footer =
false,
928 bool $add_standard_elements =
false,
929 bool $a_main_menu =
true,
932 if ($add_error_mess) {
933 $this->fillMessage();
937 if ($add_standard_elements) {
938 if ($a_tabs && $this->blockExists(
"content")) {
940 $this->getTabsHTML();
944 $this->getMainMenu();
948 $this->fillCssFiles();
949 $this->fillInlineCss();
950 $this->fillBodyClass();
953 $this->setCurrentBlock();
954 $this->fillNewContentStyle();
955 $this->fillContentLanguage();
956 $this->fillWindowTitle();
960 $this->fillSideIcons();
961 $this->fillScreenReaderFocus();
962 $this->fillLeftContent();
963 $this->fillLeftNav();
964 $this->fillRightContent();
965 $this->fillAdminPanel();
966 $this->fillToolbar();
967 $this->fillPermanentLink();
969 $this->setCenterColumnClass();
972 $this->fillJavaScriptFiles();
973 $this->fillOnLoadCode();
976 if ($this->blockExists(
"content")) {
977 $this->setCurrentBlock(
"content");
981 $this->fillMainContent();
983 $this->fillMainMenu();
985 $this->parseCurrentBlock();
989 if ($part === self::DEFAULT_BLOCK) {
990 $html = $this->
template->get();
992 $html = $this->
template->get($part);
1002 string $part = self::DEFAULT_BLOCK,
1003 bool $a_fill_tabs =
true,
1004 bool $a_skip_main_menu =
false
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 print $this->renderPage(
1034 if ($this->tree_flat_link !==
"") {
1035 if ($this->left_nav_content !==
"") {
1036 $this->touchBlock(
"tree_lns");
1039 $this->setCurrentBlock(
"tree_mode");
1040 $this->
setVariable(
"LINK_MODE", $this->tree_flat_link);
1042 if (
$ilSetting->get(
"tree_frame") ===
"right") {
1045 $this->
setVariable(
"ALT_TREE",
$lng->txt($this->tree_flat_mode .
"view"));
1047 $this->parseCurrentBlock();
1050 $this->setCurrentBlock(
"tree_icons");
1051 $this->parseCurrentBlock();
1056 $this->tree_flat_link = $a_link;
1057 $this->tree_flat_mode = $a_mode;
1062 $this->admin_panel_commands_toolbar = $toolb;
1063 $this->admin_panel_arrow = $a_arrow;
1064 $this->admin_panel_bottom = $a_bottom_panel;
1075 if ($this->admin_panel_commands_toolbar ===
null) {
1079 $toolb = $this->admin_panel_commands_toolbar;
1082 if ($this->admin_panel_arrow) {
1086 $this->fillPageFormAction();
1089 $this->setCurrentBlock(
"adm_view_components");
1090 $this->
setVariable(
"ADM_PANEL1", $toolb->getHTML());
1091 $this->parseCurrentBlock();
1094 if ($this->admin_panel_bottom) {
1095 $this->setCurrentBlock(
"adm_view_components2");
1098 if ($this->admin_panel_arrow) {
1102 $this->
setVariable(
"ADM_PANEL2", $toolb->getHTML());
1103 $this->parseCurrentBlock();
1110 string $a_append =
"",
1111 string $a_target =
"",
1112 string $a_title =
""
1114 $this->permanent_link = [
1117 "append" => $a_append,
1118 "target" => $a_target,
1125 if (!empty($this->permanent_link)) {
1126 $plinkgui =
new ilPermanentLinkGUI(
1127 $this->permanent_link[
"type"],
1128 $this->permanent_link[
"id"],
1129 $this->permanent_link[
"append"],
1130 $this->permanent_link[
"target"]
1132 if ($this->permanent_link[
"title"] !==
"") {
1133 $plinkgui->setTitle($this->permanent_link[
"title"]);
1135 $this->
setVariable(
"PRMLINK", $plinkgui->getHTML());
1141 $this->setTitle(
'');
1142 $this->setTitleIcon(
'');
1143 $this->setDescription(
'');
1144 $this->setAlertProperties([]);
1145 $this->enable_fileupload =
null;
1148 if ($a_reset_header_action) {
1149 $this->setHeaderActionMenu(
'');
1155 $this->enable_fileupload = $a_ref_id;
1161 public function get(
string $part = self::DEFAULT_BLOCK):
string
1163 return $this->
template->get($part);
1168 $this->
template->setVariable($variable, $value);
1173 return $this->
template->variableExists($a_variablename);
1181 return $this->
template->setCurrentBlock($part);
1189 return $this->
template->touchBlock($block);
1197 return $this->
template->parseCurrentBlock($part);
1203 public function addBlockFile(
string $var,
string $block,
string $template_name, ?
string $in_module =
null): bool
1205 return $this->
template->addBlockFile($var, $block, $template_name, $in_module);
1210 return $this->
template->blockExists($a_blockname);
1215 return $this->js_files_batch;
1220 return $this->css_files;
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Customizing of pimple-DIC for ILIAS.
setVariable(string $a_group_name, string $a_var_name, string $a_var_value)
sets a variable in a group
special template class to simplify handling of ITX/PEAR
printToStdout(string $part=self::DEFAULT_BLOCK, bool $a_fill_tabs=true, bool $a_skip_main_menu=false)
setHeaderActionMenu(string $a_header)
Set header action menu.
setBodyClass(string $a_class="")
Sets the body-tags class.
addInlineCss(string $a_css, string $media="screen")
Add a css file that should be included in the header.
setTabs(string $a_tabs_html)
setPageFormAction(string $a_action)
Sets the pages form action.
setOnScreenMessage(string $a_type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
setPermanentLink(string $a_type, ?int $a_id, string $a_append="", string $a_target="", string $a_title="")
Generates and sets a permanent ilias link.
setDescription(string $a_descr)
Sets descripton below title in standard template.
getMessageTextForType(string $type)
string $header_page_title
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
fillJavaScriptFiles(bool $a_force=false)
Probably adds javascript files.
setLocator()
Insert locator.
addAdminPanelToolbar(ilToolbarGUI $toolb, bool $a_bottom_panel=true, bool $a_arrow=false)
loadStandardTemplate()
This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STA...
getOnLoadCodeForAsynch()
Get js onload code for ajax calls.
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.
resetHeaderBlock(bool $a_reset_header_action=true)
Reset all header properties: title, icon, description, alerts, action menu.
ilToolbarGUI $admin_panel_commands_toolbar
addCss(string $a_css_file, string $media="screen")
Add a css file that should be included in the header.
hideFooter()
Make the template hide the footer.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
printToString(string $part=self::DEFAULT_BLOCK)
setLeftContent(string $a_html)
Sets content of left column.
setTreeFlatIcon(string $a_link, string $a_mode)
Sets a tree or flat icon.
setLeftNavContent(string $a_content)
Sets content of left navigation column.
setLoginTargetPar(string $a_val)
Set target parameter for login (public sector).
bool $standard_template_loaded
setContent(string $a_html)
Sets content for standard template.
fillJavascriptFile(string $file, string $vers)
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setFileUploadRefId(int $a_ref_id)
Enables the file upload into this object by dropping a file.
setSubTabs(string $a_tabs_html)
sets subtabs in standard template
setHeaderPageTitle(string $a_title)
Sets the title of the page (for browser window).
touchBlock(string $block)
renderPage(string $part, bool $a_fill_tabs, bool $a_skip_main_menu, Container $DIC)
blockExists(string $a_blockname)
check if block exists in actual template
addBlockFile(string $var, string $block, string $template_name, ?string $in_module=null)
__construct(string $file, bool $flag1, bool $flag2, string $in_module='', string $vars=self::DEFAULT_BLOCK, bool $plugin=false, bool $a_use_cache=true)
parseCurrentBlock(string $part=self::DEFAULT_BLOCK)
fillCssFiles(bool $a_force=false)
setAlertProperties(array $a_props)
Set alert properties.
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)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setRightContent(string $a_html)
Sets content of right column.
clearHeader()
Clear header.
resetJavascript()
Reset javascript files.
variableExists(string $a_variablename)
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.
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
if(!file_exists('../ilias.ini.php'))