ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilContentPageKioskModeView Class Reference

Class ilContentPageKioskModeView. More...

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

Public Member Functions

 buildInitialState (State $empty_state)
 
 buildControls (State $state, ControlBuilder $builder)
 
 updateGet (State $state, string $command, int $param=null)
 
 updatePost (State $state, string $command, array $post)
 
 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...
 

Data Fields

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

Protected Member Functions

 getObjectClass ()
 
 setObject (\ilObject $object)
 
 hasPermissionToAccessKioskMode ()
 
 builtLearningProgressToggleControl (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 
)

Implements ILIAS\KioskMode\View.

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

References builtLearningProgressToggleControl().

94  {
95  $this->builtLearningProgressToggleControl($builder);
96  }
builtLearningProgressToggleControl(ControlBuilder $builder)
+ Here is the call graph for this function:

◆ buildInitialState()

ilContentPageKioskModeView::buildInitialState ( State  $empty_state)

Implements ILIAS\KioskMode\View.

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

85  : State
86  {
87  return $empty_state;
88  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:9

◆ builtLearningProgressToggleControl()

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

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

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

Referenced by buildControls().

102  {
103  $learningProgress = \ilObjectLP::getInstance($this->contentPageObject->getId());
104  if ($learningProgress->getCurrentMode() == \ilLPObjSettings::LP_MODE_MANUAL) {
105  $isCompleted = \ilLPMarks::_hasCompleted($this->user->getId(), $this->contentPageObject->getId());
106 
107  $this->lng->loadLanguageModule('copa');
108  $learningProgressToggleCtrlLabel = $this->lng->txt('copa_btn_lp_toggle_state_completed');
109  $cmd = self::CMD_LP_TO_INCOMPLETE;
110  if (!$isCompleted) {
111  $learningProgressToggleCtrlLabel = $this->lng->txt('copa_btn_lp_toggle_state_not_completed');
112  $cmd = self::CMD_LP_TO_COMPLETED;
113  }
114 
115  $builder->generic(
116  $learningProgressToggleCtrlLabel,
117  $cmd,
118  1
119  );
120  }
121  }
static _hasCompleted($a_usr_id, $a_obj_id)
user()
Definition: user.php:4
static getInstance($a_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 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.

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

◆ render()

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

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

References ilLearningProgress\_tracProgress(), ILIAS\UI\Factory\legacy(), ilContentPagePageCommandForwarder\PRESENTATION_MODE_EMBEDDED_PRESENTATION, renderContentStyle(), and user().

178  : Component {
180  $this->user->getId(),
181  $this->contentPageObject->getId(),
182  $this->contentPageObject->getRefId(),
183  $this->contentPageObject->getType()
184  );
185 
186  $this->renderContentStyle();
187 
188  $forwarder = new \ilContentPagePageCommandForwarder(
189  $this->httpRequest,
190  $this->ctrl,
191  $this->tabs,
192  $this->lng,
193  $this->contentPageObject
194  );
196 
197  $this->ctrl->setParameterByClass(\ilContentPagePageGUI::class, 'ref_id', $this->contentPageObject->getRefId());
198 
199  return $factory->legacy(implode('', [
200  $this->uiRenderer->render($this->messages),
201  $forwarder->forward($this->ctrl->getLinkTargetByClass([
202  \ilRepositoryGUI::class, \ilObjContentPageGUI::class, \ilContentPagePageGUI::class
203  ]))
204  ]));
205  }
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='')
user()
Definition: user.php:4
legacy($content)
description: purpose: > This component is used to wrap an existing ILIAS UI element into a UI compon...
+ 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 210 of file class.ilContentPageKioskModeView.php.

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

Referenced by render().

211  {
212  $this->mainTemplate->addCss(\ilObjStyleSheet::getSyntaxStylePath());
213  $this->mainTemplate->addCss(
215  $this->contentPageObject->getStyleSheetId()
216  )
217  );
218  }
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true)
get content style path
+ 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 59 of file class.ilContentPageKioskModeView.php.

References $DIC, and user().

60  {
61  global $DIC;
62 
63  $this->contentPageObject = $object;
64 
65  $this->ctrl = $DIC->ctrl();
66  $this->mainTemplate = $DIC->ui()->mainTemplate();
67  $this->uiFactory = $DIC->ui()->factory();
68  $this->uiRenderer = $DIC->ui()->renderer();
69  $this->httpRequest = $DIC->http()->request();
70  $this->tabs = $DIC->tabs();
71  $this->user = $DIC->user();
72  }
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ toggleLearningProgress()

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

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

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

Referenced by updateGet().

137  {
138  if (in_array($command, [
139  self::CMD_LP_TO_COMPLETED,
140  self::CMD_LP_TO_INCOMPLETE
141  ])) {
142  $learningProgress = ilObjectLP::getInstance($this->contentPageObject->getId());
143  if ($learningProgress->getCurrentMode() == ilLPObjSettings::LP_MODE_MANUAL) {
144  $marks = new ilLPMarks($this->contentPageObject->getId(), $this->user->getId());
145 
146  $old_state = $marks->getCompleted();
147  $new_state = ($command === self::CMD_LP_TO_COMPLETED);
148  $marks->setCompleted($new_state);
149  $marks->update();
150  ilLPStatusWrapper::_updateStatus($this->contentPageObject->getId(), $this->user->getId());
151 
152  if ($old_state != $new_state) {
153  $this->lng->loadLanguageModule('trac');
154  $this->messages[] = $this->uiFactory->messageBox()->success(
155  $this->lng->txt('trac_updated_status')
156  );
157  }
158  }
159  }
160  }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
user()
Definition: user.php:4
static getInstance($a_obj_id)
+ 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 
)

Implements ILIAS\KioskMode\View.

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

References $state, and toggleLearningProgress().

126  : State
127  {
128  $this->toggleLearningProgress($command);
129 
130  return $state;
131  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:9
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10
+ Here is the call graph for this function:

◆ updatePost()

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

Implements ILIAS\KioskMode\View.

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

References $state.

165  : State
166  {
167  return $state;
168  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:9
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
Definition: linkback.php:10

Field Documentation

◆ $contentPageObject

ilContentPageKioskModeView::$contentPageObject
protected

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

◆ $ctrl

ilContentPageKioskModeView::$ctrl
protected

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

◆ $httpRequest

ilContentPageKioskModeView::$httpRequest
protected

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

◆ $mainTemplate

ilContentPageKioskModeView::$mainTemplate
protected

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

◆ $messages

ilContentPageKioskModeView::$messages = []
protected

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

◆ $tabs

ilContentPageKioskModeView::$tabs
protected

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

◆ $uiFactory

ilContentPageKioskModeView::$uiFactory
protected

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

◆ $uiRenderer

ilContentPageKioskModeView::$uiRenderer
protected

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

◆ $user

ilContentPageKioskModeView::$user
protected

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

◆ CMD_LP_TO_COMPLETED

const ilContentPageKioskModeView::CMD_LP_TO_COMPLETED = 'lp_completed'

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

◆ CMD_LP_TO_INCOMPLETE

const ilContentPageKioskModeView::CMD_LP_TO_INCOMPLETE = 'lp_incomplete'

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


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