ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilContainerStartObjectsContentGUI.php
Go to the documentation of this file.
1 <?php
2 
22 
29 {
31  protected ilLanguage $lng;
32  protected ilSetting $settings;
33  protected ilObjUser $user;
37  protected bool $enable_desktop;
40  protected \ILIAS\Style\Content\GUIService $content_style_gui;
41  protected \ILIAS\Style\Content\Object\ObjectFacade $content_style_domain;
42 
43  public function __construct(
44  ilContainerGUI $a_gui,
45  ilContainer $a_parent_obj
46  ) {
47  global $DIC;
48 
49  $this->tpl = $DIC["tpl"];
50  $this->lng = $DIC->language();
51  $this->settings = $DIC->settings();
52  $this->user = $DIC->user();
53  $this->ui_factory = $DIC->ui()->factory();
54  $this->ui_renderer = $DIC->ui()->renderer();
55  $this->parent_gui = $a_gui;
56  $this->parent_obj = $a_parent_obj;
57  $this->start_object = new ilContainerStartObjects(
58  $a_parent_obj->getRefId(),
59  $a_parent_obj->getId()
60  );
61  $cs = $DIC->contentStyle();
62  $this->content_style_domain = $cs->domain()->styleForRefId($a_parent_obj->getRefId());
63  $this->content_style_gui = $cs->gui();
64  }
65 
66  public function enableDesktop(
67  bool $a_value,
68  ilContainerGUI $a_parent_gui
69  ): void {
70  $this->enable_desktop = $a_value;
71 
72  if ($this->enable_desktop) {
73  $this->parent_gui = $a_parent_gui;
74  }
75  }
76 
77  // Set HTML in main template
78  public function getHTML(): void
79  {
80  $tpl = $this->tpl;
81  $lng = $this->lng;
82 
83  $lng->loadLanguageModule("crs");
84 
85  $tbl = new ObjectsContent(
86  $this->parent_gui,
87  $this->start_object,
88  $this->ui_factory,
89  $this->ui_renderer,
90  $this->enable_desktop
91  );
92  $tpl->setContent(
93  $this->getPageHTML() .
94  $tbl->render()
95  );
96  }
97 
98  protected function getPageHTML(): string
99  {
100  $tpl = $this->tpl;
102 
103  if (!$ilSetting->get("enable_cat_page_edit")) {
104  return "";
105  }
106 
107  $page_id = $this->start_object->getObjId();
108 
109  // if page does not exist, return nothing
110  if (!ilPageUtil::_existsAndNotEmpty("cstr", $page_id)) {
111  return "";
112  }
113 
114  $this->content_style_gui->addCss($tpl, $this->parent_obj->getRefId());
115  $tpl->setCurrentBlock("SyntaxStyle");
116  $tpl->setVariable(
117  "LOCATION_SYNTAX_STYLESHEET",
119  );
120  $tpl->parseCurrentBlock();
121 
122  $page_gui = new ilContainerStartObjectsPageGUI($page_id);
123 
124  $page_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
125 
126  $page_gui->setPresentationTitle("");
127  $page_gui->setTemplateOutput(false);
128  $page_gui->setHeader("");
129  return $page_gui->showPage();
130  }
131 }
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
Container start objects page GUI class.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContent(string $a_html)
Sets content for standard template.
loadLanguageModule(string $a_module)
Load language module.
enableDesktop(bool $a_value, ilContainerGUI $a_parent_gui)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
ILIAS Style Content Object ObjectFacade $content_style_domain
static _existsAndNotEmpty(string $a_parent_type, int $a_id, string $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages) ...
global $DIC
Definition: shib_login.php:26
Class ilContainer.
global $ilSetting
Definition: privfeed.php:31
Class ilContainerStartObjectsContentGUI.
__construct(ilContainerGUI $a_gui, ilContainer $a_parent_obj)