ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 84 of file class.ilFileKioskModeView.php.

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

84  : void
85  {
86  $learning_progress = \ilObjectLP::getInstance($this->file_obj->getId());
87  if ($learning_progress->getCurrentMode(
88  ) === \ilLPObjSettings::LP_MODE_MANUAL) { //TODO: create and implement handling for second lp mode
89  $this->buildLearningProgressToggleControl($builder);
90  }
91  }
$learning_progress
Definition: plugin.php:29
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 79 of file class.ilFileKioskModeView.php.

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

◆ buildLearningProgressToggleControl()

ilFileKioskModeView::buildLearningProgressToggleControl ( ControlBuilder  $builder)
protected

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

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

Referenced by buildControls().

113  {
114  $this->lng->loadLanguageModule('file');
115  if (ilLPStatus::_hasUserCompleted($this->file_obj->getId(), $this->user->getId())) {
116  $learning_progress_toggle_ctrl_label = $this->lng->txt('file_btn_lp_toggle_state_completed');
117  } else {
118  $learning_progress_toggle_ctrl_label = $this->lng->txt('file_btn_lp_toggle_state_not_completed');
119  }
120 
121  return $builder->generic(
122  $learning_progress_toggle_ctrl_label,
123  self::CMD_TOGGLE_LEARNING_PROGRESS,
124  1
125  );
126  }
static _hasUserCompleted(int $a_obj_id, int $a_user_id)
Lookup user object completion.
generic(string $label, string $command, ?int $parameter=null)
A generic control needs to have a label that tells what it does.
Build controls for the view.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getObjectClass()

ilFileKioskModeView::getObjectClass ( )
protected

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

52  : string
53  {
54  return ilObjFile::class;
55  }
+ Here is the call graph for this function:

◆ hasPermissionToAccessKioskMode()

ilFileKioskModeView::hasPermissionToAccessKioskMode ( )
protected

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

References ILIAS\Repository\access().

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

◆ render()

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

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

References ILIAS\UI\Factory\legacy().

106  : Component
107  {
108  $file_gui = new ilObjFileGUI($this->file_obj->getRefId());
109  return $factory->legacy()->content($file_gui->buildInfoScreen(true)->getHTML());
110  }
legacy()
description: purpose: > legacy components are used as provisional elements in the UI framework while...
GUI class for file objects.
+ Here is the call graph for this function:

◆ toggleLearningProgress()

ilFileKioskModeView::toggleLearningProgress ( )
protected

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

128  : void
129  {
130  if (!ilLPStatus::_hasUserCompleted($this->file_obj->getId(), $this->user->getId())) {
132  $this->file_obj->getId(),
133  $this->user->getId(),
135  );
136  } else {
138  $this->file_obj->getId(),
139  $this->user->getId(),
141  );
142  }
143  }
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 93 of file class.ilFileKioskModeView.php.

References toggleLearningProgress().

93  : State
94  {
95  if ($command === self::CMD_TOGGLE_LEARNING_PROGRESS) {
96  $this->toggleLearningProgress();
97  }
98  return $state;
99  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:26
+ 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 101 of file class.ilFileKioskModeView.php.

101  : State
102  {
103  return $state;
104  }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:26

Field Documentation

◆ $file_obj

ilObjFile ilFileKioskModeView::$file_obj
protected

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

◆ $http

GlobalHttpState ilFileKioskModeView::$http
protected

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

◆ $main_template

ilGlobalTemplateInterface ilFileKioskModeView::$main_template
protected

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

◆ $messages

array ilFileKioskModeView::$messages = []
protected

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

◆ $refinery

Refinery ilFileKioskModeView::$refinery
protected

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

◆ $tabs

ilTabsGUI ilFileKioskModeView::$tabs
protected

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

◆ $ui_factory

Factory ilFileKioskModeView::$ui_factory
protected

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

◆ $ui_renderer

Renderer ilFileKioskModeView::$ui_renderer
protected

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

◆ $user

ilObjUser ilFileKioskModeView::$user
protected

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

◆ CMD_TOGGLE_LEARNING_PROGRESS

const ilFileKioskModeView::CMD_TOGGLE_LEARNING_PROGRESS = 'toggleManualLearningProgress'
private

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


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