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

Public Member Functions

 buildInitialState (State $empty_state)
 Build an initial state based on the Provided empty state. More...
 
 buildControls (State $state, ControlBuilder $builder)
 Construct the controls for the view based on the current state. More...
 
 updateGet (State $state, string $command, int $parameter=null)
 Update the state based on the provided command. More...
 
 updatePost (State $state, string $command, array $post)
 Update the state and the object based on the provided command and post-data. More...
 
 render (State $state, Factory $factory, URLBuilder $url_builder, array $post=null)
 
- Public Member Functions inherited from ilKioskModeView
 __construct (ilObject $object, ilCtrl $ctrl, ilLanguage $lng, ilAccessHandler $access)
 
- Public Member Functions inherited from ILIAS\KioskMode\View
 render (State $state, UI\Factory $factory, URLBuilder $url_builder, array $post=null)
 Render a state using the ui-factory and URLs from the builder. More...
 

Protected Member Functions

 getObjectClass ()
 
 setObject (ilObject $object)
 
 hasPermissionToAccessKioskMode ()
 
 buildLearningProgressToggleControl (ControlBuilder $builder)
 
 toggleLearningProgress (string $command)
 
 renderContentStyle ()
 Renders the content style of a ContentPage object into main template. More...
 
- Protected Member Functions inherited from ilKioskModeView
 getObjectClass ()
 Get the class of objects this view displays. More...
 
 setObject (ilObject $object)
 Set the object for this view. More...
 
 hasPermissionToAccessKioskMode ()
 Check if the global user has permission to access the kiosk mode of the supplied object. More...
 

Protected Attributes

ilObjContentPage $contentPageObject
 
ilObjUser $user
 
Factory $uiFactory
 
Renderer $uiRenderer
 
ilGlobalTemplateInterface $mainTemplate
 
GlobalHttpState $http
 
Refinery $refinery
 
ilTabsGUI $tabs
 
array $messages = []
 
ILIAS Style Content Object ObjectFacade $content_style_domain
 
ILIAS Style Content GUIService $content_style_gui
 
- Protected Attributes inherited from ilKioskModeView
ilCtrl $ctrl
 
ilLanguage $lng
 
ilAccessHandler $access
 

Private Attributes

const CMD_LP_TO_COMPLETED = 'lp_completed'
 
const CMD_LP_TO_INCOMPLETE = 'lp_incomplete'
 

Detailed Description

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

Member Function Documentation

◆ buildControls()

ilContentPageKioskModeView::buildControls ( State  $state,
ControlBuilder  $builder 
)

Construct the controls for the view based on the current state.

The interaction with the controls build via the ControlBuilder will always be delegated to updateGet.

Implements ILIAS\KioskMode\View.

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

References buildLearningProgressToggleControl().

83  : void
84  {
85  $this->buildLearningProgressToggleControl($builder);
86  }
buildLearningProgressToggleControl(ControlBuilder $builder)
+ Here is the call graph for this function:

◆ buildInitialState()

ilContentPageKioskModeView::buildInitialState ( State  $empty_state)

Build an initial state based on the Provided empty state.

Implements ILIAS\KioskMode\View.

Definition at line 78 of file class.ilContentPageKioskModeView.php.

