ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilContentPagePageGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
11{
13 protected $isEmbeddedMode = false;
15 protected $language = '-';
25 public function __construct($a_id = 0, $a_old_nr = 0, $isEmbeddedMode = false, $language = '')
26 {
27 parent::__construct(self::OBJ_TYPE, $a_id, $a_old_nr, false, $language);
28 $this->setTemplateTargetVar('ADM_CONTENT');
29 $this->setTemplateOutput(false);
30 $this->isEmbeddedMode = $isEmbeddedMode;
31 }
32
36 public function getProfileBackUrl()
37 {
38 if ($this->isEmbeddedMode) {
39 return '';
40 }
41
42 return parent::getProfileBackUrl();
43 }
44
48 public function setDefaultLinkXml()
49 {
50 parent::setDefaultLinkXml();
51
52 if ($this->isEmbeddedMode) {
53 $linkXml = $this->getLinkXML();
54
55 try {
56 $linkXml = str_replace('<LinkTargets></LinkTargets>', '', $linkXml);
57
58 $domDoc = new DOMDocument();
59 $domDoc->loadXML('<?xml version="1.0" encoding="UTF-8"?>' . $linkXml);
60
61 $xpath = new DOMXPath($domDoc);
62 $links = $xpath->query('//IntLinkInfos/IntLinkInfo');
63
64 if ($links->length > 0) {
65 foreach ($links as $link) {
67 $link->attributes->getNamedItem('LinkTarget')->nodeValue = '_blank';
68 }
69 }
70
71 $linkXmlWithBlankTargets = $domDoc->saveXML();
72
73 $this->setLinkXML(str_replace('<?xml version="1.0" encoding="UTF-8"?>', '', $linkXmlWithBlankTargets));
74 } catch (Throwable $e) {
75 $this->log->error(sprintf(
76 'Could not manipulate page editor link XML: %s / Error Message: %s',
77 $linkXml,
78 $e->getMessage()
79 ));
80 }
81 return;
82 }
83 }
84
85 public function finishEditing() : void
86 {
87 $this->ctrl->redirectByClass(ilObjContentPageGUI::class, 'view');
88 }
89
90 public function getAdditionalPageActions() : array
91 {
92 $this->ctrl->setParameterByClass(ilObjContentPageGUI::class, 'page_editor_style', '1');
93
94 $tabs = [
95 $this->ui->factory()->link()->standard(
96 $this->lng->txt('obj_sty'),
97 $this->ctrl->getLinkTargetByClass([
98 ilRepositoryGUI::class,
99 ilObjContentPageGUI::class
100 ], 'editStyleProperties')
101 )
102 ];
103
104 $this->ctrl->setParameterByClass(ilObjContentPageGUI::class, 'page_editor_style', null);
105
106 return $tabs;
107 }
108}
An exception for terminatinating execution or to throw for unit testing.
Class ilContentPagePageGUI @ilCtrl_Calls ilContentPagePageGUI: ilPageEditorGUI, ilEditClipboardGUI,...
__construct($a_id=0, $a_old_nr=0, $isEmbeddedMode=false, $language='')
ilContentPagePageGUI constructor.
getAdditionalPageActions()
Get additional page actions.
getProfileBackUrl()
Get profile back url.
Class ilPageObjectGUI.
setTemplateOutput($a_output=true)
setDefaultLinkXml()
Set standard link xml.
setTemplateTargetVar($a_variable)
Interface ilContentPageObjectConstants.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
ui()
Definition: ui.php:5