ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilForumPageCommandForwarder Class Reference
+ Inheritance diagram for ilForumPageCommandForwarder:
+ Collaboration diagram for ilForumPageCommandForwarder:

Public Member Functions

 __construct (protected GlobalHttpState $http, protected ilCtrlInterface $ctrl, protected ilTabsGUI $tabs, protected ilLanguage $lng, protected ilObjForum $parentObject, protected ilObjUser $actor, protected 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 = 'general'
 
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
 
string $backUrl = ''
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

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

53 {
54 $this->lng->loadLanguageModule('content');
55
56 $this->backUrl = '';
57 if (isset($this->http->request()->getQueryParams()['backurl'])) {
58 $this->backUrl = $this->http->request()->getQueryParams()['backurl'];
59 }
60
61 if ($this->backUrl !== '') {
62 $this->ctrl->setParameterByClass(ilForumPageGUI::class, 'backurl', rawurlencode($this->backUrl));
63 }
64 }
static http()
Fetches the global http state from ILIAS.

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildEditingPageObjectGUI()

ilForumPageCommandForwarder::buildEditingPageObjectGUI ( string  $language)
protected

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

126 {
127 $this->tabs->clearTargets();
128
129 $this->setBackLinkTab();
130
131 $this->ensurePageObjectExists($language);
132
133 $pageObjectGUI = $this->getPageObjectGUI($language);
134 $pageObjectGUI->setEnabledTabs(true);
135
136 $page = $pageObjectGUI->getPageObject();
137 $page->addUpdateListener($this, 'onPageUpdate', ['page' => $page]);
138
139 return $pageObjectGUI;
140 }
getPageObjectGUI(string $language, bool $isEmbedded=false)
@ilCtrl_Calls ilForumPageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI @ilCtrl_Calls ilForu...

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

Referenced by forward().

+ 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 155 of file class.ilForumPageCommandForwarder.php.

156 {
157 $this->ensurePageObjectExists($language);
158
159 $pageObjectGUI = $this->getPageObjectGUI($language, true);
160 $pageObjectGUI->setEnabledTabs(false);
161 $pageObjectGUI->setStyleId(
162 $this->content_style_domain->getEffectiveStyleId()
163 );
164
165 return $pageObjectGUI;
166 }

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

+ 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 142 of file class.ilForumPageCommandForwarder.php.

143 {
144 $this->ensurePageObjectExists($language);
145
146 $pageObjectGUI = $this->getPageObjectGUI($language);
147 $pageObjectGUI->setEnabledTabs(false);
148 $pageObjectGUI->setStyleId(
149 $this->content_style_domain->getEffectiveStyleId()
150 );
151
152 return $pageObjectGUI;
153 }

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

+ 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 93 of file class.ilForumPageCommandForwarder.php.

93 : bool
94 {
95 return ilForumPage::_exists($this->parentObject->getType(), $this->parentObject->getId(), $language);
96 }
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.

References ilPageObject\_exists().

Referenced by ensurePageObjectExists().

+ 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 98 of file class.ilForumPageCommandForwarder.php.

98 : void
99 {
100 if (!$this->doesPageExistsForLanguage($language)) {
101 $pageObject = new ilForumPage();
102 $pageObject->setParentId($this->parentObject->getId());
103 $pageObject->setId($this->parentObject->getId());
104 $pageObject->setLanguage($language);
105 $pageObject->createFromXML();
106 }
107 }

References doesPageExistsForLanguage().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forward()

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

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

177 : string
178 {
179 switch ($this->presentationMode) {
181
182 $pageObjectGui = $this->buildEditingPageObjectGUI(self::DEFAULT_LANGUAGE);
183 return (string) $this->ctrl->forwardCommand($pageObjectGui);
184
186 $pageObjectGUI = $this->buildPresentationPageObjectGUI(self::DEFAULT_LANGUAGE);
187
188 if (is_string($ctrlLink) && $ctrlLink !== '') {
189 $pageObjectGUI->setFileDownloadLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_FILE);
190 $pageObjectGUI->setFullscreenLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN);
191 $pageObjectGUI->setSourcecodeDownloadScript($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH);
192 }
193
194 return $this->ctrl->getHTML($pageObjectGUI);
195
197 $pageObjectGUI = $this->buildEmbeddedPresentationPageObjectGUI(self::DEFAULT_LANGUAGE);
198
199 if (is_string($ctrlLink) && $ctrlLink !== '') {
200 $pageObjectGUI->setFileDownloadLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_FILE);
201 $pageObjectGUI->setFullscreenLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN);
202 $pageObjectGUI->setSourcecodeDownloadScript($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH);
203 }
204
205 return $pageObjectGUI->getHTML();
206
207 default:
208 throw new ilException('Unknown presentation mode given');
209 }
210 }
Base class for ILIAS Exception handling.
const PRESENTATION_MODE_PRESENTATION
presentation mode for requesting
const PRESENTATION_MODE_EDITING
presentation mode for authoring
const PRESENTATION_MODE_EMBEDDED_PRESENTATION
presentation mode for embedded presentation, e.g.

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

+ Here is the call graph for this function:

◆ getPageObjectGUI()

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

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

82 {
83 $pageObjectGUI = new ilForumPageGUI($this->parentObject->getId(), 0, $isEmbedded, $language);
84 $pageObjectGUI->setStyleId(
85 $this->content_style_domain->getEffectiveStyleId()
86 );
87
88 $pageObjectGUI->obj->addUpdateListener($this, 'updateForumOnPageUpdate', []);
89
90 return $pageObjectGUI;
91 }

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

+ Here is the caller graph for this function:

◆ onPageUpdate()

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

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

69 : void
70 {
71 }

◆ setBackLinkTab()

ilForumPageCommandForwarder::setBackLinkTab ( )
protected

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

109 : void
110 {
111 $backUrl = $this->ctrl->getLinkTargetByClass(ilObjForumGUI::class, 'showThreads');
112 if ($this->backUrl !== '') {
113 $backUrlParts = parse_url(ilUtil::stripSlashes($this->backUrl));
114
115 $script = basename($backUrlParts['path']);
116
117 $backUrl = './' . implode('?', [
118 $script, $backUrlParts['query']
119 ]);
120 }
121
122 $this->tabs->setBackTarget($this->lng->txt('back'), $backUrl);
123 }
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")

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

Referenced by buildEditingPageObjectGUI().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setPresentationMode()

ilForumPageCommandForwarder::setPresentationMode ( string  $presentationMode)

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

168 : void
169 {
170 $this->presentationMode = $presentationMode;
171 }

References $presentationMode.

◆ updateForumOnPageUpdate()

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

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

76 : void
77 {
78 $this->parentObject->update();
79 }

Field Documentation

◆ $backUrl

string ilForumPageCommandForwarder::$backUrl = ''
protected

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

Referenced by setBackLinkTab().

◆ $presentationMode

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

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

Referenced by setPresentationMode().

◆ 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.

Referenced by forward().

◆ 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.

Referenced by forward().

◆ 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 forward(), and ilObjForumGUI\renderThreadOverview().


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