78  : State
79  {
80  return $empty_state;
81  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:12

◆ buildLearningProgressToggleControl()

ilContentPageKioskModeView::buildLearningProgressToggleControl ( ControlBuilder  $builder)
protected

Definition at line 88 of file class.ilContentPageKioskModeView.php.

References ilLPMarks\_hasCompleted(), ILIAS\KioskMode\ControlBuilder\generic(), ilObjectLP\getInstance(), ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_MANUAL, and ILIAS\Repository\user().

Referenced by buildControls().

88  : void
89  {
90  $learningProgress = ilObjectLP::getInstance($this->contentPageObject->getId());
91  if ($learningProgress->getCurrentMode() === ilLPObjSettings::LP_MODE_MANUAL) {
92  $isCompleted = ilLPMarks::_hasCompleted($this->user->getId(), $this->contentPageObject->getId());
93 
94  $this->lng->loadLanguageModule('copa');
95  $learningProgressToggleCtrlLabel = $this->lng->txt('copa_btn_lp_toggle_state_completed');
96  $cmd = self::CMD_LP_TO_INCOMPLETE;
97  if (!$isCompleted) {
98  $learningProgressToggleCtrlLabel = $this->lng->txt('copa_btn_lp_toggle_state_not_completed');
99  $cmd = self::CMD_LP_TO_COMPLETED;
100  }
101 
102  $builder->generic(
103  $learningProgressToggleCtrlLabel,
104  $cmd,
105  1
106  );
107  }
108  }
static _hasCompleted(int $a_usr_id, int $a_obj_id)
static getInstance(int $obj_id)
generic(string $label, string $command, int $parameter=null)
A generic control needs to have a label that tells what it does.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectClass()

ilContentPageKioskModeView::getObjectClass ( )
protected

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

49  : string
50  {
51  return ilObjContentPage::class;
52  }

◆ hasPermissionToAccessKioskMode()

ilContentPageKioskModeView::hasPermissionToAccessKioskMode ( )
protected

Definition at line 73 of file class.ilContentPageKioskModeView.php.

References ILIAS\Repository\access().

73  : bool
74  {
75  return $this->access->checkAccess('read', '', $this->contentPageObject->getRefId());
76  }
+ Here is the call graph for this function:

◆ render()

ilContentPageKioskModeView::render ( State  $state,
Factory  $factory,
URLBuilder  $url_builder,
array  $post = null 
)

Definition at line 148 of file class.ilContentPageKioskModeView.php.

References ilLearningProgress\_tracProgress(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\UI\Factory\legacy(), ILIAS\Repository\lng(), ilContentPagePageCommandForwarder\PRESENTATION_MODE_EMBEDDED_PRESENTATION, ILIAS\Repository\refinery(), renderContentStyle(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

153  : Component {
155  $this->user->getId(),
156  $this->contentPageObject->getId(),
157  $this->contentPageObject->getRefId(),
158  $this->contentPageObject->getType()
159  );
160 
161  $this->renderContentStyle();
162 
163  $forwarder = new ilContentPagePageCommandForwarder(
164  $this->http,
165  $this->ctrl,
166  $this->tabs,
167  $this->lng,
168  $this->contentPageObject,
169  $this->user,
170  $this->refinery,
171  $this->content_style_domain
172  );
174 
175  $this->ctrl->setParameterByClass(ilContentPagePageGUI::class, 'ref_id', $this->contentPageObject->getRefId());
176 
177  return $factory->legacy(implode('', [
178  $this->uiRenderer->render($this->messages),
179  $forwarder->forward($this->ctrl->getLinkTargetByClass([
180  ilRepositoryGUI::class, ilObjContentPageGUI::class, ilContentPagePageGUI::class
181  ]))
182  ]));
183  }
renderContentStyle()
Renders the content style of a ContentPage object into main template.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const PRESENTATION_MODE_EMBEDDED_PRESENTATION
presentation mode for embedded presentation, e.g.
legacy(string $content)
description: purpose: > This component is used to wrap an existing ILIAS UI element into a UI compon...
static _tracProgress(int $a_user_id, int $a_obj_id, int $a_ref_id, string $a_obj_type='')
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ renderContentStyle()

ilContentPageKioskModeView::renderContentStyle ( )
protected

Renders the content style of a ContentPage object into main template.

Definition at line 188 of file class.ilContentPageKioskModeView.php.

References ilObjStyleSheet\getSyntaxStylePath(), and ILIAS\Repository\mainTemplate().

Referenced by render().

188  : void
189  {
191  $this->content_style_gui->addCss(
192  $this->mainTemplate,
193  $this->contentPageObject->getRefId()
194  );
195  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setObject()

ilContentPageKioskModeView::setObject ( ilObject  $object)
protected

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

References $DIC, ILIAS\Repository\ctrl(), ilObject\getRefId(), ILIAS\FileDelivery\http(), ILIAS\Repository\mainTemplate(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

54  : void
55  {
56  global $DIC;
57 
58  $this->contentPageObject = $object;
59 
60  $this->ctrl = $DIC->ctrl();
61  $this->mainTemplate = $DIC->ui()->mainTemplate();
62  $this->uiFactory = $DIC->ui()->factory();
63  $this->uiRenderer = $DIC->ui()->renderer();
64  $this->http = $DIC->http();
65  $this->refinery = $DIC->refinery();
66  $this->tabs = $DIC->tabs();
67  $this->user = $DIC->user();
68  $cs = $DIC->contentStyle();
69  $this->content_style_gui = $cs->gui();
70  $this->content_style_domain = $cs->domain()->styleForRefId($object->getRefId());
71  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:

◆ toggleLearningProgress()

ilContentPageKioskModeView::toggleLearningProgress ( string  $command)
protected

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

References ilLPStatusWrapper\_updateStatus(), ilLPMarks\getCompleted(), ilObjectLP\getInstance(), ILIAS\Repository\int(), ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_MANUAL, and ILIAS\Repository\user().

Referenced by updateGet().

117  : void
118  {
119  if (in_array($command, [
120  self::CMD_LP_TO_COMPLETED,
121  self::CMD_LP_TO_INCOMPLETE
122  ])) {
123  $learningProgress = ilObjectLP::getInstance($this->contentPageObject->getId());
124  if ($learningProgress->getCurrentMode() === ilLPObjSettings::LP_MODE_MANUAL) {
125  $marks = new ilLPMarks($this->contentPageObject->getId(), $this->user->getId());
126 
127  $old_state = $marks->getCompleted();
128  $new_state = ($command === self::CMD_LP_TO_COMPLETED);
129  $marks->setCompleted($new_state);
130  $marks->update();
131  ilLPStatusWrapper::_updateStatus($this->contentPageObject->getId(), $this->user->getId());
132 
133  if ((int) $old_state !== (int) $new_state) {
134  $this->lng->loadLanguageModule('trac');
135  $this->messages[] = $this->uiFactory->messageBox()->success(
136  $this->lng->txt('trac_updated_status')
137  );
138  }
139  }
140  }
141  }
static getInstance(int $obj_id)
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateGet()

ilContentPageKioskModeView::updateGet ( State  $state,
string  $command,
int  $parameter = null 
)

Update the state based on the provided command.

If the update was caused by a control with a $parameter (see ControlBuilder) that value is passed to $parameter here.

Commands and parameters are defined by the view in buildControl.

Implements ILIAS\KioskMode\View.

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

References toggleLearningProgress().

110  : State
111  {
112  $this->toggleLearningProgress($command);
113 
114  return $state;
115  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:12
+ Here is the call graph for this function:

◆ updatePost()

ilContentPageKioskModeView::updatePost ( State  $state,
string  $command,
array  $post 
)

Update the state and the object based on the provided command and post-data.

Commands are defined via the url-builder provided to render.

The POSTed data will be passed via $post.

Implements ILIAS\KioskMode\View.

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

143  : State
144  {
145  return $state;
146  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:12

Field Documentation

◆ $content_style_domain

ILIAS Style Content Object ObjectFacade ilContentPageKioskModeView::$content_style_domain
protected

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

◆ $content_style_gui

ILIAS Style Content GUIService ilContentPageKioskModeView::$content_style_gui
protected

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

◆ $contentPageObject

ilObjContentPage ilContentPageKioskModeView::$contentPageObject
protected

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

◆ $http

GlobalHttpState ilContentPageKioskModeView::$http
protected

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

◆ $mainTemplate

ilGlobalTemplateInterface ilContentPageKioskModeView::$mainTemplate
protected

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

◆ $messages

array ilContentPageKioskModeView::$messages = []
protected

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

◆ $refinery

Refinery ilContentPageKioskModeView::$refinery
protected

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

◆ $tabs

ilTabsGUI ilContentPageKioskModeView::$tabs
protected

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

◆ $uiFactory

Factory ilContentPageKioskModeView::$uiFactory
protected

Definition at line 38 of file class.ilContentPageKioskModeView.php.

◆ $uiRenderer

Renderer ilContentPageKioskModeView::$uiRenderer
protected

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

◆ $user

ilObjUser ilContentPageKioskModeView::$user
protected

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

◆ CMD_LP_TO_COMPLETED

const ilContentPageKioskModeView::CMD_LP_TO_COMPLETED = 'lp_completed'
private

Definition at line 33 of file class.ilContentPageKioskModeView.php.

◆ CMD_LP_TO_INCOMPLETE

const ilContentPageKioskModeView::CMD_LP_TO_INCOMPLETE = 'lp_incomplete'
private

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


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