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

Public Member Functions

 __construct (protected GlobalHttpState $http, protected ilCtrlInterface $ctrl, protected ilTabsGUI $tabs, protected ilLanguage $lng, protected ilObjContentPage $parentObject, protected Translations $translation, protected ilObjUser $actor, protected Refinery $refinery, protected ObjectFacade $content_style_domain)
 
 setIsMediaRequest (bool $isMediaRequest)
 
 onPageUpdate (array $parameters)
 
 addPageTabs ()
 
 updateContentPageOnPageUpdate (array $parameters)
 
 addUpdateListener (callable $updateListener)
 
 setPresentationMode (string $presentationMode)
 
 forward (string $ctrlLink='')
 

Data Fields

final const string PRESENTATION_MODE_EDITING = 'PRESENTATION_MODE_EDITING'
 presentation mode for authoring More...
 
final const string PRESENTATION_MODE_PRESENTATION = 'PRESENTATION_MODE_PRESENTATION'
 presentation mode for requesting More...
 
final const string PRESENTATION_MODE_EMBEDDED_PRESENTATION = 'PRESENTATION_MODE_EMBEDDED_PRESENTATION'
 presentation mode for embedded presentation, e.g. More...
 
final const string PRESENTATION_MODE_PREVIEW = 'PRESENTATION_MODE_PREVIEW'
 
- Data Fields inherited from ilContentPageObjectConstants
const OBJ_TYPE = 'copa'
 
const HTTP_PARAM_PAGE_EDITOR_STYLE_CONTEXT = 'page_editor_style'
 
const UI_CMD_VIEW = 'view'
 
const UI_CMD_EDIT = 'edit'
 
const UI_CMD_UPDATE = 'update'
 
const UI_CMD_COPAGE_DOWNLOAD_FILE = 'downloadFile'
 
const UI_CMD_COPAGE_DISPLAY_FULLSCREEN = 'displayMediaFullscreen'
 
const UI_CMD_COPAGE_DISPLAY_MEDIA = 'displayMedia'
 
const UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH = 'download_paragraph'
 
const UI_CMD_COPAGE_EDIT = 'edit'
 
const UI_CMD_STYLES_EDIT = 'editStyleProperties'
 
const UI_TAB_ID_CONTENT = 'content'
 
const UI_TAB_ID_INFO = 'info_short'
 
const UI_TAB_ID_SETTINGS = 'settings'
 
const UI_TAB_ID_STYLE = 'style'
 
const UI_TAB_ID_I18N = 'i18n'
 
const UI_TAB_ID_LP = 'learning_progress'
 
const UI_TAB_ID_EXPORT = 'export'
 
const UI_TAB_ID_PERMISSIONS = 'perm_settings'
 
const UI_TAB_ID_MD = 'meta_data'
 

Protected Member Functions

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

Protected Attributes

string $presentationMode = self::PRESENTATION_MODE_EDITING
 
string $backUrl = ''
 
array $updateListeners = []
 
bool $isMediaRequest = false
 

Detailed Description

Definition at line 27 of file class.ilContentPagePageCommandForwarder.php.

Constructor & Destructor Documentation

◆ __construct()

ilContentPagePageCommandForwarder::__construct ( protected GlobalHttpState  $http,
protected ilCtrlInterface  $ctrl,
protected ilTabsGUI  $tabs,
protected ilLanguage  $lng,
protected ilObjContentPage  $parentObject,
protected Translations  $translation,
protected ilObjUser  $actor,
protected Refinery  $refinery,
protected ObjectFacade  $content_style_domain 
)

Definition at line 51 of file class.ilContentPagePageCommandForwarder.php.

