ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilForumPageCommandForwarder Class Reference
+ Inheritance diagram for ilForumPageCommandForwarder:
+ Collaboration diagram for ilForumPageCommandForwarder:

Public Member Functions

 __construct (GlobalHttpState $http, ilCtrlInterface $ctrl, ilTabsGUI $tabs, ilLanguage $lng, ilObjForum $parentObject, ilObjUser $actor, ObjectFacade $content_style_domain)
 
 onPageUpdate (array $parameters)
 
 updateForumOnPageUpdate (array $parameters)
 
 setPresentationMode (string $presentationMode)
 
 forward (string $ctrlLink='')
 

Data Fields

const PRESENTATION_MODE_EDITING = 'PRESENTATION_MODE_EDITING'
 presentation mode for authoring More...
 
const PRESENTATION_MODE_PRESENTATION = 'PRESENTATION_MODE_PRESENTATION'
 presentation mode for requesting More...
 
const PRESENTATION_MODE_EMBEDDED_PRESENTATION = 'PRESENTATION_MODE_EMBEDDED_PRESENTATION'
 presentation mode for embedded presentation, e.g. More...
 
const DEFAULT_LANGUAGE = '-'
 
- Data Fields inherited from ilForumObjectConstants
const OBJ_TYPE = 'frm'
 
const UI_TAB_ID_INFO = 'info_short'
 
const UI_TAB_ID_SETTINGS = 'settings'
 
const UI_TAB_ID_MODERATORS = 'frm_moderators'
 
const UI_TAB_ID_THREADS = 'forums_threads'
 
const UI_TAB_ID_STATS = 'frm_statistics'
 
const UI_TAB_ID_EXPORT = 'export'
 
const UI_TAB_ID_PERMISSIONS = 'perm_settings'
 
const UI_SUB_TAB_ID_BASIC_SETTINGS = 'basic_settings'
 
const UI_SUB_TAB_ID_NOTIFICATIONS = 'notifications'
 
const UI_SUB_TAB_ID_NEWS = 'cont_news_settings'
 
const UI_SUB_TAB_ID_STYLE = 'cont_style'
 
const UI_CMD_COPAGE_DOWNLOAD_FILE = 'downloadFile'
 
const UI_CMD_COPAGE_DISPLAY_FULLSCREEN = 'displayMediaFullscreen'
 
const UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH = 'download_paragraph'
 

Protected Member Functions

 getPageObjectGUI (string $language, bool $isEmbedded=false)
 
 doesPageExistsForLanguage (string $language)
 
 ensurePageObjectExists (string $language)
 
 setBackLinkTab ()
 
 buildEditingPageObjectGUI (string $language)
 
 buildPresentationPageObjectGUI (string $language)
 
 buildEmbeddedPresentationPageObjectGUI (string $language)
 

Protected Attributes

string $presentationMode = self::PRESENTATION_MODE_EDITING
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs
 
ilObjForum $parentObject
 
string $backUrl = ''
 
ilObjUser $actor
 
GlobalHttpState $http
 
ObjectFacade $content_style_domain
 

Detailed Description

Definition at line 24 of file class.ilForumPageCommandForwarder.php.

Constructor & Destructor Documentation

◆ __construct()

ilForumPageCommandForwarder::__construct ( GlobalHttpState  $http,
ilCtrlInterface  $ctrl,
ilTabsGUI  $tabs,
ilLanguage  $lng,
ilObjForum  $parentObject,
ilObjUser  $actor,
ObjectFacade  $content_style_domain 
)

Definition at line 52 of file class.ilForumPageCommandForwarder.php.

References $actor, $content_style_domain, $ctrl, $http, $lng, $parentObject, $tabs, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

