ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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(
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(),
64 $this->lang
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(),
94 $this->lang
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}
ILIAS Style Content DomainService $content_style_domain
InternalDomainService $domain_service
__construct(\ilDBInterface $db, InternalDomainService $domain_service, \ILIAS\Style\Content\DomainService $content_style_domain, \ilContainer $container, ?string $lang=null)
Class ilContainer.
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)
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.