ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
class.PageManager.php
Go to the documentation of this file.
1 <?php
2 
20 
22 
27 {
28  protected ?string $lang = null;
30  protected \ilContainer $container;
31  protected \ILIAS\Style\Content\DomainService $content_style_domain;
32 
33  public function __construct(
35  InternalDomainService $domain_service,
36  \ILIAS\Style\Content\DomainService $content_style_domain,
37  \ilContainer $container,
38  ?string $lang = null
39  ) {
40  $this->content_style_domain = $content_style_domain;
41  $this->domain_service = $domain_service;
42  $this->container = $container;
43  $user = $this->domain_service->user();
44  if (is_null($lang)) {
45  $ot = $this->container->getObjectProperties()->getPropertyTranslations();
46  $this->lang = $ot->getEffectiveCOPageLang($user->getCurrentLanguage(), "cont");
47  } else {
48  $this->lang = $lang;
49  }
50  }
51 
52  public function getHtml(): string
53  {
54  $settings = $this->domain_service->settings();
55 
56  if (!$settings->get("enable_cat_page_edit") || $this->container->filteredSubtree()) {
57  return "";
58  }
59 
60  // if page does not exist, return nothing
62  "cont",
63  $this->container->getId(),
65  )) {
66  return "";
67  }
68 
69  // get page object
70  $page_gui = new \ilContainerPageGUI($this->container->getId(), 0, $this->lang);
71  $style = $this->content_style_domain->styleForRefId($this->container->getRefId());
72  $page_gui->setStyleId($style->getEffectiveStyleId());
73 
74  $page_gui->setPresentationTitle("");
75  $page_gui->setTemplateOutput(false);
76  $page_gui->setHeader("");
77  $html = $page_gui->showPage();
78 
79  return $html;
80  }
81 
82  public function getDom(): ?\DOMDocument
83  {
84  $settings = $this->domain_service->settings();
85 
86  if (!$settings->get("enable_cat_page_edit") || $this->container->filteredSubtree()) {
87  return null;
88  }
89 
90  // if page does not exist, return nothing
92  "cont",
93  $this->container->getId(),
95  )) {
96  return null;
97  }
98 
99  // get page object
100  $page_gui = new \ilContainerPageGUI($this->container->getId(), 0, $this->lang);
101  $page = $page_gui->getPageObject();
102  $page->buildDom();
103  return $page->getDomDoc();
104  }
105 
106 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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) ...
Class ilContainer.
__construct(\ilDBInterface $db, InternalDomainService $domain_service, \ILIAS\Style\Content\DomainService $content_style_domain, \ilContainer $container, ?string $lang=null)