60  {
61  $this->http = $http;
62  $this->ctrl = $ctrl;
63  $this->tabs = $tabs;
64  $this->lng = $lng;
65  $this->parentObject = $parentObject;
66  $this->actor = $actor;
67  $this->content_style_domain = $content_style_domain;
68 
69  $this->lng->loadLanguageModule('content');
70 
71  $this->backUrl = '';
72  if (isset($this->http->request()->getQueryParams()['backurl'])) {
73  $this->backUrl = $this->http->request()->getQueryParams()['backurl'];
74  }
75 
76  if ($this->backUrl !== '') {
77  $this->ctrl->setParameterByClass(ilForumPageGUI::class, 'backurl', rawurlencode($this->backUrl));
78  }
79  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

Member Function Documentation

◆ buildEditingPageObjectGUI()

ilForumPageCommandForwarder::buildEditingPageObjectGUI ( string  $language)
protected

Definition at line 140 of file class.ilForumPageCommandForwarder.php.

References ensurePageObjectExists(), getPageObjectGUI(), setBackLinkTab(), and ILIAS\Repository\tabs().

Referenced by forward().

141  {
142  $this->tabs->clearTargets();
143 
144  $this->setBackLinkTab();
145 
146  $this->ensurePageObjectExists($language);
147 
148  $pageObjectGUI = $this->getPageObjectGUI($language);
149  $pageObjectGUI->setEnabledTabs(true);
150 
151  $page = $pageObjectGUI->getPageObject();
152  $page->addUpdateListener($this, 'onPageUpdate', ['page' => $page]);
153 
154  return $pageObjectGUI;
155  }
getPageObjectGUI(string $language, bool $isEmbedded=false)
ilForumPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilForumPageGUI: ilPublicUserProfi...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildEmbeddedPresentationPageObjectGUI()

ilForumPageCommandForwarder::buildEmbeddedPresentationPageObjectGUI ( string  $language)
protected

Definition at line 170 of file class.ilForumPageCommandForwarder.php.

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

171  {
172  $this->ensurePageObjectExists($language);
173 
174  $pageObjectGUI = $this->getPageObjectGUI($language, true);
175  $pageObjectGUI->setEnabledTabs(false);
176  $pageObjectGUI->setStyleId(
177  $this->content_style_domain->getEffectiveStyleId()
178  );
179 
180  return $pageObjectGUI;
181  }
getPageObjectGUI(string $language, bool $isEmbedded=false)
ilForumPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilForumPageGUI: ilPublicUserProfi...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPresentationPageObjectGUI()

ilForumPageCommandForwarder::buildPresentationPageObjectGUI ( string  $language)
protected

Definition at line 157 of file class.ilForumPageCommandForwarder.php.

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

158  {
159  $this->ensurePageObjectExists($language);
160 
161  $pageObjectGUI = $this->getPageObjectGUI($language);
162  $pageObjectGUI->setEnabledTabs(false);
163  $pageObjectGUI->setStyleId(
164  $this->content_style_domain->getEffectiveStyleId()
165  );
166 
167  return $pageObjectGUI;
168  }
getPageObjectGUI(string $language, bool $isEmbedded=false)
ilForumPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilForumPageGUI: ilPublicUserProfi...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doesPageExistsForLanguage()

ilForumPageCommandForwarder::doesPageExistsForLanguage ( string  $language)
protected

Definition at line 108 of file class.ilForumPageCommandForwarder.php.

References ilPageObject\_exists().

Referenced by ensurePageObjectExists().

108  : bool
109  {
110  return ilForumPage::_exists($this->parentObject->getType(), $this->parentObject->getId(), $language);
111  }
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ensurePageObjectExists()

ilForumPageCommandForwarder::ensurePageObjectExists ( string  $language)
protected

Definition at line 113 of file class.ilForumPageCommandForwarder.php.

References doesPageExistsForLanguage().

Referenced by buildEditingPageObjectGUI(), buildEmbeddedPresentationPageObjectGUI(), and buildPresentationPageObjectGUI().

113  : void
114  {
115  if (!$this->doesPageExistsForLanguage($language)) {
116  $pageObject = new ilForumPage();
117  $pageObject->setParentId($this->parentObject->getId());
118  $pageObject->setId($this->parentObject->getId());
119  $pageObject->setLanguage($language);
120  $pageObject->createFromXML();
121  }
122  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forward()

ilForumPageCommandForwarder::forward ( string  $ctrlLink = '')
Parameters
string$ctrlLink
Returns
string
Exceptions
ilCtrlException
ilException

Definition at line 194 of file class.ilForumPageCommandForwarder.php.

References buildEditingPageObjectGUI(), buildEmbeddedPresentationPageObjectGUI(), buildPresentationPageObjectGUI(), and ILIAS\Repository\ctrl().

194  : string
195  {
196  switch ($this->presentationMode) {
197  case self::PRESENTATION_MODE_EDITING:
198 
199  $pageObjectGui = $this->buildEditingPageObjectGUI(self::DEFAULT_LANGUAGE);
200  return (string) $this->ctrl->forwardCommand($pageObjectGui);
201 
202  case self::PRESENTATION_MODE_PRESENTATION:
203  $pageObjectGUI = $this->buildPresentationPageObjectGUI(self::DEFAULT_LANGUAGE);
204 
205  if (is_string($ctrlLink) && $ctrlLink !== '') {
206  $pageObjectGUI->setFileDownloadLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_FILE);
207  $pageObjectGUI->setFullscreenLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN);
208  $pageObjectGUI->setSourcecodeDownloadScript($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH);
209  }
210 
211  return $this->ctrl->getHTML($pageObjectGUI);
212 
213  case self::PRESENTATION_MODE_EMBEDDED_PRESENTATION:
214  $pageObjectGUI = $this->buildEmbeddedPresentationPageObjectGUI(self::DEFAULT_LANGUAGE);
215 
216  if (is_string($ctrlLink) && $ctrlLink !== '') {
217  $pageObjectGUI->setFileDownloadLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_FILE);
218  $pageObjectGUI->setFullscreenLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN);
219  $pageObjectGUI->setSourcecodeDownloadScript($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH);
220  }
221 
222  return $pageObjectGUI->getHTML();
223 
224  default:
225  throw new ilException('Unknown presentation mode given');
226  }
227  }
+ Here is the call graph for this function:

◆ getPageObjectGUI()

ilForumPageCommandForwarder::getPageObjectGUI ( string  $language,
bool  $isEmbedded = false 
)
protected

Definition at line 96 of file class.ilForumPageCommandForwarder.php.

References ilPageObjectGUI\setStyleId().

Referenced by buildEditingPageObjectGUI(), buildEmbeddedPresentationPageObjectGUI(), and buildPresentationPageObjectGUI().

97  {
98  $pageObjectGUI = new ilForumPageGUI($this->parentObject->getId(), 0, $isEmbedded, $language);
99  $pageObjectGUI->setStyleId(
100  $this->content_style_domain->getEffectiveStyleId()
101  );
102 
103  $pageObjectGUI->obj->addUpdateListener($this, 'updateForumOnPageUpdate', []);
104 
105  return $pageObjectGUI;
106  }
setStyleId(int $a_styleid)
ilForumPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI ilForumPageGUI: ilPublicUserProfi...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onPageUpdate()

ilForumPageCommandForwarder::onPageUpdate ( array  $parameters)
Parameters
array<string,mixed>$parameters

Definition at line 84 of file class.ilForumPageCommandForwarder.php.

84  : void
85  {
86  }

◆ setBackLinkTab()

ilForumPageCommandForwarder::setBackLinkTab ( )
protected

Definition at line 124 of file class.ilForumPageCommandForwarder.php.

References $backUrl, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilUtil\stripSlashes(), and ILIAS\Repository\tabs().

Referenced by buildEditingPageObjectGUI().

