ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilImprintGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
28{
30 private \ILIAS\Http\GlobalHttpState $http;
31
32 public function __construct()
33 {
34 global $DIC;
35
36 $this->tpl = $DIC['tpl'];
37 $this->ctrl = $DIC->ctrl();
38 $this->lng = $DIC->language();
39 $this->http = $DIC->http();
40
41 $this->imprint_request = new StandardGUIRequest(
42 $DIC->http(),
43 $DIC->refinery()
44 );
45
46 if (!ilImprint::_exists('impr', 1)) {
47 $page = new ilImprint();
48 $page->setId(1);
49 $page->create(false);
50 }
51
52 // there is only 1 imprint page
53 parent::__construct('impr', 1);
54
55 // content style (using system defaults)
56 $this->tpl->setCurrentBlock('SyntaxStyle');
57 $this->tpl->setVariable(
58 'LOCATION_SYNTAX_STYLESHEET',
60 );
61 $this->tpl->parseCurrentBlock();
62
63 $this->tpl->setCurrentBlock('ContentStyle');
64 $this->tpl->setVariable(
65 'LOCATION_CONTENT_STYLESHEET',
67 );
68 $this->tpl->parseCurrentBlock();
69 }
70
71 public function executeCommand(): string
72 {
73 if (strtolower($this->imprint_request->getBaseClass()) === strtolower(__CLASS__)) {
74 $this->renderFullscreen();
75 }
76
77 $next_class = $this->ctrl->getNextClass($this);
78
79 $title = $this->lng->txt('adm_imprint');
80
81 switch ($next_class) {
82 default:
83 $this->setPresentationTitle($title);
84 $ret = parent::executeCommand();
85 $this->tabs_gui->activateTab('pg');
86 return $ret;
87 }
88 }
89
90 public function postOutputProcessing(string $a_output): string
91 {
93
94 if ($this->getOutputMode() === ilPageObjectGUI::PREVIEW && !$this->getPageObject()->getActive()) {
95 $this->tpl->setOnScreenMessage('info', $lng->txt('adm_imprint_inactive'));
96 }
97
98 return $a_output;
99 }
100
101 private function renderFullscreen(): never
102 {
103 if (!ilImprint::isActive()) {
104 $this->ctrl->redirectToURL('ilias.php?baseClass=ilDashboardGUI');
105 }
106
107 $this->tpl->setTitle($this->lng->txt('imprint'));
108 $this->tpl->loadStandardTemplate();
109
110 $this->setRawPageContent(true);
111 $this->tpl->setContent($this->showPage());
112
113 $this->tpl->printToStdout('DEFAULT', true, false);
114
115 $this->http->close();
116 }
117
118 public function showEditToolbar(): void
119 {
120 $ui = $this->ui;
122 if ($this->getEnableEditing()) {
123 $b = $ui->factory()->button()->standard(
124 $lng->txt('edit_page'),
125 $this->ctrl->getLinkTargetByClass([ilObjLegalNoticeGUI::class, __CLASS__], 'edit')
126 );
127 $this->toolbar->addComponent($b);
128 }
129 }
130
131 public function getTabs(string $a_activate = ''): void
132 {
133 if ($this->getOutputMode() === self::PRESENTATION) {
134 $this->tabs_gui->activateTab('view');
135 }
136 }
137
138 public function preview(): string
139 {
140 $this->setOutputMode(self::PREVIEW);
141 return $this->showPage();
142 }
143}
@ilCtrl_Calls ilImprintGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMediaPoolTargetSelector @ilCtrl_Ca...
showEditToolbar()
Show edit toolbar.
ILIAS Http GlobalHttpState $http
StandardGUIRequest $imprint_request
postOutputProcessing(string $a_output)
Finalizing output processing.
getTabs(string $a_activate='')
executeCommand()
execute command
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isActive()
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
Class ilPageObjectGUI.
showPage()
display content of page
setPresentationTitle(string $a_title="")
setRawPageContent(bool $a_rawpagecontent)
Set Get raw page content only.
setOutputMode(string $a_mode=self::PRESENTATION)
ILIAS DI UIServices $ui
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26