ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilFileKioskModeView Class Reference
+ Inheritance diagram for ilFileKioskModeView:
+ Collaboration diagram for ilFileKioskModeView:

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 ()
 
 hasPermissionToAccessKioskMode ()
 
 buildLearningProgressToggleControl (ControlBuilder $builder)
 
 toggleLearningProgress ()
 
- 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

ilObjFile $file_obj
 
ilObjUser $user
 
Factory $ui_factory
 
Renderer $ui_renderer
 
ilGlobalTemplateInterface $main_template
 
GlobalHttpState $http
 
Refinery $refinery
 
ilTabsGUI $tabs
 
array $messages = []
 
- Protected Attributes inherited from ilKioskModeView
ilCtrl $ctrl
 
ilLanguage $lng
 
ilAccessHandler $access
 

Private Attributes

const CMD_TOGGLE_LEARNING_PROGRESS = 'toggleManualLearningProgress'
 

Detailed Description

Author
Lukas Zehnder lukas.nosp@m.@sr..nosp@m.solut.nosp@m.ions

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

Member Function Documentation

◆ buildControls()

ilFileKioskModeView::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 81 of file class.ilFileKioskModeView.php.

References $learning_progress, buildLearningProgressToggleControl(), ilObjectLP\getInstance(), and ilLPObjSettings\LP_MODE_MANUAL.

81  : void
82  {
83  $learning_progress = \ilObjectLP::getInstance($this->file_obj->getId());
84  if ($learning_progress->getCurrentMode(
85  ) === \ilLPObjSettings::LP_MODE_MANUAL) { //TODO: create and implement handling for second lp mode
86  $this->buildLearningProgressToggleControl($builder);
87  }
88  }
$learning_progress
Definition: plugin.php:30
buildLearningProgressToggleControl(ControlBuilder $builder)
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ buildInitialState()

ilFileKioskModeView::buildInitialState ( State  $empty_state)

Build an initial state based on the Provided empty state.

Implements ILIAS\KioskMode\View.

Definition at line 76 of file class.ilFileKioskModeView.php.

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

◆ buildLearningProgressToggleControl()

ilFileKioskModeView::buildLearningProgressToggleControl ( ControlBuilder  $builder)
protected

Definition at line 109 of file class.ilFileKioskModeView.php.

References ilLPStatus\_hasUserCompleted(), ILIAS\KioskMode\ControlBuilder\generic(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

Referenced by buildControls().

110  {
111  $this->lng->loadLanguageModule('file');
112  if (ilLPStatus::_hasUserCompleted($this->file_obj->getId(), $this->user->getId())) {
113  $learning_progress_toggle_ctrl_label = $this->lng->txt('file_btn_lp_toggle_state_completed');
114  } else {
115  $learning_progress_toggle_ctrl_label = $this->lng->txt('file_btn_lp_toggle_state_not_completed');
116  }
117 
118  return $builder->generic(
119  $learning_progress_toggle_ctrl_label,
120  self::CMD_TOGGLE_LEARNING_PROGRESS,
121  1
122  );
123  }
static _hasUserCompleted(int $a_obj_id, int $a_user_id)
Lookup user object completion.
Build controls for the view.
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()

ilFileKioskModeView::getObjectClass ( )
protected

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

References $DIC, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), ilKioskModeView\setObject(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

49  : string
50  {
51  return ilObjFile::class;
52  }
+ Here is the call graph for this function:

◆ hasPermissionToAccessKioskMode()

ilFileKioskModeView::hasPermissionToAccessKioskMode ( )
protected

Definition at line 71 of file class.ilFileKioskModeView.php.

References ILIAS\Repository\access().

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

◆ render()

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

Definition at line 103 of file class.ilFileKioskModeView.php.

References ILIAS\UI\Factory\legacy().

103  : Component
104  {
105  $file_gui = new ilObjFileGUI($this->file_obj->getRefId());
106  return $factory->legacy($file_gui->buildInfoScreen(true)->getHTML());
107  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
legacy(string $content)
description: purpose: > This component is used to wrap an existing ILIAS UI element into a UI compon...
GUI class for file objects.
+ Here is the call graph for this function:

◆ toggleLearningProgress()

ilFileKioskModeView::toggleLearningProgress ( )
protected

Definition at line 125 of file class.ilFileKioskModeView.php.

References ilLPStatus\_hasUserCompleted(), ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, ILIAS\Repository\user(), and ilLPStatus\writeStatus().

Referenced by updateGet().

125  : void
126  {
127  if (!ilLPStatus::_hasUserCompleted($this->file_obj->getId(), $this->user->getId())) {
129  $this->file_obj->getId(),
130  $this->user->getId(),
132  );
133  } else {
135  $this->file_obj->getId(),
136  $this->user->getId(),
138  );
139  }
140  }
const LP_STATUS_COMPLETED_NUM
static _hasUserCompleted(int $a_obj_id, int $a_user_id)
Lookup user object completion.
const LP_STATUS_NOT_ATTEMPTED_NUM
static writeStatus(int $a_obj_id, int $a_user_id, int $a_status, int $a_percentage=0, bool $a_force_per=false, ?int &$a_old_status=self::LP_STATUS_NOT_ATTEMPTED_NUM)
Write status for user and object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateGet()

ilFileKioskModeView::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 90 of file class.ilFileKioskModeView.php.

References toggleLearningProgress().

90  : State
91  {
92  if ($command === self::CMD_TOGGLE_LEARNING_PROGRESS) {
93  $this->toggleLearningProgress();
94  }
95  return $state;
96  }
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()

ilFileKioskModeView::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 98 of file class.ilFileKioskModeView.php.

98  : State
99  {
100  return $state;
101  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:12

Field Documentation

◆ $file_obj

ilObjFile ilFileKioskModeView::$file_obj
protected

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

◆ $http

GlobalHttpState ilFileKioskModeView::$http
protected

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

◆ $main_template

ilGlobalTemplateInterface ilFileKioskModeView::$main_template
protected

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

◆ $messages

array ilFileKioskModeView::$messages = []
protected

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

◆ $refinery

Refinery ilFileKioskModeView::$refinery
protected

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

◆ $tabs

ilTabsGUI ilFileKioskModeView::$tabs
protected

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

◆ $ui_factory

Factory ilFileKioskModeView::$ui_factory
protected

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

◆ $ui_renderer

Renderer ilFileKioskModeView::$ui_renderer
protected

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

◆ $user

ilObjUser ilFileKioskModeView::$user
protected

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

◆ CMD_TOGGLE_LEARNING_PROGRESS

const ilFileKioskModeView::CMD_TOGGLE_LEARNING_PROGRESS = 'toggleManualLearningProgress'
private

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


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