ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilForumPageGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
27 {
28  protected bool $isEmbeddedMode = false;
29  protected string $language = '-';
30 
31  public function __construct(int $a_id = 0, int $a_old_nr = 0, bool $isEmbeddedMode = false, string $language = '')
32  {
33  parent::__construct(self::OBJ_TYPE, $a_id, $a_old_nr, false, $language);
34  $this->setTemplateTargetVar('ADM_CONTENT');
35  $this->setTemplateOutput(false);
36  $this->isEmbeddedMode = $isEmbeddedMode;
37  }
38 
39  public function getProfileBackUrl(): string
40  {
41  if ($this->isEmbeddedMode) {
42  return '';
43  }
44 
45  return parent::getProfileBackUrl();
46  }
47 
48  public function finishEditing(): void
49  {
50  $this->ctrl->redirectByClass(ilObjForumGUI::class, 'showThreads');
51  }
52 
53  public function setDefaultLinkXml(): void
54  {
55  parent::setDefaultLinkXml();
56 
57  if ($this->isEmbeddedMode) {
58  $linkXml = $this->getLinkXML();
59 
60  try {
61  $linkXml = str_replace('<LinkTargets></LinkTargets>', '', $linkXml);
62 
63  $domDoc = new DOMDocument();
64  $domDoc->loadXML('<?xml version="1.0" encoding="UTF-8"?>' . $linkXml);
65 
66  $xpath = new DOMXPath($domDoc);
67  $links = $xpath->query('//IntLinkInfos/IntLinkInfo');
68 
69  if ($links->length > 0) {
70  foreach ($links as $link) {
72  $link->attributes->getNamedItem('LinkTarget')->nodeValue = '_blank';
73  }
74  }
75 
76  $linkXmlWithBlankTargets = $domDoc->saveXML();
77 
78  $this->setLinkXml(str_replace('<?xml version="1.0" encoding="UTF-8"?>', '', $linkXmlWithBlankTargets));
79  } catch (Throwable $e) {
80  $this->log->error(sprintf(
81  'Could not manipulate page editor link XML: %s / Error Message: %s',
82  $linkXml,
83  $e->getMessage()
84  ));
85  }
86  }
87  }
88 }
Class ilPageObjectGUI.
setTemplateTargetVar(string $a_variable)
setTemplateOutput(bool $a_output=true)
__construct(Container $dic, ilPlugin $plugin)
__construct(int $a_id=0, int $a_old_nr=0, bool $isEmbeddedMode=false, string $language='')
ilForumPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilForumPageGUI: ilPublicUserProfi...