ILIAS  release_7 Revision v7.30-3-g800a261c036
ilContentPageKioskModeView Class Reference

Class ilContentPageKioskModeView. More...

+ Inheritance diagram for ilContentPageKioskModeView:
+ Collaboration diagram for ilContentPageKioskModeView:

Public Member Functions

 buildInitialState (State $empty_state)
 @inheritDoc More...
 
 buildControls (State $state, ControlBuilder $builder)
 @inheritDoc More...
 
 updateGet (State $state, string $command, int $param=null)
 @inheritDoc More...
 
 updatePost (State $state, string $command, array $post)
 @inheritDoc More...
 
 render (State $state, Factory $factory, URLBuilder $url_builder, array $post=null)
 @inheritDoc More...
 
- 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...
 

Data Fields

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

Protected Member Functions

 getObjectClass ()
 @inheritDoc More...
 
 setObject (ilObject $object)
 @inheritDoc More...
 
 hasPermissionToAccessKioskMode ()
 @inheritDoc More...
 
 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

 $contentPageObject
 
 $user
 
 $uiFactory
 
 $uiRenderer
 
 $ctrl
 
 $mainTemplate
 
 $httpRequest
 
 $tabs
 
 $messages = []
 
- Protected Attributes inherited from ilKioskModeView
 $ctrl
 
 $lng
 
 $access
 

Detailed Description

Member Function Documentation

◆ buildControls()

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

@inheritDoc

Implements ILIAS\KioskMode\View.

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

86 {
88 }
buildLearningProgressToggleControl(ControlBuilder $builder)

References buildLearningProgressToggleControl().

+ Here is the call graph for this function:

◆ buildInitialState()

ilContentPageKioskModeView::buildInitialState ( State  $empty_state)

@inheritDoc

Implements ILIAS\KioskMode\View.

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

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

◆ buildLearningProgressToggleControl()

ilContentPageKioskModeView::buildLearningProgressToggleControl ( ControlBuilder  $builder)
protected
Parameters
ControlBuilder$builder

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

93 : void
94 {
95 $learningProgress = ilObjectLP::getInstance($this->contentPageObject->getId());
96 if ($learningProgress->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL) {
97 $isCompleted = ilLPMarks::_hasCompleted($this->user->getId(), $this->contentPageObject->getId());
98
99 $this->lng->loadLanguageModule('copa');
100 $learningProgressToggleCtrlLabel = $this->lng->txt('copa_btn_lp_toggle_state_completed');
102 if (!$isCompleted) {
103 $learningProgressToggleCtrlLabel = $this->lng->txt('copa_btn_lp_toggle_state_not_completed');
105 }
106
107 $builder->generic(
108 $learningProgressToggleCtrlLabel,
109 $cmd,
110 1
111 );
112 }
113 }
user()
Definition: user.php:4
static _hasCompleted($a_usr_id, $a_obj_id)
static getInstance($a_obj_id)
$builder
Definition: parser.php:5

References $builder, ilLPMarks\_hasCompleted(), CMD_LP_TO_COMPLETED, CMD_LP_TO_INCOMPLETE, ilObjectLP\getInstance(), ilLPObjSettings\LP_MODE_MANUAL, and user().

Referenced by buildControls().

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

◆ getObjectClass()

ilContentPageKioskModeView::getObjectClass ( )
protected

@inheritDoc

Reimplemented from ilKioskModeView.

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

43 : string
44 {
45 return ilObjContentPage::class;
46 }

◆ hasPermissionToAccessKioskMode()

ilContentPageKioskModeView::hasPermissionToAccessKioskMode ( )
protected

@inheritDoc

Reimplemented from ilKioskModeView.

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

69 : bool
70 {
71 return $this->access->checkAccess('read', '', $this->contentPageObject->getRefId());
72 }

◆ render()

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

@inheritDoc

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

170 : Component {
172 $this->user->getId(),
173 $this->contentPageObject->getId(),
174 $this->contentPageObject->getRefId(),
175 $this->contentPageObject->getType()
176 );
177
178 $this->renderContentStyle();
179
180 $forwarder = new ilContentPagePageCommandForwarder(
181 $this->httpRequest,
182 $this->ctrl,
183 $this->tabs,
184 $this->lng,
185 $this->contentPageObject,
186 $this->user
187 );
189
190 $this->ctrl->setParameterByClass(ilContentPagePageGUI::class, 'ref_id', $this->contentPageObject->getRefId());
191
192 return $factory->legacy(implode('', [
193 $this->uiRenderer->render($this->messages),
194 $forwarder->forward($this->ctrl->getLinkTargetByClass([
195 ilRepositoryGUI::class, ilObjContentPageGUI::class, ilContentPagePageGUI::class
196 ]))
197 ]));
198 }
renderContentStyle()
Renders the content style of a ContentPage object into main template.
const PRESENTATION_MODE_EMBEDDED_PRESENTATION
presentation mode for embedded presentation, e.g.
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
A component is the most general form of an entity in the UI.
Definition: Component.php:14
$factory
Definition: metadata.php:58

