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

Class ilLearningModuleKioskModeView. More...

+ Inheritance diagram for ilLearningModuleKioskModeView:
+ Collaboration diagram for ilLearningModuleKioskModeView:

Public Member Functions

 updateGet (State $state, string $command, int $param=null)
 @inheritDoc More...
 
 buildInitialState (State $state)
 @inheritDoc More...
 
 buildControls (State $state, ControlBuilder $builder)
 @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_TOGGLE_LEARNING_PROGRESS = 'toggleManualLearningProgress'
 

Protected Member Functions

 getObjectClass ()
 @inheritDoc More...
 
 setObject (\ilObject $object)
 @inheritDoc More...
 
 initLMService ($current_page)
 Init learning module presentation service. More...
 
 hasPermissionToAccessKioskMode ()
 @inheritDoc More...
 
 getMenuEntries ()
 
 maybeBuildLearningProgressToggleControl (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

 $menu_entries = null
 
 $lm
 
 $lm_pres_service
 
 $lm_pres
 
 $user
 
 $uiFactory
 
 $uiRenderer
 
 $ctrl
 
 $mainTemplate
 
 $httpRequest
 
 $tabs
 
 $messages = []
 
 $current_page_id = 0
 
 $additional_content = []
 
- Protected Attributes inherited from ilKioskModeView
 $ctrl
 
 $lng
 
 $access
 

Detailed Description

Member Function Documentation

◆ buildControls()

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

@inheritDoc

Implements ILIAS\KioskMode\View.

Definition at line 155 of file class.ilLearningModuleKioskModeView.php.

156 {
157 global $DIC;
158
159 $main_tpl = $DIC->ui()->mainTemplate();
160
161 // this may be necessary if updateGet has not been processed
162
163 // THIS currently fails
164 $this->initLMService($state->getValueFor("current_page"));
165 $nav_stat = $this->lm_pres_service->getNavigationStatus();
166
167 // next
168 $succ_id = $nav_stat->getSuccessorPageId();
169 if ($succ_id > 0) {
170 $builder->next("layout", $succ_id);
171 }
172
173 // previous
174 $prev_id = $nav_stat->getPredecessorPageId();
175 if ($prev_id > 0) {
176 $builder->previous("layout", $prev_id);
177 }
178
179 $toc = $builder->tableOfContent($this->lm->getTitle(), 'layout', 0);
180 $lm_toc_renderer = new ilLMSlateTocRendererGUI($this->lm_pres_service);
181 $lm_toc_renderer->renderLSToc($toc, $lm_toc_renderer, 0);
182
183
184 // learning progress
186
187 // menu
188 foreach ($this->getMenuEntries() as $entry) {
189 if (is_object($entry["signal"])) {
190 $builder = $builder->genericWithSignal(
191 $entry["label"],
192 $entry["signal"]
193 );
194 }
195 if ($entry["on_load"] != "") {
196 $main_tpl->addOnLoadCode($entry["on_load"]);
197 }
198 }
199
200 //$builder = $this->addPrintViewSelectionMenuButton($builder);
201
202 return $builder;
203 }
getValueFor(string $key)
Get the value for the given key.
Definition: State.php:40
initLMService($current_page)
Init learning module presentation service.
maybeBuildLearningProgressToggleControl(ControlBuilder $builder)
global $DIC
Definition: goto.php:24
Build controls for the view.
$builder
Definition: parser.php:5

References $builder, $DIC, getMenuEntries(), ILIAS\KioskMode\State\getValueFor(), initLMService(), and maybeBuildLearningProgressToggleControl().

+ Here is the call graph for this function:

◆ buildInitialState()

ilLearningModuleKioskModeView::buildInitialState ( State  $state)

@inheritDoc

Implements ILIAS\KioskMode\View.

Definition at line 147 of file class.ilLearningModuleKioskModeView.php.

147 : State
148 {
149 return $state->withValueFor("current_page", "");
150 }
Keeps the state of a view in a simple stringly type key-value store.
Definition: State.php:10
withValueFor(string $key, string $value)
Set a value for a key of the state.
Definition: State.php:20

References ILIAS\KioskMode\State\withValueFor().

+ Here is the call graph for this function:

◆ getMenuEntries()

ilLearningModuleKioskModeView::getMenuEntries ( )
protected
Parameters

return

Definition at line 211 of file class.ilLearningModuleKioskModeView.php.

211 : array
212 {
213 if (is_null($this->menu_entries)) {
214 $menu = new \ILIAS\LearningModule\Menu\ilLMMenuGUI($this->lm_pres_service);
215 $this->menu_entries = $menu->getEntries();
216 }
217 return $this->menu_entries;
218 }

References $menu_entries.

Referenced by buildControls().

+ Here is the caller graph for this function:

◆ getObjectClass()

ilLearningModuleKioskModeView::getObjectClass ( )
protected

@inheritDoc

Reimplemented from ilKioskModeView.

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

71 : string
72 {
73 return \ilObjLearningModule::class;
74 }

◆ hasPermissionToAccessKioskMode()

ilLearningModuleKioskModeView::hasPermissionToAccessKioskMode ( )
protected

@inheritDoc

Reimplemented from ilKioskModeView.

Definition at line 139 of file class.ilLearningModuleKioskModeView.php.

139 : bool
140 {
141 return $this->access->checkAccess('read', '', $this->lm->getRefId());
142 }

◆ initLMService()

ilLearningModuleKioskModeView::initLMService (   $current_page)
protected

Init learning module presentation service.

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

119 {
120 if (is_object($this->lm_pres)) {
121 return;
122 }
123 $this->lm_pres = new ilLMPresentationGUI(
124 "",
125 false,
126 "",
127 false,
128 ["ref_id" => $this->lm->getRefId(),
129 "obj_id" => (int) $current_page],
130 true
131 );
132
133 $this->lm_pres_service = $this->lm_pres->getService();
134 }
Class ilLMPresentationGUI.

Referenced by buildControls().

+ Here is the caller graph for this function:

◆ maybeBuildLearningProgressToggleControl()

ilLearningModuleKioskModeView::maybeBuildLearningProgressToggleControl ( ControlBuilder  $builder)
protected
Parameters
ControlBuilder$builder

Definition at line 223 of file class.ilLearningModuleKioskModeView.php.

224 {
225 $learningProgress = \ilObjectLP::getInstance($this->lm->getId());
226 if ($learningProgress->getCurrentMode() == \ilLPObjSettings::LP_MODE_MANUAL) {
227 $isCompleted = \ilLPMarks::_hasCompleted($this->user->getId(), $this->lm->getId());
228
229 $this->lng->loadLanguageModule('lm');
230 $learningProgressToggleCtrlLabel = $this->lng->txt('lm_btn_lp_toggle_state_completed');
231 if (!$isCompleted) {
232 $learningProgressToggleCtrlLabel = $this->lng->txt('lm_btn_lp_toggle_state_not_completed');
233 }
234 $builder = $builder->generic(
235 $learningProgressToggleCtrlLabel,
236 self::CMD_TOGGLE_LEARNING_PROGRESS,
237 1
238 );
239 }
240 return $builder;
241 }
user()
Definition: user.php:4
static _hasCompleted($a_usr_id, $a_obj_id)
static getInstance($a_obj_id)

References $builder, ilLPMarks\_hasCompleted(), 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:

◆ render()

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

@inheritDoc

Definition at line 276 of file class.ilLearningModuleKioskModeView.php.

281 : Component {
282 $this->initLMService($state->getValueFor("current_page"));
283
285 foreach ($this->getMenuEntries() as $entry) {
286 if (is_object($entry["modal"])) {
287 $additional_content[] = $entry["modal"];
288 }
289 }
290
291 $this->ctrl->setParameterByClass("illmpresentationgui", 'ref_id', $this->lm->getRefId());
292 $content = $this->uiRenderer->render($this->messages);
293 $content .= $this->ctrl->getHTML($this->lm_pres, ["cmd" => "layout"], ["illmpresentationgui"]);
294 $content .= $this->uiRenderer->render($additional_content);
295 return $factory->legacy($content);
296 }
A component is the most general form of an entity in the UI.
Definition: Component.php:14
$factory
Definition: metadata.php:58

References $additional_content.

◆ renderContentStyle()

ilLearningModuleKioskModeView::renderContentStyle ( )
protected

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

Definition at line 301 of file class.ilLearningModuleKioskModeView.php.

302 {
303 $this->mainTemplate->addCss(\ilObjStyleSheet::getSyntaxStylePath());
304 $this->mainTemplate->addCss(
306 $this->contentPageObject->getStyleSheetId()
307 )
308 );
309 }
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()

ilLearningModuleKioskModeView::setObject ( \ilObject  $object)
protected

@inheritDoc

Reimplemented from ilKioskModeView.

Definition at line 79 of file class.ilLearningModuleKioskModeView.php.

80 {
81 global $DIC;
82
83 $this->lm = $object;
84 $this->ctrl = $DIC->ctrl();
85 $this->mainTemplate = $DIC->ui()->mainTemplate();
86 $this->uiFactory = $DIC->ui()->factory();
87 $this->uiRenderer = $DIC->ui()->renderer();
88 $this->httpRequest = $DIC->http()->request();
89 $this->tabs = $DIC->tabs();
90 $this->user = $DIC->user();
91 }

References $DIC, and user().

+ Here is the call graph for this function:

◆ toggleLearningProgress()

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

Definition at line 246 of file class.ilLearningModuleKioskModeView.php.

247 {
248 if (self::CMD_TOGGLE_LEARNING_PROGRESS === $command) {
249 $learningProgress = \ilObjectLP::getInstance($this->lm->getId());
250 if ($learningProgress->getCurrentMode() == \ilLPObjSettings::LP_MODE_MANUAL) {
251 $marks = new \ilLPMarks($this->lm->getId(), $this->user->getId());
252 $marks->setCompleted(!$marks->getCompleted());
253 $marks->update();
254
255 \ilLPStatusWrapper::_updateStatus($this->lm->getId(), $this->user->getId());
256
257 $this->lng->loadLanguageModule('trac');
258 $this->messages[] = $this->uiFactory->messageBox()->success(
259 $this->lng->txt('trac_updated_status')
260 );
261 }
262 }
263 }
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.

References ilLPStatusWrapper\_updateStatus(), 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()

ilLearningModuleKioskModeView::updateGet ( State  $state,
string  $command,
int  $param = null 
)

@inheritDoc

Implements ILIAS\KioskMode\View.

Definition at line 96 of file class.ilLearningModuleKioskModeView.php.

96 : State
97 {
98 switch ($command) {
99 case "layout":
100 if ($param > 0) {
101 $this->current_page_id = $param;
102 $state = $state->withValueFor("current_page", (string) $this->current_page_id);
103 }
104 break;
106 $this->toggleLearningProgress($command);
107 break;
108 }
109
110 //$this->initLMService($this->current_page_id);
111
112 return $state;
113 }
$param
Definition: xapitoken.php:29

References $param, CMD_TOGGLE_LEARNING_PROGRESS, toggleLearningProgress(), and ILIAS\KioskMode\State\withValueFor().

+ Here is the call graph for this function:

◆ updatePost()

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

@inheritDoc

Implements ILIAS\KioskMode\View.

Definition at line 268 of file class.ilLearningModuleKioskModeView.php.

268 : State
269 {
270 return $state;
271 }

Field Documentation

◆ $additional_content

ilLearningModuleKioskModeView::$additional_content = []
protected

Definition at line 66 of file class.ilLearningModuleKioskModeView.php.

Referenced by render().

◆ $ctrl

ilLearningModuleKioskModeView::$ctrl
protected

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

◆ $current_page_id

ilLearningModuleKioskModeView::$current_page_id = 0
protected

Definition at line 63 of file class.ilLearningModuleKioskModeView.php.

◆ $httpRequest

ilLearningModuleKioskModeView::$httpRequest
protected

Definition at line 55 of file class.ilLearningModuleKioskModeView.php.

◆ $lm

ilLearningModuleKioskModeView::$lm
protected

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

◆ $lm_pres

ilLearningModuleKioskModeView::$lm_pres
protected

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

◆ $lm_pres_service

ilLearningModuleKioskModeView::$lm_pres_service
protected

Definition at line 33 of file class.ilLearningModuleKioskModeView.php.

◆ $mainTemplate

ilLearningModuleKioskModeView::$mainTemplate
protected

Definition at line 52 of file class.ilLearningModuleKioskModeView.php.

◆ $menu_entries

ilLearningModuleKioskModeView::$menu_entries = null
protected

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

Referenced by getMenuEntries().

◆ $messages

ilLearningModuleKioskModeView::$messages = []
protected

Definition at line 61 of file class.ilLearningModuleKioskModeView.php.

◆ $tabs

ilLearningModuleKioskModeView::$tabs
protected

Definition at line 58 of file class.ilLearningModuleKioskModeView.php.

◆ $uiFactory

ilLearningModuleKioskModeView::$uiFactory
protected

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

◆ $uiRenderer

ilLearningModuleKioskModeView::$uiRenderer
protected

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

◆ $user

ilLearningModuleKioskModeView::$user
protected

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

◆ CMD_TOGGLE_LEARNING_PROGRESS

const ilLearningModuleKioskModeView::CMD_TOGGLE_LEARNING_PROGRESS = 'toggleManualLearningProgress'

Definition at line 21 of file class.ilLearningModuleKioskModeView.php.

Referenced by updateGet().


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