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

Public Member Functions

 __construct (GlobalHttpState $http, ilCtrlInterface $ctrl, ilTabsGUI $tabs, ilLanguage $lng, ilObjContentPage $parentObject, ilObjUser $actor, Refinery $refinery, 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

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 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'
 

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
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilTabsGUI $tabs
 
ilObjContentPage $parentObject
 
string $backUrl = ''
 
ilObjUser $actor
 
array $updateListeners = []
 
GlobalHttpState $http
 
Refinery $refinery
 
ObjectFacade $content_style_domain
 
bool $isMediaRequest = false
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

67  {
68  $this->http = $http;
69  $this->ctrl = $ctrl;
70  $this->tabs = $tabs;
71  $this->lng = $lng;
72  $this->parentObject = $parentObject;
73  $this->actor = $actor;
74  $this->refinery = $refinery;
75  $this->content_style_domain = $content_style_domain;
76 
77  $this->lng->loadLanguageModule('content');
78 
79  $this->backUrl = '';
80  if ($this->http->wrapper()->query()->has('backurl')) {
81  $this->backUrl = $this->http->wrapper()->query()->retrieve(
82  'backurl',
83  $this->refinery->kindlyTo()->string()
84  );
85  }
86 
87  if ($this->backUrl !== '') {
88  $this->ctrl->setParameterByClass(ilContentPagePageGUI::class, 'backurl', rawurlencode($this->backUrl));
89  }
90  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

Member Function Documentation

◆ addPageTabs()

ilContentPagePageCommandForwarder::addPageTabs ( )

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

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

107  : void
108  {
109  $this->ctrl->setParameterByClass(ilObjectContentStyleSettingsGUI::class, self::HTTP_PARAM_PAGE_EDITOR_STYLE_CONTEXT, '1');
110  $this->tabs->addTarget(
111  'obj_sty',
112  $this->ctrl->getLinkTargetByClass(ilObjectContentStyleSettingsGUI::class),
113  'editStyleProperties',
114  strtolower(ilObjectContentStyleSettingsGUI::class)
115  );
116  $this->ctrl->setParameterByClass(ilObjContentPageGUI::class, self::HTTP_PARAM_PAGE_EDITOR_STYLE_CONTEXT, null);
117  }
+ Here is the call graph for this function:

◆ addUpdateListener()

ilContentPagePageCommandForwarder::addUpdateListener ( callable  $updateListener)

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

127  : void
128  {
129  $this->updateListeners[] = $updateListener;
130  }

◆ buildEditingPageObjectGUI()

ilContentPagePageCommandForwarder::buildEditingPageObjectGUI ( string  $language)
protected

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

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

Referenced by forward().

177  {
178  $this->tabs->clearTargets();
179 
180  $this->setBackLinkTab();
181 
182  $this->ensurePageObjectExists($language);
183 
184  $pageObjectGUI = $this->getPageObjectGUI($language);
185  $pageObjectGUI->setEnabledTabs(true);
186 
187  $page = $pageObjectGUI->getPageObject();
188  $page->addUpdateListener($this, 'onPageUpdate', ['page' => $page]);
189 
190  $pageObjectGUI->setTabHook($this, 'addPageTabs');
191 
192  return $pageObjectGUI;
193  }
getPageObjectGUI(string $language, bool $isEmbedded=false)
+ 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 224 of file class.ilContentPagePageCommandForwarder.php.

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

225  {
226  $this->ensurePageObjectExists($language);
227 
228  $pageObjectGUI = $this->getPageObjectGUI($language, true);
229  $pageObjectGUI->setEnabledTabs(false);
230 
231  $pageObjectGUI->setStyleId(
232  $this->content_style_domain->getEffectiveStyleId()
233  );
234 
235  return $pageObjectGUI;
236  }
getPageObjectGUI(string $language, bool $isEmbedded=false)
+ 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 195 of file class.ilContentPagePageCommandForwarder.php.

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

196  {
197  $this->ensurePageObjectExists($language);
198 
199  $pageObjectGUI = $this->getPageObjectGUI($language);
200  $pageObjectGUI->setEnabledTabs(false);
201 
202  $pageObjectGUI->setStyleId(
203  $this->content_style_domain->getEffectiveStyleId()
204  );
205 
206  return $pageObjectGUI;
207  }
getPageObjectGUI(string $language, bool $isEmbedded=false)
+ 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 209 of file class.ilContentPagePageCommandForwarder.php.

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

210  {
211  $this->ensurePageObjectExists($language);
212 
213  $pageObjectGUI = $this->getPageObjectGUI($language);
214 
215  $pageObjectGUI->setStyleId(
216  $this->content_style_domain->getEffectiveStyleId()
217  );
218 
219  $pageObjectGUI->setTabHook($this, 'addPageTabs');
220 
221  return $pageObjectGUI;
222  }
getPageObjectGUI(string $language, bool $isEmbedded=false)
+ 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 144 of file class.ilContentPagePageCommandForwarder.php.

References ilPageObject\_exists().

Referenced by ensurePageObjectExists().

144  : bool
145  {
146  return ilContentPagePage::_exists($this->parentObject->getType(), $this->parentObject->getId(), $language);
147  }
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()

ilContentPagePageCommandForwarder::ensurePageObjectExists ( string  $language)
protected

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

References doesPageExistsForLanguage().

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

149  : void
150  {
151  if (!$this->doesPageExistsForLanguage($language)) {
152  $pageObject = new ilContentPagePage();
153  $pageObject->setParentId($this->parentObject->getId());
154  $pageObject->setId($this->parentObject->getId());
155  $pageObject->setLanguage($language);
156  $pageObject->createFromXML();
157  }
158  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ forward()

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

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

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

249  : string
250  {
251  $ot = ilObjectTranslation::getInstance($this->parentObject->getId());
252  $language = $ot->getEffectiveContentLang($this->actor->getCurrentLanguage(), $this->parentObject->getType());
253 
254  switch ($this->presentationMode) {
255  case self::PRESENTATION_MODE_EDITING:
256 
257  $pageObjectGui = $this->buildEditingPageObjectGUI($this->isMediaRequest ? $language : '');
258  return (string) $this->ctrl->forwardCommand($pageObjectGui);
259 
260  case self::PRESENTATION_MODE_PREVIEW:
261  $pageObjectGui = $this->buildPreviewPageObjectGUI($this->isMediaRequest ? $language : '');
262  return $this->ctrl->getHTML($pageObjectGui);
263 
264  case self::PRESENTATION_MODE_PRESENTATION:
265  $pageObjectGUI = $this->buildPresentationPageObjectGUI($language);
266 
267  if (is_string($ctrlLink) && $ctrlLink !== '') {
268  $pageObjectGUI->setFileDownloadLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_FILE);
269  $pageObjectGUI->setFullscreenLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN);
270  $pageObjectGUI->setSourcecodeDownloadScript($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH);
271  }
272 
273  return $this->ctrl->getHTML($pageObjectGUI);
274 
275  case self::PRESENTATION_MODE_EMBEDDED_PRESENTATION:
276  $pageObjectGUI = $this->buildEmbeddedPresentationPageObjectGUI($language);
277 
278  if (is_string($ctrlLink) && $ctrlLink !== '') {
279  $pageObjectGUI->setFileDownloadLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_FILE);
280  $pageObjectGUI->setFullscreenLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN);
281  $pageObjectGUI->setSourcecodeDownloadScript($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH);
282  }
283 
284  return $pageObjectGUI->getHTML();
285 
286  default:
287  throw new ilException('Unknown presentation mode given');
288  }
289  }
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ getPageObjectGUI()

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

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

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