61 {
62 $this->lng->loadLanguageModule('content');
63
64 $this->backUrl = '';
65 if ($this->http->wrapper()->query()->has('backurl')) {
66 $this->backUrl = $this->http->wrapper()->query()->retrieve(
67 'backurl',
68 $this->refinery->kindlyTo()->string()
69 );
70 }
71
72 if ($this->backUrl !== '') {
73 $this->ctrl->setParameterByClass(ilContentPagePageGUI::class, 'backurl', rawurlencode($this->backUrl));
74 }
75 }
static http()
Fetches the global http state from ILIAS.

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addPageTabs()

ilContentPagePageCommandForwarder::addPageTabs ( )

Definition at line 92 of file class.ilContentPagePageCommandForwarder.php.

92 : void
93 {
94 $this->ctrl->setParameterByClass(ilObjectContentStyleSettingsGUI::class, self::HTTP_PARAM_PAGE_EDITOR_STYLE_CONTEXT, '1');
95 $this->tabs->addTarget(
96 'obj_sty',
97 $this->ctrl->getLinkTargetByClass(ilObjectContentStyleSettingsGUI::class),
98 'editStyleProperties',
99 strtolower(ilObjectContentStyleSettingsGUI::class)
100 );
101 $this->ctrl->setParameterByClass(ilObjContentPageGUI::class, self::HTTP_PARAM_PAGE_EDITOR_STYLE_CONTEXT, null);
102 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ addUpdateListener()

ilContentPagePageCommandForwarder::addUpdateListener ( callable  $updateListener)

Definition at line 112 of file class.ilContentPagePageCommandForwarder.php.

112 : void
113 {
114 $this->updateListeners[] = $updateListener;
115 }

◆ buildEditingPageObjectGUI()

ilContentPagePageCommandForwarder::buildEditingPageObjectGUI ( string  $language)
protected

Definition at line 161 of file class.ilContentPagePageCommandForwarder.php.

162 {
163 $this->tabs->clearTargets();
164
165 $this->setBackLinkTab();
166
167 $this->ensurePageObjectExists($language);
168
169 $pageObjectGUI = $this->getPageObjectGUI($language);
170 $pageObjectGUI->setEnabledTabs(true);
171
172 $page = $pageObjectGUI->getPageObject();
173 $page->addUpdateListener($this, 'onPageUpdate', ['page' => $page]);
174
175 $pageObjectGUI->setTabHook($this, 'addPageTabs');
176
177 return $pageObjectGUI;
178 }
getPageObjectGUI(string $language, bool $isEmbedded=false)
@ilCtrl_Calls ilContentPagePageGUI: ilPageEditorGUI, ilEditClipboardGUI, ilMDEditorGUI @ilCtrl_Calls ...

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()

ilContentPagePageCommandForwarder::buildEmbeddedPresentationPageObjectGUI ( string  $language)
protected

Definition at line 209 of file class.ilContentPagePageCommandForwarder.php.

210 {
211 $this->ensurePageObjectExists($language);
212
213 $pageObjectGUI = $this->getPageObjectGUI($language, true);
214 $pageObjectGUI->setEnabledTabs(false);
215
216 $pageObjectGUI->setStyleId(
217 $this->content_style_domain->getEffectiveStyleId()
218 );
219
220 return $pageObjectGUI;
221 }

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

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

◆ buildPresentationPageObjectGUI()

ilContentPagePageCommandForwarder::buildPresentationPageObjectGUI ( string  $language)
protected

Definition at line 180 of file class.ilContentPagePageCommandForwarder.php.

181 {
182 $this->ensurePageObjectExists($language);
183
184 $pageObjectGUI = $this->getPageObjectGUI($language);
185 $pageObjectGUI->setEnabledTabs(false);
186
187 $pageObjectGUI->setStyleId(
188 $this->content_style_domain->getEffectiveStyleId()
189 );
190
191 return $pageObjectGUI;
192 }

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

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

◆ buildPreviewPageObjectGUI()

ilContentPagePageCommandForwarder::buildPreviewPageObjectGUI ( string  $language)
protected

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

195 {
196 $this->ensurePageObjectExists($language);
197
198 $pageObjectGUI = $this->getPageObjectGUI($language);
199
200 $pageObjectGUI->setStyleId(
201 $this->content_style_domain->getEffectiveStyleId()
202 );
203
204 $pageObjectGUI->setTabHook($this, 'addPageTabs');
205
206 return $pageObjectGUI;
207 }

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

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

◆ doesPageExistsForLanguage()

ilContentPagePageCommandForwarder::doesPageExistsForLanguage ( string  $language)
protected

Definition at line 129 of file class.ilContentPagePageCommandForwarder.php.

129 : bool
130 {
131 return ilContentPagePage::_exists($this->parentObject->getType(), $this->parentObject->getId(), $language);
132 }
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()

ilContentPagePageCommandForwarder::ensurePageObjectExists ( string  $language)
protected

Definition at line 134 of file class.ilContentPagePageCommandForwarder.php.

134 : void
135 {
136 if (!$this->doesPageExistsForLanguage($language)) {
137 $pageObject = new ilContentPagePage();
138 $pageObject->setParentId($this->parentObject->getId());
139 $pageObject->setId($this->parentObject->getId());
140 $pageObject->setLanguage($language);
141 $pageObject->createFromXML();
142 }
143 }

References doesPageExistsForLanguage().

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

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

◆ forward()

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

Definition at line 232 of file class.ilContentPagePageCommandForwarder.php.

232 : string
233 {
234 $language = $this->translation->getEffectiveCOPageLang($this->actor->getCurrentLanguage(), $this->parentObject->getType());
235
236 switch ($this->presentationMode) {
238
239 $pageObjectGui = $this->buildEditingPageObjectGUI($this->isMediaRequest ? $language : '');
240 return (string) $this->ctrl->forwardCommand($pageObjectGui);
241
243 $pageObjectGui = $this->buildPreviewPageObjectGUI($this->isMediaRequest ? $language : '');
244 return $this->ctrl->getHTML($pageObjectGui);
245
247 $pageObjectGUI = $this->buildPresentationPageObjectGUI($language);
248
249 if (is_string($ctrlLink) && $ctrlLink !== '') {
250 $pageObjectGUI->setFileDownloadLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_FILE);
251 $pageObjectGUI->setFullscreenLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN);
252 $pageObjectGUI->setSourcecodeDownloadScript($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH);
253 }
254
255 return $this->ctrl->getHTML($pageObjectGUI);
256
258 $pageObjectGUI = $this->buildEmbeddedPresentationPageObjectGUI($language);
259
260 if (is_string($ctrlLink) && $ctrlLink !== '') {
261 $pageObjectGUI->setFileDownloadLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_FILE);
262 $pageObjectGUI->setFullscreenLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN);
263 $pageObjectGUI->setSourcecodeDownloadScript($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH);
264 }
265
266 return $pageObjectGUI->getHTML();
267
268 default:
269 throw new ilException('Unknown presentation mode given');
270 }
271 }
final const string PRESENTATION_MODE_EDITING
presentation mode for authoring
final const string PRESENTATION_MODE_EMBEDDED_PRESENTATION
presentation mode for embedded presentation, e.g.
final const string PRESENTATION_MODE_PRESENTATION
presentation mode for requesting
Base class for ILIAS Exception handling.

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

+ Here is the call graph for this function:

◆ getPageObjectGUI()

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

Definition at line 117 of file class.ilContentPagePageCommandForwarder.php.

118 {
119 $pageObjectGUI = new ilContentPagePageGUI($this->parentObject->getId(), 0, $isEmbedded, $language);
120 $pageObjectGUI->setStyleId(
121 $this->content_style_domain->getEffectiveStyleId()
122 );
123
124 $pageObjectGUI->obj->addUpdateListener($this, 'updateContentPageOnPageUpdate', []);
125
126 return $pageObjectGUI;
127 }

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

+ Here is the caller graph for this function:

◆ onPageUpdate()

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

Definition at line 85 of file class.ilContentPagePageCommandForwarder.php.

85 : void
86 {
87 foreach ($this->updateListeners as $listener) {
88 $listener(new PageUpdatedEvent($parameters['page']));
89 }
90 }

◆ setBackLinkTab()

ilContentPagePageCommandForwarder::setBackLinkTab ( )
protected

Definition at line 145 of file class.ilContentPagePageCommandForwarder.php.

145 : void
146 {
147 $backUrl = $this->ctrl->getLinkTargetByClass(ilContentPagePageGUI::class, self::UI_CMD_COPAGE_EDIT);
148 if ($this->backUrl !== '') {
149 $backUrlParts = parse_url(ilUtil::stripSlashes($this->backUrl));
150
151 $script = basename($backUrlParts['path']);
152
153 $backUrl = './' . implode('?', [
154 $script, $backUrlParts['query']
155 ]);
156 }
157
158 $this->tabs->setBackTarget($this->lng->txt('back'), $backUrl);
159 }
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:

◆ setIsMediaRequest()

ilContentPagePageCommandForwarder::setIsMediaRequest ( bool  $isMediaRequest)

Definition at line 77 of file class.ilContentPagePageCommandForwarder.php.

77 : void
78 {
79 $this->isMediaRequest = $isMediaRequest;
80 }

References $isMediaRequest.

◆ setPresentationMode()

ilContentPagePageCommandForwarder::setPresentationMode ( string  $presentationMode)

Definition at line 223 of file class.ilContentPagePageCommandForwarder.php.

223 : void
224 {
225 $this->presentationMode = $presentationMode;
226 }

References $presentationMode.

◆ updateContentPageOnPageUpdate()

ilContentPagePageCommandForwarder::updateContentPageOnPageUpdate ( array  $parameters)
Parameters
array<string,mixed>$parameters

Definition at line 107 of file class.ilContentPagePageCommandForwarder.php.

107 : void
108 {
109 $this->parentObject->update();
110 }

Field Documentation

◆ $backUrl

string ilContentPagePageCommandForwarder::$backUrl = ''
protected

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

Referenced by setBackLinkTab().

◆ $isMediaRequest

bool ilContentPagePageCommandForwarder::$isMediaRequest = false
protected

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

Referenced by setIsMediaRequest().

◆ $presentationMode

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

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

Referenced by setPresentationMode().

◆ $updateListeners

array ilContentPagePageCommandForwarder::$updateListeners = []
protected

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

◆ PRESENTATION_MODE_EDITING

final const string ilContentPagePageCommandForwarder::PRESENTATION_MODE_EDITING = 'PRESENTATION_MODE_EDITING'

presentation mode for authoring

Definition at line 32 of file class.ilContentPagePageCommandForwarder.php.

Referenced by forward().

◆ PRESENTATION_MODE_EMBEDDED_PRESENTATION

final const string ilContentPagePageCommandForwarder::PRESENTATION_MODE_EMBEDDED_PRESENTATION = 'PRESENTATION_MODE_EMBEDDED_PRESENTATION'

presentation mode for embedded presentation, e.g.

in a kiosk mode

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

Referenced by forward().

◆ PRESENTATION_MODE_PRESENTATION

final const string ilContentPagePageCommandForwarder::PRESENTATION_MODE_PRESENTATION = 'PRESENTATION_MODE_PRESENTATION'

presentation mode for requesting

Definition at line 37 of file class.ilContentPagePageCommandForwarder.php.

Referenced by forward(), and ilObjContentPageGUI\getContent().

◆ PRESENTATION_MODE_PREVIEW

final const string ilContentPagePageCommandForwarder::PRESENTATION_MODE_PREVIEW = 'PRESENTATION_MODE_PREVIEW'

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

Referenced by forward().


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