ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilImprintGUI.php
Go to the documentation of this file.
1 <?php
2 
18 declare(strict_types=1);
19 
21 
31 {
34 
35  public function __construct()
36  {
37  global $DIC;
38 
39  $this->tpl = $DIC["tpl"];
40  $this->ctrl = $DIC->ctrl();
41  $this->locator = $DIC["ilLocator"];
42  $this->lng = $DIC->language();
43 
44  $this->imprint_request = new StandardGUIRequest(
45  $DIC->http(),
46  $DIC->refinery()
47  );
48 
49  if (!ilImprint::_exists("impr", 1)) {
50  $page = new ilImprint();
51  $page->setId(1);
52  $page->create(false);
53  }
54 
55  // there is only 1 imprint page
56  parent::__construct("impr", 1);
57 
58  // content style (using system defaults)
59  $this->tpl->setCurrentBlock("SyntaxStyle");
60  $this->tpl->setVariable(
61  "LOCATION_SYNTAX_STYLESHEET",
63  );
64  $this->tpl->parseCurrentBlock();
65 
66  $this->tpl->setCurrentBlock("ContentStyle");
67  $this->tpl->setVariable(
68  "LOCATION_CONTENT_STYLESHEET",
70  );
71  $this->tpl->parseCurrentBlock();
72  }
73 
74  public function executeCommand(): string
75  {
76  if (strtolower($this->imprint_request->getBaseClass()) ===
77  strtolower(ilImprintGUI::class)) {
78  $this->renderFullscreen();
79  }
80 
81  $next_class = $this->ctrl->getNextClass($this);
82 
83  $title = $this->lng->txt("adm_imprint");
84 
85  switch ($next_class) {
86  default:
87  $this->setPresentationTitle($title);
88  $ret = parent::executeCommand();
89  $this->tabs_gui->activateTab("pg");
90  return $ret;
91  }
92  }
93 
94  public function postOutputProcessing(string $a_output): string
95  {
96  $lng = $this->lng;
97 
98  if ($this->getOutputMode() === ilPageObjectGUI::PREVIEW) {
99  if (!$this->getPageObject()->getActive()) {
100  $this->tpl->setOnScreenMessage('info', $lng->txt("adm_imprint_inactive"));
101  }
102  }
103 
104  return $a_output;
105  }
106 
107  protected function renderFullscreen(): void
108  {
109  if (!ilImprint::isActive()) {
110  $this->ctrl->redirectToURL("ilias.php?baseClass=ilDashboardGUI");
111  }
112  $this->tpl->setTitle($this->lng->txt("imprint"));
113  $this->tpl->loadStandardTemplate();
114 
115  $this->setRawPageContent(true);
116  $this->tpl->setContent($this->showPage());
117 
118  $this->tpl->printToStdout("DEFAULT", true, false);
119  exit();
120  }
121 
122  protected function showEditToolbar(): void
123  {
124  $ui = $this->ui;
125  $lng = $this->lng;
126  if ($this->getEnableEditing()) {
127  $b = $ui->factory()->button()->standard(
128  $lng->txt("edit_page"),
129  $this->ctrl->getLinkTargetByClass([ilObjLegalNoticeGUI::class, __CLASS__], "edit")
130  );
131  $this->toolbar->addComponent($b);
132  }
133  }
134 
135  public function getTabs(string $a_activate = ""): void
136  {
137  if ($this->getOutputMode() === self::PRESENTATION) {
138  $this->tabs_gui->activateTab('view');
139  }
140  }
141 
142  public function preview(): string
143  {
144  $this->setOutputMode(self::PREVIEW);
145  return $this->showPage();
146  }
147 }
ILIAS DI UIServices $ui
getTabs(string $a_activate="")
postOutputProcessing(string $a_output)
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...
setOutputMode(string $a_mode=self::PRESENTATION)
Class ilPageObjectGUI.
StandardGUIRequest $imprint_request
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilCtrlBaseClassInterface describes ilCtrl base classes.
setRawPageContent(bool $a_rawpagecontent)
Set Get raw page content only.
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...
global $DIC
Definition: shib_login.php:25
setPresentationTitle(string $a_title="")
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
ilLocatorGUI $locator
Class ilImprintGUI.
__construct(Container $dic, ilPlugin $plugin)
showPage()
display content of page
static isActive()