ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.PageManager.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2022 ILIAS open source, GPLv3, see LICENSE */
4 
6 
8 
13 {
14  protected ?string $lang = null;
16  protected \ilContainer $container;
17  protected \ILIAS\Style\Content\DomainService $content_style_domain;
18 
19  public function __construct(
20  InternalDomainService $domain_service,
21  \ILIAS\Style\Content\DomainService $content_style_domain,
22  \ilContainer $container,
23  ?string $lang = null
24  ) {
25  $this->content_style_domain = $content_style_domain;
26  $this->domain_service = $domain_service;
27  $this->container = $container;
28  $user = $this->domain_service->user();
29  if (is_null($lang)) {
30  $ot = \ilObjectTranslation::getInstance($this->container->getId());
31  $this->lang = $ot->getEffectiveContentLang($user->getCurrentLanguage(), "cont");
32  } else {
33  $this->lang = $lang;
34  }
35  }
36 
37  public function getHtml(): string
38  {
39  $settings = $this->domain_service->settings();
40 
41  if (!$settings->get("enable_cat_page_edit") || $this->container->filteredSubtree()) {
42  return "";
43  }
44 
45  // if page does not exist, return nothing
47  "cont",
48  $this->container->getId(),
50  )) {
51  return "";
52  }
53 
54  // get page object
55  $page_gui = new \ilContainerPageGUI($this->container->getId(), 0, $this->lang);
56  $style = $this->content_style_domain->styleForRefId($this->container->getRefId());
57  $page_gui->setStyleId($style->getEffectiveStyleId());
58 
59  $page_gui->setPresentationTitle("");
60  $page_gui->setTemplateOutput(false);
61  $page_gui->setHeader("");
62  $html = $page_gui->showPage();
63 
64  return $html;
65  }
66 
67  public function getDom(): ?\DOMDocument
68  {
69  $settings = $this->domain_service->settings();
70 
71  if (!$settings->get("enable_cat_page_edit") || $this->container->filteredSubtree()) {
72  return null;
73  }
74 
75  // if page does not exist, return nothing
77  "cont",
78  $this->container->getId(),
80  )) {
81  return null;
82  }
83 
84  // get page object
85  $page_gui = new \ilContainerPageGUI($this->container->getId(), 0, $this->lang);
86  $page = $page_gui->getPageObject();
87  $page->buildDom();
88  return $page->getDomDoc();
89  }
90 
91 }
__construct(InternalDomainService $domain_service, \ILIAS\Style\Content\DomainService $content_style_domain, \ilContainer $container, ?string $lang=null)
array $settings
Setting values (LTI parameters, custom parameters and local parameters).
Definition: System.php:200
InternalDomainService $domain_service
Class ChatMainBarProvider .
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) ...
ILIAS Style Content DomainService $content_style_domain
static getInstance(int $obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...