19 declare(strict_types=1);
78 string $in_module =
'',
81 bool $a_use_cache =
true 93 $this->ui_service = $DIC->ui();
96 public function addBlockFile(
string $var,
string $block,
string $template_name,
string $in_module = null): bool
98 return $this->
template->addBlockFile($var, $block, $template_name, $in_module);
103 return $this->
template->blockExists($block_name);
108 $this->
template->removeBlockData($block_name);
111 public function setVariable(
string $variable,
string $value =
''): void
113 $this->
template->setVariable($variable, $value);
118 return $this->
template->setCurrentBlock($block_name);
123 $this->
template->touchBlock($block_name);
128 return $this->
template->parseCurrentBlock($block_name);
133 if (!empty($page_form_action)) {
140 if (!empty($main_content)) {
152 if (!empty($image_src)) {
153 $this->banner_image_src = $image_src;
162 public function setTitle(
string $title,
bool $is_hidden =
false): void
164 if (!empty($title)) {
166 $this->is_title_hidden = $is_hidden;
182 if (!empty($header_action)) {
204 if (!empty($content)) {
205 $this->right_content = $content;
211 if (!empty($content)) {
212 $this->left_content = $content;
218 if (!empty($filter)) {
225 if (null !== $this->
filter) {
226 $this->
template->setCurrentBlock(
"filter");
227 $this->
template->setVariable(
"FILTER", trim($this->
filter));
228 $this->
template->parseCurrentBlock();
234 if (!empty($icon_path)) {
241 if (!empty($icon_desc)) {
248 $this->file_upload_ref_id = $upload_ref_id;
254 throw new InvalidArgumentException(
"Type '$type' is not declared in " . self::class .
"::MESSAGE_TYPES and is therefore invalid.");
266 return $this->
template->get($part);
269 public function renderPage(
string $part,
bool $a_fill_tabs): string
277 if ($this->template->blockExists(
"content")) {
291 if ($this->template->blockExists(
"content")) {
292 $this->
template->setCurrentBlock(
"content");
295 $this->
template->parseCurrentBlock();
300 $html = $this->
template->getUnmodified();
302 $html = $this->
template->getUnmodified($part);
308 $component_factory = $DIC[
"component.factory"];
309 foreach ($component_factory->getActivePluginsInSlot(
"uihk") as $ui_plugin) {
310 $gui_class = $ui_plugin->getUIClassInstance();
312 $resp = $gui_class->getHTML(
323 $html = $gui_class->modifyHTML($html,
$resp);
344 if (count($messages) > 0) {
345 $this->
template->setVariable(
"MESSAGE", $this->ui_service->renderer()->render($messages));
351 $box_factory = $this->ui_service->factory()->messageBox();
354 $box = $box_factory->info($message);
357 $box = $box_factory->success($message);
360 $box = $box_factory->confirmation($message);
363 $box = $box_factory->failure($message);
378 return $this->messages[$type] ?? null;
384 $ilTabs = $DIC[
"ilTabs"];
386 if ($this->template->blockExists(
"tabs_outer_start")) {
387 $this->sub_tabs_html = $ilTabs->getSubTabHTML();
388 $this->tabs_html = $ilTabs->getHTML(
true);
401 $lng = $DIC->language();
403 $header_tpl =
new ilTemplate(
'tpl.il_header.html',
true,
true);
406 if (null !== $this->banner_image_src && $this->template->blockExists(
"banner_bl")) {
407 $header_tpl->setCurrentBlock(
"banner_bl");
408 $header_tpl->setVariable(
"BANNER_URL", $this->banner_image_src);
410 $header_tpl->parseCurrentBlock();
413 if (null !== $this->icon_path) {
414 $header_tpl->setCurrentBlock(
"header_image");
415 $header_tpl->setVariable(
"IMG_HEADER", $this->icon_path);
416 $header_tpl->parseCurrentBlock();
420 if (null !== $this->title) {
422 $header_tpl->setVariable(
"HEADER", $title);
423 if ($this->is_title_hidden) {
424 $header_tpl->touchBlock(
"hidden_title");
430 if ($header && !$this->is_title_hidden) {
431 $header_tpl->setCurrentBlock(
"header_image");
432 $header_tpl->parseCurrentBlock();
435 if (null !== $this->title_desc) {
436 $header_tpl->setCurrentBlock(
"header_desc");
437 $header_tpl->setVariable(
"H_DESCRIPTION", $this->title_desc);
438 $header_tpl->parseCurrentBlock();
441 if (null !== $this->header_action) {
442 $header_tpl->setCurrentBlock(
"head_action_inner");
443 $header_tpl->setVariable(
"HEAD_ACTION", $this->header_action);
444 $header_tpl->parseCurrentBlock();
447 foreach ($this->title_alerts as $alert) {
448 $header_tpl->setCurrentBlock(
'header_alert');
449 if (!(
bool) ($alert[
'propertyNameVisible'] ??
false)) {
450 $this->
template->setVariable(
'H_PROP', $alert[
'property'] .
':');
452 $header_tpl->setVariable(
'H_VALUE', $alert[
'value']);
453 $header_tpl->parseCurrentBlock();
457 if ($this->file_upload_ref_id !== null) {
459 $this->file_upload_ref_id,
463 $this->
template->setVariable(
464 "IL_DROPZONE_HEADER",
465 $file_upload->getDropzoneHtml()
468 $this->
template->setVariable(
"IL_HEADER", $header_tpl->get());
475 if (!$this->template->blockExists(
"center_col_width")) {
480 case (null !== $this->left_content && null !== $this->right_content):
481 $center_column_class =
'col-sm-6';
484 case (null !== $this->left_content || null !== $this->right_content):
485 $center_column_class =
'col-sm-9';
489 $center_column_class =
'col-sm-12';
493 if (null !== $this->left_content) {
494 $center_column_class .=
" col-sm-push-3";
497 $this->
template->setCurrentBlock(
"center_col_width");
498 $this->
template->setVariable(
"CENTER_COL", $center_column_class);
499 $this->
template->parseCurrentBlock();
504 if (null !== $this->main_content) {
505 $this->
template->setVariable(
"ADM_CONTENT", trim($this->main_content));
511 if (null !== $this->left_content) {
512 $this->
template->setCurrentBlock(
"left_column");
513 $this->
template->setVariable(
"LEFT_CONTENT", trim($this->left_content));
516 ?
"col-sm-3 col-sm-pull-9" 517 :
"col-sm-3 col-sm-pull-6";
519 $this->
template->setVariable(
"LEFT_COL_CLASS", $left_col_class);
520 $this->
template->parseCurrentBlock();
526 if (null !== $this->right_content) {
527 $this->
template->setCurrentBlock(
"right_column");
528 $this->
template->setVariable(
"RIGHT_CONTENT", trim($this->right_content));
529 $this->
template->parseCurrentBlock();
536 $lng = $DIC->language();
538 if (null === $this->admin_panel_commands_toolbar) {
543 if ($this->should_display_admin_panel_arrow) {
549 $this->
template->setCurrentBlock(
"adm_view_components");
550 $this->
template->setVariable(
"ADM_PANEL1", $current_toolbar->getHTML());
551 $this->
template->parseCurrentBlock();
554 if ($this->is_admin_panel_for_bottom) {
555 $this->
template->setCurrentBlock(
"adm_view_components2");
558 if ($this->should_display_admin_panel_arrow) {
562 $current_toolbar->setId($current_toolbar->getId() .
"2");
563 $this->
template->setVariable(
"ADM_PANEL2", $current_toolbar->getHTML());
564 $this->
template->parseCurrentBlock();
570 if (null !== $this->page_form_action) {
571 $this->
template->setCurrentBlock(
"page_form_start");
572 $this->
template->setVariable(
"PAGE_FORM_ACTION", $this->page_form_action);
573 $this->
template->parseCurrentBlock();
574 $this->
template->touchBlock(
"page_form_end");
581 $ilToolbar = $DIC[
"ilToolbar"];
583 $toolbar_html = $ilToolbar->getHTML();
584 if (!empty($toolbar_html)) {
585 $this->
template->setCurrentBlock(
"toolbar_buttons");
586 $this->
template->setVariable(
"BUTTONS", $toolbar_html);
587 $this->
template->parseCurrentBlock();
593 if ($this->template->blockExists(
"tabs_outer_start")) {
594 $this->
template->touchBlock(
"tabs_outer_start");
595 $this->
template->touchBlock(
"tabs_outer_end");
596 $this->
template->touchBlock(
"tabs_inner_start");
597 $this->
template->touchBlock(
"tabs_inner_end");
599 if (null !== $this->tabs_html) {
600 $this->
template->setVariable(
"TABS", $this->tabs_html);
603 if (null !== $this->sub_tabs_html) {
604 $this->
template->setVariable(
"SUB_TABS", $this->sub_tabs_html);
static get(string $a_var)
setPageFormAction(string $page_form_action)
ilToolbarGUI $admin_panel_commands_toolbar
setAdminPanelBottom(bool $is_admin_panel_for_bottom)
setAdminPanelCommandsToolbar(ilToolbarGUI $admin_panel_commands_toolbar)
setTitleAlerts(array $title_alerts)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
setFileUploadRefId(int $upload_ref_id)
static stripScriptHTML(string $a_str, string $a_allow="", bool $a_rm_js=true)
renderPage(string $part, bool $a_fill_tabs)
getMessageTextForType(string $type)
setMainContent(string $main_content)
setHeaderPageTitle(string $header_page_title)
removeBlockData(string $block_name)
setIconPath(string $icon_path)
setTitleDesc(string $title_desc)
bool $should_display_admin_panel_arrow
addBlockFile(string $var, string $block, string $template_name, string $in_module=null)
setCurrentBlock(string $block_name=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setRightContent(string $content)
setVariable(string $variable, string $value='')
bool $is_admin_panel_for_bottom
touchBlock(string $block_name)
setIconDesc(string $icon_desc)
getMessageBox(string $type, string $message)
ILIAS DI UIServices $ui_service
setLeftContent(string $content)
setTitle(string $title, bool $is_hidden=false)
setHeaderAction(string $header_action)
setFilter(string $filter)
setOnScreenMessage(string $type, string $message, bool $should_keep=false)
blockExists(string $block_name)
setAdminPanelArrow(bool $should_display_admin_panel_arrow)
static _saveUsages()
Store the collected language variable usages in the user session This should be called as late as pos...
parseCurrentBlock(string $block_name=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(string $file, bool $flag1, bool $flag2, string $in_module='', string $vars=ilGlobalTemplateInterface::DEFAULT_BLOCK, bool $plugin=false, bool $a_use_cache=true)
setBanner(string $image_src)
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.