◆ renderContentStyle()

ilContentPageKioskModeView::renderContentStyle ( )
protected

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

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

203 : void
204 {
205 $this->mainTemplate->addCss(ilObjStyleSheet::getSyntaxStylePath());
206 $this->mainTemplate->addCss(
208 $this->contentPageObject->getStyleSheetId()
209 )
210 );
211 }
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path

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

+ Here is the call graph for this function:

◆ setObject()

ilContentPageKioskModeView::setObject ( ilObject  $object)
protected

@inheritDoc

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

52 {
53 global $DIC;
54
55 $this->contentPageObject = $object;
56
57 $this->ctrl = $DIC->ctrl();
58 $this->mainTemplate = $DIC->ui()->mainTemplate();
59 $this->uiFactory = $DIC->ui()->factory();
60 $this->uiRenderer = $DIC->ui()->renderer();
61 $this->httpRequest = $DIC->http()->request();
62 $this->tabs = $DIC->tabs();
63 $this->user = $DIC->user();
64 }
global $DIC
Definition: goto.php:24

References $DIC, and user().

+ Here is the call graph for this function:

◆ toggleLearningProgress()

ilContentPageKioskModeView::toggleLearningProgress ( string  $command)
protected
Parameters
string$command

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

128 : void
129 {
130 if (in_array($command, [
131 self::CMD_LP_TO_COMPLETED,
132 self::CMD_LP_TO_INCOMPLETE
133 ])) {
134 $learningProgress = ilObjectLP::getInstance($this->contentPageObject->getId());
135 if ($learningProgress->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL) {
136 $marks = new ilLPMarks($this->contentPageObject->getId(), $this->user->getId());
137
138 $old_state = $marks->getCompleted();
139 $new_state = ($command === self::CMD_LP_TO_COMPLETED);
140 $marks->setCompleted($new_state);
141 $marks->update();
142 ilLPStatusWrapper::_updateStatus($this->contentPageObject->getId(), $this->user->getId());
143
144 if ($old_state != $new_state) {
145 $this->lng->loadLanguageModule('trac');
146 $this->messages[] = $this->uiFactory->messageBox()->success(
147 $this->lng->txt('trac_updated_status')
148 );
149 }
150 }
151 }
152 }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.

References ilLPStatusWrapper\_updateStatus(), CMD_LP_TO_COMPLETED, ilObjectLP\getInstance(), 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  $param = null 
)

@inheritDoc

Implements ILIAS\KioskMode\View.

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

118 : State
119 {
120 $this->toggleLearningProgress($command);
121
122 return $state;
123 }

References toggleLearningProgress().

+ Here is the call graph for this function:

◆ updatePost()

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

@inheritDoc

Implements ILIAS\KioskMode\View.

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

157 : State
158 {
159 return $state;
160 }

Field Documentation

◆ $contentPageObject

ilContentPageKioskModeView::$contentPageObject
protected

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

◆ $ctrl

ilContentPageKioskModeView::$ctrl
protected

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

◆ $httpRequest

ilContentPageKioskModeView::$httpRequest
protected

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

◆ $mainTemplate

ilContentPageKioskModeView::$mainTemplate
protected

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

◆ $messages

ilContentPageKioskModeView::$messages = []
protected

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

◆ $tabs

ilContentPageKioskModeView::$tabs
protected

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

◆ $uiFactory

ilContentPageKioskModeView::$uiFactory
protected

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

◆ $uiRenderer

ilContentPageKioskModeView::$uiRenderer
protected

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

◆ $user

ilContentPageKioskModeView::$user
protected

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

◆ CMD_LP_TO_COMPLETED

const ilContentPageKioskModeView::CMD_LP_TO_COMPLETED = 'lp_completed'

◆ CMD_LP_TO_INCOMPLETE

const ilContentPageKioskModeView::CMD_LP_TO_INCOMPLETE = 'lp_incomplete'

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