133  {
134  $pageObjectGUI = new ilContentPagePageGUI($this->parentObject->getId(), 0, $isEmbedded, $language);
135  $pageObjectGUI->setStyleId(
136  $this->content_style_domain->getEffectiveStyleId()
137  );
138 
139  $pageObjectGUI->obj->addUpdateListener($this, 'updateContentPageOnPageUpdate', []);
140 
141  return $pageObjectGUI;
142  }
+ Here is the caller graph for this function:

◆ onPageUpdate()

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

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

100  : void
101  {
102  foreach ($this->updateListeners as $listener) {
103  $listener(new PageUpdatedEvent($parameters['page']));
104  }
105  }

◆ setBackLinkTab()

ilContentPagePageCommandForwarder::setBackLinkTab ( )
protected

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

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

Referenced by buildEditingPageObjectGUI().

160  : void
161  {
162  $backUrl = $this->ctrl->getLinkTargetByClass(ilContentPagePageGUI::class, self::UI_CMD_COPAGE_EDIT);
163  if ($this->backUrl !== '') {
164  $backUrlParts = parse_url(ilUtil::stripSlashes($this->backUrl));
165 
166  $script = basename($backUrlParts['path']);
167 
168  $backUrl = './' . implode('?', [
169  $script, $backUrlParts['query']
170  ]);
171  }
172 
173  $this->tabs->setBackTarget($this->lng->txt('back'), $backUrl);
174  }
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:

◆ setIsMediaRequest()

ilContentPagePageCommandForwarder::setIsMediaRequest ( bool  $isMediaRequest)

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

References $isMediaRequest.

92  : void
93  {
94  $this->isMediaRequest = $isMediaRequest;
95  }

◆ setPresentationMode()

ilContentPagePageCommandForwarder::setPresentationMode ( string  $presentationMode)

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

References $presentationMode.

238  : void
239  {
240  $this->presentationMode = $presentationMode;
241  }

◆ updateContentPageOnPageUpdate()

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

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

122  : void
123  {
124  $this->parentObject->update();
125  }

Field Documentation

◆ $actor

ilObjUser ilContentPagePageCommandForwarder::$actor
protected

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

Referenced by __construct().

◆ $backUrl

string ilContentPagePageCommandForwarder::$backUrl = ''
protected

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

Referenced by setBackLinkTab().

◆ $content_style_domain

ObjectFacade ilContentPagePageCommandForwarder::$content_style_domain
protected

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

Referenced by __construct().

◆ $ctrl

ilCtrlInterface ilContentPagePageCommandForwarder::$ctrl
protected

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

Referenced by __construct().

◆ $http

GlobalHttpState ilContentPagePageCommandForwarder::$http
protected

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

Referenced by __construct().

◆ $isMediaRequest

bool ilContentPagePageCommandForwarder::$isMediaRequest = false
protected

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

Referenced by setIsMediaRequest().

◆ $lng

ilLanguage ilContentPagePageCommandForwarder::$lng
protected

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

Referenced by __construct().

◆ $parentObject

ilObjContentPage ilContentPagePageCommandForwarder::$parentObject
protected

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

Referenced by __construct().

◆ $presentationMode

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

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

Referenced by setPresentationMode().

◆ $refinery

Refinery ilContentPagePageCommandForwarder::$refinery
protected

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

Referenced by __construct().

◆ $tabs

ilTabsGUI ilContentPagePageCommandForwarder::$tabs
protected

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

Referenced by __construct().

◆ $updateListeners

array ilContentPagePageCommandForwarder::$updateListeners = []
protected

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

◆ PRESENTATION_MODE_EDITING

const ilContentPagePageCommandForwarder::PRESENTATION_MODE_EDITING = 'PRESENTATION_MODE_EDITING'

presentation mode for authoring

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

◆ PRESENTATION_MODE_EMBEDDED_PRESENTATION

const ilContentPagePageCommandForwarder::PRESENTATION_MODE_EMBEDDED_PRESENTATION = 'PRESENTATION_MODE_EMBEDDED_PRESENTATION'

presentation mode for embedded presentation, e.g.

in a kiosk mode

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

Referenced by ilContentPageKioskModeView\render().

◆ PRESENTATION_MODE_PRESENTATION

const ilContentPagePageCommandForwarder::PRESENTATION_MODE_PRESENTATION = 'PRESENTATION_MODE_PRESENTATION'

presentation mode for requesting

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

Referenced by ilObjContentPageGUI\getContent().

◆ PRESENTATION_MODE_PREVIEW

const ilContentPagePageCommandForwarder::PRESENTATION_MODE_PREVIEW = 'PRESENTATION_MODE_PREVIEW'

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


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