ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 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 PRESENTATION_MODE_EDITING = 'PRESENTATION_MODE_EDITING'
 presentation mode for authoring More...
 
final const PRESENTATION_MODE_PRESENTATION = 'PRESENTATION_MODE_PRESENTATION'
 presentation mode for requesting More...
 
final const PRESENTATION_MODE_EMBEDDED_PRESENTATION = 'PRESENTATION_MODE_EMBEDDED_PRESENTATION'
 presentation mode for embedded presentation, e.g. More...
 
final 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'
 
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 26 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 ilObjUser  $actor,
protected Refinery  $refinery,
protected ObjectFacade  $content_style_domain 
)

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

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

59  {
60  $this->lng->loadLanguageModule('content');
61 
62  $this->backUrl = '';
63  if ($this->http->wrapper()->query()->has('backurl')) {
64  $this->backUrl = $this->http->wrapper()->query()->retrieve(
65  'backurl',
66  $this->refinery->kindlyTo()->string()
67  );
68  }
69 
70  if ($this->backUrl !== '') {
71  $this->ctrl->setParameterByClass(ilContentPagePageGUI::class, 'backurl', rawurlencode($this->backUrl));
72  }
73  }
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 90 of file class.ilContentPagePageCommandForwarder.php.

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

90  : void
91  {
92  $this->ctrl->setParameterByClass(ilObjectContentStyleSettingsGUI::class, self::HTTP_PARAM_PAGE_EDITOR_STYLE_CONTEXT, '1');
93  $this->tabs->addTarget(
94  'obj_sty',
95  $this->ctrl->getLinkTargetByClass(ilObjectContentStyleSettingsGUI::class),
96  'editStyleProperties',
97  strtolower(ilObjectContentStyleSettingsGUI::class)
98  );
99  $this->ctrl->setParameterByClass(ilObjContentPageGUI::class, self::HTTP_PARAM_PAGE_EDITOR_STYLE_CONTEXT, null);
100  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ addUpdateListener()

ilContentPagePageCommandForwarder::addUpdateListener ( callable  $updateListener)

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

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

◆ buildEditingPageObjectGUI()

ilContentPagePageCommandForwarder::buildEditingPageObjectGUI ( string  $language)
protected

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

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

Referenced by forward().

160  {
161  $this->tabs->clearTargets();
162 
163  $this->setBackLinkTab();
164 
165  $this->ensurePageObjectExists($language);
166 
167  $pageObjectGUI = $this->getPageObjectGUI($language);
168  $pageObjectGUI->setEnabledTabs(true);
169 
170  $page = $pageObjectGUI->getPageObject();
171  $page->addUpdateListener($this, 'onPageUpdate', ['page' => $page]);
172 
173  $pageObjectGUI->setTabHook($this, 'addPageTabs');
174 
175  return $pageObjectGUI;
176  }
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 207 of file class.ilContentPagePageCommandForwarder.php.

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

208  {
209  $this->ensurePageObjectExists($language);
210 
211  $pageObjectGUI = $this->getPageObjectGUI($language, true);
212  $pageObjectGUI->setEnabledTabs(false);
213 
214  $pageObjectGUI->setStyleId(
215  $this->content_style_domain->getEffectiveStyleId()
216  );
217 
218  return $pageObjectGUI;
219  }
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 178 of file class.ilContentPagePageCommandForwarder.php.

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

179  {
180  $this->ensurePageObjectExists($language);
181 
182  $pageObjectGUI = $this->getPageObjectGUI($language);
183  $pageObjectGUI->setEnabledTabs(false);
184 
185  $pageObjectGUI->setStyleId(
186  $this->content_style_domain->getEffectiveStyleId()
187  );
188 
189  return $pageObjectGUI;
190  }
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 192 of file class.ilContentPagePageCommandForwarder.php.

References ensurePageObjectExists(), and getPageObjectGUI().

Referenced by forward().

193  {
194  $this->ensurePageObjectExists($language);
195 
196  $pageObjectGUI = $this->getPageObjectGUI($language);
197 
198  $pageObjectGUI->setStyleId(
199  $this->content_style_domain->getEffectiveStyleId()
200  );
201 
202  $pageObjectGUI->setTabHook($this, 'addPageTabs');
203 
204  return $pageObjectGUI;
205  }
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 127 of file class.ilContentPagePageCommandForwarder.php.

References ilPageObject\_exists().

Referenced by ensurePageObjectExists().

127  : bool
128  {
129  return ilContentPagePage::_exists($this->parentObject->getType(), $this->parentObject->getId(), $language);
130  }
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 132 of file class.ilContentPagePageCommandForwarder.php.

References doesPageExistsForLanguage().

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

132  : void
133  {
134  if (!$this->doesPageExistsForLanguage($language)) {
135  $pageObject = new ilContentPagePage();
136  $pageObject->setParentId($this->parentObject->getId());
137  $pageObject->setId($this->parentObject->getId());
138  $pageObject->setLanguage($language);
139  $pageObject->createFromXML();
140  }
141  }
+ 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 230 of file class.ilContentPagePageCommandForwarder.php.

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

230  : string
231  {
232  $ot = ilObjectTranslation::getInstance($this->parentObject->getId());
233  $language = $ot->getEffectiveContentLang($this->actor->getCurrentLanguage(), $this->parentObject->getType());
234 
235  switch ($this->presentationMode) {
236  case self::PRESENTATION_MODE_EDITING:
237 
238  $pageObjectGui = $this->buildEditingPageObjectGUI($this->isMediaRequest ? $language : '');
239  return (string) $this->ctrl->forwardCommand($pageObjectGui);
240 
241  case self::PRESENTATION_MODE_PREVIEW:
242  $pageObjectGui = $this->buildPreviewPageObjectGUI($this->isMediaRequest ? $language : '');
243  return $this->ctrl->getHTML($pageObjectGui);
244 
245  case self::PRESENTATION_MODE_PRESENTATION:
246  $pageObjectGUI = $this->buildPresentationPageObjectGUI($language);
247 
248  if (is_string($ctrlLink) && $ctrlLink !== '') {
249  $pageObjectGUI->setFileDownloadLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_FILE);
250  $pageObjectGUI->setFullscreenLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN);
251  $pageObjectGUI->setSourcecodeDownloadScript($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH);
252  }
253 
254  return $this->ctrl->getHTML($pageObjectGUI);
255 
256  case self::PRESENTATION_MODE_EMBEDDED_PRESENTATION:
257  $pageObjectGUI = $this->buildEmbeddedPresentationPageObjectGUI($language);
258 
259  if (is_string($ctrlLink) && $ctrlLink !== '') {
260  $pageObjectGUI->setFileDownloadLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_FILE);
261  $pageObjectGUI->setFullscreenLink($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DISPLAY_FULLSCREEN);
262  $pageObjectGUI->setSourcecodeDownloadScript($ctrlLink . '&cmd=' . self::UI_CMD_COPAGE_DOWNLOAD_PARAGRAPH);
263  }
264 
265  return $pageObjectGUI->getHTML();
266 
267  default:
268  throw new ilException('Unknown presentation mode given');
269  }
270  }
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 115 of file class.ilContentPagePageCommandForwarder.php.

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