124  : void
125  {
126  $backUrl = $this->ctrl->getLinkTargetByClass(ilObjForumGUI::class, 'showThreads');
127  if ($this->backUrl !== '') {
128  $backUrlParts = parse_url(ilUtil::stripSlashes($this->backUrl));
129 
130  $script = basename($backUrlParts['path']);
131 
132  $backUrl = './' . implode('?', [
133  $script, $backUrlParts['query']
134  ]);
135  }
136 
137  $this->tabs->setBackTarget($this->lng->txt('back'), $backUrl);
138  }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPresentationMode()

ilForumPageCommandForwarder::setPresentationMode ( string  $presentationMode)

Definition at line 183 of file class.ilForumPageCommandForwarder.php.

References $presentationMode.

183  : void
184  {
185  $this->presentationMode = $presentationMode;
186  }

◆ updateForumOnPageUpdate()

ilForumPageCommandForwarder::updateForumOnPageUpdate ( array  $parameters)
Parameters
array<string,mixed>$parameters

Definition at line 91 of file class.ilForumPageCommandForwarder.php.

91  : void
92  {
93  $this->parentObject->update();
94  }

Field Documentation

◆ $actor

ilObjUser ilForumPageCommandForwarder::$actor
protected

Definition at line 48 of file class.ilForumPageCommandForwarder.php.

Referenced by __construct().

◆ $backUrl

string ilForumPageCommandForwarder::$backUrl = ''
protected

Definition at line 47 of file class.ilForumPageCommandForwarder.php.

Referenced by setBackLinkTab().

◆ $content_style_domain

ObjectFacade ilForumPageCommandForwarder::$content_style_domain
protected

Definition at line 50 of file class.ilForumPageCommandForwarder.php.

Referenced by __construct().

◆ $ctrl

ilCtrlInterface ilForumPageCommandForwarder::$ctrl
protected

Definition at line 43 of file class.ilForumPageCommandForwarder.php.

Referenced by __construct().

◆ $http

GlobalHttpState ilForumPageCommandForwarder::$http
protected

Definition at line 49 of file class.ilForumPageCommandForwarder.php.

Referenced by __construct().

◆ $lng

ilLanguage ilForumPageCommandForwarder::$lng
protected

Definition at line 44 of file class.ilForumPageCommandForwarder.php.

Referenced by __construct().

◆ $parentObject

ilObjForum ilForumPageCommandForwarder::$parentObject
protected

Definition at line 46 of file class.ilForumPageCommandForwarder.php.

Referenced by __construct().

◆ $presentationMode

string ilForumPageCommandForwarder::$presentationMode = self::PRESENTATION_MODE_EDITING
protected

Definition at line 42 of file class.ilForumPageCommandForwarder.php.

Referenced by setPresentationMode().

◆ $tabs

ilTabsGUI ilForumPageCommandForwarder::$tabs
protected

Definition at line 45 of file class.ilForumPageCommandForwarder.php.

Referenced by __construct().

◆ DEFAULT_LANGUAGE

const ilForumPageCommandForwarder::DEFAULT_LANGUAGE = '-'

Definition at line 40 of file class.ilForumPageCommandForwarder.php.

◆ PRESENTATION_MODE_EDITING

const ilForumPageCommandForwarder::PRESENTATION_MODE_EDITING = 'PRESENTATION_MODE_EDITING'

presentation mode for authoring

Definition at line 29 of file class.ilForumPageCommandForwarder.php.

◆ PRESENTATION_MODE_EMBEDDED_PRESENTATION

const ilForumPageCommandForwarder::PRESENTATION_MODE_EMBEDDED_PRESENTATION = 'PRESENTATION_MODE_EMBEDDED_PRESENTATION'

presentation mode for embedded presentation, e.g.

in a kiosk mode

Definition at line 39 of file class.ilForumPageCommandForwarder.php.

◆ PRESENTATION_MODE_PRESENTATION

const ilForumPageCommandForwarder::PRESENTATION_MODE_PRESENTATION = 'PRESENTATION_MODE_PRESENTATION'

presentation mode for requesting

Definition at line 34 of file class.ilForumPageCommandForwarder.php.

Referenced by ilObjForumGUI\getContent().


The documentation for this class was generated from the following file: