ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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
 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, 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 ()
 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...
 
 buildLearningProgressToggleControl (ControlBuilder $builder)
 
 toggleLearningProgress (string $command)
 
 renderContentStyle ()
 Renders the content style of a ContentPage object into main template. More...
 
 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.

87 : void
88 {
90 }
buildLearningProgressToggleControl(ControlBuilder $builder)

References buildLearningProgressToggleControl().

+ 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 }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:27

◆ buildLearningProgressToggleControl()

ilContentPageKioskModeView::buildLearningProgressToggleControl ( ControlBuilder  $builder)
protected

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

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');
101 if (!$isCompleted) {
102 $learningProgressToggleCtrlLabel = $this->lng->txt('copa_btn_lp_toggle_state_not_completed');
104 }
105
106 $builder->generic(
107 $learningProgressToggleCtrlLabel,
108 $cmd,
109 1
110 );
111 }
112 }
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.

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

Referenced by buildControls().

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

◆ getObjectClass()

ilContentPageKioskModeView::getObjectClass ( )
protected

Get the class of objects this view displays.

Reimplemented from ilKioskModeView.

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

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

◆ hasPermissionToAccessKioskMode()

ilContentPageKioskModeView::hasPermissionToAccessKioskMode ( )
protected

Check if the global user has permission to access the kiosk mode of the supplied object.

Reimplemented from ilKioskModeView.

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

77 : bool
78 {
79 return $this->access->checkAccess('read', '', $this->contentPageObject->getRefId());
80 }

References ILIAS\Repository\access().

+ 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.

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 }
renderContentStyle()
Renders the content style of a ContentPage object into main template.
final const string PRESENTATION_MODE_EMBEDDED_PRESENTATION
presentation mode for embedded presentation, e.g.
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.

◆ renderContentStyle()

ilContentPageKioskModeView::renderContentStyle ( )
protected

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

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

193 : void
194 {
196 $this->content_style_gui->addCss(
197 $this->mainTemplate,
198 $this->contentPageObject->getRefId()
199 );
200 }
mainTemplate()

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

+ Here is the call graph for this function:

◆ setObject()

ilContentPageKioskModeView::setObject ( ilObject  $object)
protected

Set the object for this view.

This makes it possible to use an appropriately typehinted member variable to allow for static code analysis. Sadly PHP has no generics...

Reimplemented from ilKioskModeView.

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

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 }
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

◆ toggleLearningProgress()

ilContentPageKioskModeView::toggleLearningProgress ( string  $command)
protected

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

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 _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)

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

Referenced by updateGet().

+ 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.

114 : State
115 {
116 $this->toggleLearningProgress($command);
117
118 return $state;
119 }

References toggleLearningProgress().

+ 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

◆ CMD_LP_TO_INCOMPLETE

const string ilContentPageKioskModeView::CMD_LP_TO_INCOMPLETE = 'lp_incomplete'
private

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