ILIAS  trunk Revision v11.0_alpha-2662-g519ff7d528f
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
 
Translations $translation
 
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 string CMD_LP_TO_COMPLETED = 'lp_completed'
 
const string CMD_LP_TO_INCOMPLETE = 'lp_incomplete'
 

Detailed Description

Definition at line 32 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 87 of file class.ilContentPageKioskModeView.php.

References buildLearningProgressToggleControl().

87  : void
88  {
89  $this->buildLearningProgressToggleControl($builder);
90  }
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 82 of file class.ilContentPageKioskModeView.php.

82  : State
83  {
84  return $empty_state;
85  }

◆ buildLearningProgressToggleControl()

ilContentPageKioskModeView::buildLearningProgressToggleControl ( ControlBuilder  $builder)
protected

Definition at line 92 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().

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

◆ getObjectClass()

ilContentPageKioskModeView::getObjectClass ( )
protected

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

51  : string
52  {
53  return ilObjContentPage::class;
54  }

◆ hasPermissionToAccessKioskMode()

ilContentPageKioskModeView::hasPermissionToAccessKioskMode ( )
protected

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

References ILIAS\Repository\access().

77  : bool
78  {
79  return $this->access->checkAccess('read', '', $this->contentPageObject->getRefId());
80  }
+ Here is the call graph for this function:

◆ render()

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

Definition at line 152 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().

157  : Component {
159  $this->user->getId(),
160  $this->contentPageObject->getId(),
161  $this->contentPageObject->getRefId(),
162  $this->contentPageObject->getType()
163  );
164 
165  $this->renderContentStyle();
166 
167  $forwarder = new ilContentPagePageCommandForwarder(
168  $this->http,
169  $this->ctrl,
170  $this->tabs,
171  $this->lng,
172  $this->contentPageObject,
173  $this->translation,
174  $this->user,
175  $this->refinery,
176  $this->content_style_domain
177  );
179 
180  $this->ctrl->setParameterByClass(ilContentPagePageGUI::class, 'ref_id', $this->contentPageObject->getRefId());
181 
182  return $factory->legacy()->content(implode('', [
183  $this->uiRenderer->render($this->messages),
184  $forwarder->forward($this->ctrl->getLinkTargetByClass([
185  ilRepositoryGUI::class, ilObjContentPageGUI::class, ilContentPagePageGUI::class
186  ]))
187  ]));
188  }
legacy()
description: purpose: > legacy components are used as provisional elements in the UI framework while...
renderContentStyle()
Renders the content style of a ContentPage object into main template.
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.
final const string PRESENTATION_MODE_EMBEDDED_PRESENTATION
presentation mode for embedded presentation, e.g.
+ 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 193 of file class.ilContentPageKioskModeView.php.

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

Referenced by render().

193  : void
194  {
196  $this->content_style_gui->addCss(
197  $this->mainTemplate,
198  $this->contentPageObject->getRefId()
199  );
200  }
mainTemplate()
+ 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 56 of file class.ilContentPageKioskModeView.php.

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

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

◆ toggleLearningProgress()

ilContentPageKioskModeView::toggleLearningProgress ( string  $command)
protected

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

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

Referenced by updateGet().

121  : void
122  {
123  if (in_array($command, [
124  self::CMD_LP_TO_COMPLETED,
125  self::CMD_LP_TO_INCOMPLETE
126  ])) {
127  $learningProgress = ilObjectLP::getInstance($this->contentPageObject->getId());
128  if ($learningProgress->getCurrentMode() === ilLPObjSettings::LP_MODE_MANUAL) {
129  $marks = new ilLPMarks($this->contentPageObject->getId(), $this->user->getId());
130 
131  $old_state = $marks->getCompleted();
132  $new_state = ($command === self::CMD_LP_TO_COMPLETED);
133  $marks->setCompleted($new_state);
134  $marks->update();
135  ilLPStatusWrapper::_updateStatus($this->contentPageObject->getId(), $this->user->getId());
136 
137  if ((int) $old_state !== (int) $new_state) {
138  $this->lng->loadLanguageModule('trac');
139  $this->messages[] = $this->uiFactory->messageBox()->success(
140  $this->lng->txt('trac_updated_status')
141  );
142  }
143  }
144  }
145  }
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 114 of file class.ilContentPageKioskModeView.php.

References toggleLearningProgress().

114  : State
115  {
116  $this->toggleLearningProgress($command);
117 
118  return $state;
119  }
+ 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 147 of file class.ilContentPageKioskModeView.php.

147  : State
148  {
149  return $state;
150  }

Field Documentation

◆ $content_style_domain

ILIAS Style Content Object ObjectFacade ilContentPageKioskModeView::$content_style_domain
protected

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

◆ $content_style_gui

ILIAS Style Content GUIService ilContentPageKioskModeView::$content_style_gui
protected

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

◆ $contentPageObject

ilObjContentPage ilContentPageKioskModeView::$contentPageObject
protected

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

◆ $http

GlobalHttpState ilContentPageKioskModeView::$http
protected

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

◆ $mainTemplate

ilGlobalTemplateInterface ilContentPageKioskModeView::$mainTemplate
protected

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

◆ $messages

array ilContentPageKioskModeView::$messages = []
protected

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

◆ $refinery

Refinery ilContentPageKioskModeView::$refinery
protected

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

◆ $tabs

ilTabsGUI ilContentPageKioskModeView::$tabs
protected

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

◆ $translation

Translations ilContentPageKioskModeView::$translation
protected

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

◆ $uiFactory

Factory ilContentPageKioskModeView::$uiFactory
protected

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

◆ $uiRenderer

Renderer ilContentPageKioskModeView::$uiRenderer
protected

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

◆ $user

ilObjUser ilContentPageKioskModeView::$user
protected

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

◆ CMD_LP_TO_COMPLETED

const string ilContentPageKioskModeView::CMD_LP_TO_COMPLETED = 'lp_completed'
private

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

◆ CMD_LP_TO_INCOMPLETE

const string ilContentPageKioskModeView::CMD_LP_TO_INCOMPLETE = 'lp_incomplete'
private

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


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