116  {
117  $pageObjectGUI = new ilContentPagePageGUI($this->parentObject->getId(), 0, $isEmbedded, $language);
118  $pageObjectGUI->setStyleId(
119  $this->content_style_domain->getEffectiveStyleId()
120  );
121 
122  $pageObjectGUI->obj->addUpdateListener($this, 'updateContentPageOnPageUpdate', []);
123 
124  return $pageObjectGUI;
125  }
+ Here is the caller graph for this function:

◆ onPageUpdate()

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

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

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

◆ setBackLinkTab()

ilContentPagePageCommandForwarder::setBackLinkTab ( )
protected

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

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

Referenced by buildEditingPageObjectGUI().

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

References $isMediaRequest.

75  : void
76  {
77  $this->isMediaRequest = $isMediaRequest;
78  }

◆ setPresentationMode()

ilContentPagePageCommandForwarder::setPresentationMode ( string  $presentationMode)

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

References $presentationMode.

221  : void
222  {
223  $this->presentationMode = $presentationMode;
224  }

◆ updateContentPageOnPageUpdate()

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

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

105  : void
106  {
107  $this->parentObject->update();
108  }

Field Documentation

◆ $backUrl

string ilContentPagePageCommandForwarder::$backUrl = ''
protected

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

Referenced by setBackLinkTab().

◆ $isMediaRequest

bool ilContentPagePageCommandForwarder::$isMediaRequest = false
protected

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

Referenced by setIsMediaRequest().

◆ $presentationMode

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

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

Referenced by setPresentationMode().

◆ $updateListeners

array ilContentPagePageCommandForwarder::$updateListeners = []
protected

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

◆ PRESENTATION_MODE_EDITING

final 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

final 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

final 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

final 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: