ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilForumPageGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 protected string $language = '-';
29
30 public function __construct(
31 int $a_id = 0,
32 int $a_old_nr = 0,
33 protected bool $isEmbeddedMode = false,
34 string $language = ''
35 ) {
36 parent::__construct(self::OBJ_TYPE, $a_id, $a_old_nr, false, $language);
37 $this->setTemplateTargetVar('ADM_CONTENT');
38 $this->setTemplateOutput(false);
39 }
40
41 public function getProfileBackUrl(): string
42 {
43 if ($this->isEmbeddedMode) {
44 return '';
45 }
46
47 return parent::getProfileBackUrl();
48 }
49
50 public function finishEditing(): void
51 {
52 $this->ctrl->redirectByClass(ilObjForumGUI::class, 'showThreads');
53 }
54
55 public function setDefaultLinkXml(): void
56 {
57 parent::setDefaultLinkXml();
58
59 if ($this->isEmbeddedMode) {
60 $linkXml = $this->getLinkXML();
61
62 try {
63 $linkXml = str_replace('<LinkTargets></LinkTargets>', '', $linkXml);
64
65 $domDoc = new DOMDocument();
66 $domDoc->loadXML('<?xml version="1.0" encoding="UTF-8"?>' . $linkXml);
67
68 $xpath = new DOMXPath($domDoc);
69 $links = $xpath->query('//IntLinkInfos/IntLinkInfo');
70
71 if ($links->length > 0) {
72 foreach ($links as $link) {
74 $link->attributes->getNamedItem('LinkTarget')->nodeValue = '_blank';
75 }
76 }
77
78 $linkXmlWithBlankTargets = $domDoc->saveXML();
79
80 $this->setLinkXml(str_replace('<?xml version="1.0" encoding="UTF-8"?>', '', $linkXmlWithBlankTargets));
81 } catch (Throwable $e) {
82 $this->log->error(sprintf(
83 'Could not manipulate page editor link XML: %s / Error Message: %s',
84 $linkXml,
85 $e->getMessage()
86 ));
87 }
88 }
89 }
90
91 public function getAdditionalPageActions(): array
92 {
93 $this->ctrl->setParameterByClass(ilObjForumGUI::class, 'page_editor_style', '1');
94
95 $tabs = [
96 $this->ui->factory()->link()->standard(
97 $this->lng->txt('obj_sty'),
98 $this->ctrl->getLinkTargetByClass([
99 ilRepositoryGUI::class,
100 ilObjForumGUI::class
101 ], 'editStyleProperties')
102 )
103 ];
104
105 $this->ctrl->setParameterByClass(ilObjForumGUI::class, 'page_editor_style', null);
106
107 return $tabs;
108 }
109}
@ilCtrl_Calls ilForumPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI @ilCtrl_Calls ilForu...
__construct(int $a_id=0, int $a_old_nr=0, protected bool $isEmbeddedMode=false, string $language='')
getAdditionalPageActions()
Get additional page actions.
Class ilPageObjectGUI.
ILIAS COPage Link LinkManager $link
setTemplateOutput(bool $a_output=true)
setTemplateTargetVar(string $a_variable)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc