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

Class LSControlBuilder. More...

+ Inheritance diagram for LSControlBuilder:
+ Collaboration diagram for LSControlBuilder:

Public Member Functions

 __construct (Factory $ui_factory, LSURLBuilder $url_builder, ilLanguage $language, LSGlobalSettings $global_settings)
 
 getExitControl ()
 
 getPreviousControl ()
 
 getNextControl ()
 
 getDoneControl ()
 
 getToggles ()
 
 getModeControls ()
 
 getControls ()
 
 getLocator ()
 
 getToc ()
 
 exit (string $command)
 An exit control allows the user to gracefully leave the object providing the kiosk mode.
Exceptions

LogicException if view wants to introduce a second exit button. More...

 
 next (string $command, int $parameter=null)
 A next control allows the user to progress to the next item in the object.The $parameter can be used to pass additional information to View::updateGet if required, e.g. about a chapter in the content.
Exceptions

LogicException if view wants to introduce a second next button. More...

 
 previous (string $command, int $parameter=null)
 A previous control allows the user to go back to the previous item in the object.The $parameter can be used to pass additional information to View::updateGet if required, e.g. about a chapter in the content.
Exceptions

LogicException if view wants to introduce a second previous button. More...

 
 done (string $command, int $parameter=null)
 A done control allows the user to mark the object as done.The $parameter can be used to pass additional information to View::updateGet if required, e.g. about a chapter in the content.
Exceptions

LogicException if view wants to introduce a second done button. More...

 
 generic (string $label, string $command, int $parameter=null)
 A generic control needs to have a label that tells what it does.The $parameter can be used to pass additional information to View::updateGet if required, e.g. about a chapter in the content. More...
 
 genericWithSignal (string $label, Signal $signal)
 
 toggle (string $label, string $on_command, string $off_command)
 A toggle can be used to switch some behaviour in the view on or of. More...
 
 mode (string $command, array $labels)
 A mode control can be used to switch between different modes in the view.Uses the indizes of the labels in the array as parameter for the command. More...
 
 locator (string $command)
 A locator allows the user to see the path leading to her current location and jump back to previous items on that path.The command will be enhanced with a parameter defined in the locator builder.
Exceptions

LogicException if view wants to introduce a second locator. More...

 
 tableOfContent (string $label, string $command, int $parameter=null, $state=null)
 A table of content allows the user to get an overview over the generally available content in the object.The command will be enhanced with a parameter defined here on in the locator builder.If a parameter is defined here, the view provides an overview-page.
Exceptions

LogicException if view wants to introduce a second TOC.

Parameters
mixed$stateone of the STATE_ constants from TOCBuilder
More...
 
 start (string $label, string $url, int $parameter=null)
 Add a "start"-button as primary. More...
 
 getStartControl ()
 
 getAdditionalJS ()
 
- Public Member Functions inherited from ILIAS\KioskMode\ControlBuilder
 exit (string $command)
 An exit control allows the user to gracefully leave the object providing the kiosk mode. More...
 
 next (string $command, int $parameter=null)
 A next control allows the user to progress to the next item in the object. More...
 
 previous (string $command, int $parameter=null)
 A previous control allows the user to go back to the previous item in the object. More...
 
 done (string $command, int $parameter=null)
 A done control allows the user to mark the object as done. More...
 
 generic (string $label, string $command, int $parameter=null)
 A generic control needs to have a label that tells what it does. More...
 
 genericWithSignal (string $label, UI\Component\Signal $signal)
 A genericWithSignal will trigger the Signal rather than refreshing the View. More...
 
 toggle (string $label, string $on_command, string $off_command)
 A toggle can be used to switch some behaviour in the view on or of. More...
 
 mode (string $command, array $labels)
 A mode control can be used to switch between different modes in the view. More...
 
 locator (string $command)
 A locator allows the user to see the path leading to her current location and jump back to previous items on that path. More...
 
 tableOfContent (string $label, string $command, int $parameter=null, $state=null)
 A table of content allows the user to get an overview over the generally available content in the object. More...
 

Data Fields

const CMD_START_OBJECT = 'start_legacy_obj'
 
const CMD_CHECK_CURRENT_ITEM_LP = 'ccilp'
 

Protected Member Functions

 setListenerJS (string $check_lp_url, string $on_lp_change_url)
 

Protected Attributes

 $exit_control
 
 $previous_control
 
 $next_control
 
 $done_control
 
 $controls = []
 
 $toggles = []
 
 $mode_controls = []
 
 $toc
 
 $loc
 
 $ui_factory
 
 $url_builder
 
 $start
 
 $additional_js
 
 $global_settings
 

Detailed Description

Class LSControlBuilder.

Definition at line 16 of file LSControlBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

LSControlBuilder::__construct ( Factory  $ui_factory,
LSURLBuilder  $url_builder,
ilLanguage  $language,
LSGlobalSettings  $global_settings 
)

Definition at line 91 of file LSControlBuilder.php.

96 {
97 $this->ui_factory = $ui_factory;
98 $this->url_builder = $url_builder;
99 $this->lng = $language;
100 $this->global_settings = $global_settings;
101 }

References $global_settings, $ui_factory, and $url_builder.

Member Function Documentation

◆ done()

LSControlBuilder::done ( string  $command,
int  $parameter = null 
)

A done control allows the user to mark the object as done.The $parameter can be used to pass additional information to View::updateGet if required, e.g. about a chapter in the content.

Exceptions

LogicException if view wants to introduce a second done button.

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 212 of file LSControlBuilder.php.

213 {
214 if ($this->done_control) {
215 throw new \LogicException("Only one done-control per view...", 1);
216 }
217 $label = $this->lng->txt('lso_player_done');
218 $cmd = $this->url_builder->getHref($command, $parameter);
219 $btn = $this->ui_factory->button()->primary($label, $cmd);
220 $this->done_control = $btn;
221 return $this;
222 }
Build controls for the view.

◆ exit()

LSControlBuilder::exit ( string  $command)

An exit control allows the user to gracefully leave the object providing the kiosk mode.

Exceptions

LogicException if view wants to introduce a second exit button.

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 151 of file LSControlBuilder.php.

152 {
153 if ($this->exit_control) {
154 throw new \LogicException("Only one exit-control per view...", 1);
155 }
156 $cmd = $this->url_builder->getHref($command);
157
158 $label = 'lso_player_suspend';
159 if ($command === ilLSPlayer::LSO_CMD_FINISH) {
160 $label = 'lso_player_finish';
161 }
162
163 $exit_button = $this->ui_factory->button()->bulky(
164 $this->ui_factory->symbol()->glyph()->close(),
165 $this->lng->txt($label),
166 $cmd
167 );
168
169 $this->exit_control = $exit_button;
170 return $this;
171 }
const LSO_CMD_FINISH

References ilLSPlayer\LSO_CMD_FINISH.

Referenced by ilLSPlayer\buildDefaultControls().

+ Here is the caller graph for this function:

◆ generic()

LSControlBuilder::generic ( string  $label,
string  $command,
int  $parameter = null 
)

A generic control needs to have a label that tells what it does.The $parameter can be used to pass additional information to View::updateGet if required, e.g. about a chapter in the content.

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 227 of file LSControlBuilder.php.

228 {
229 $cmd = $this->url_builder->getHref($command, $parameter);
230 $this->controls[] = $this->ui_factory->button()->standard($label, $cmd);
231 return $this;
232 }

◆ genericWithSignal()

LSControlBuilder::genericWithSignal ( string  $label,
Signal  $signal 
)

Definition at line 234 of file LSControlBuilder.php.

235 {
236 $this->controls[] = $this->ui_factory->button()->standard($label, '')
237 ->withOnClick($signal);
238 return $this;
239 }

◆ getAdditionalJS()

LSControlBuilder::getAdditionalJS ( )

Definition at line 334 of file LSControlBuilder.php.

334 : string
335 {
337 }

◆ getControls()

LSControlBuilder::getControls ( )

Definition at line 133 of file LSControlBuilder.php.

133 : array
134 {
135 return $this->controls;
136 }

References $controls.

◆ getDoneControl()

LSControlBuilder::getDoneControl ( )

Definition at line 118 of file LSControlBuilder.php.

119 {
120 return $this->done_control;
121 }

References $done_control.

Referenced by ilKioskPageRenderer\render().

+ Here is the caller graph for this function:

◆ getExitControl()

LSControlBuilder::getExitControl ( )

Definition at line 103 of file LSControlBuilder.php.

104 {
105 return $this->exit_control;
106 }

References $exit_control.

◆ getLocator()

LSControlBuilder::getLocator ( )

Definition at line 138 of file LSControlBuilder.php.

139 {
140 return $this->loc;
141 }

References $loc.

◆ getModeControls()

LSControlBuilder::getModeControls ( )

Definition at line 128 of file LSControlBuilder.php.

129 {
131 }

References $mode_controls.

◆ getNextControl()

LSControlBuilder::getNextControl ( )

Definition at line 113 of file LSControlBuilder.php.

114 {
115 return $this->next_control;
116 }

References $next_control.

◆ getPreviousControl()

LSControlBuilder::getPreviousControl ( )

Definition at line 108 of file LSControlBuilder.php.

109 {
111 }

References $previous_control.

◆ getStartControl()

LSControlBuilder::getStartControl ( )

Definition at line 329 of file LSControlBuilder.php.

330 {
331 return $this->start;
332 }

◆ getToc()

LSControlBuilder::getToc ( )

Definition at line 143 of file LSControlBuilder.php.

144 {
145 return $this->toc;
146 }

References $toc.

◆ getToggles()

LSControlBuilder::getToggles ( )

Definition at line 123 of file LSControlBuilder.php.

124 {
125 return $this->toggles;
126 }

References $toggles.

◆ locator()

LSControlBuilder::locator ( string  $command)

A locator allows the user to see the path leading to her current location and jump back to previous items on that path.The command will be enhanced with a parameter defined in the locator builder.

Exceptions

LogicException if view wants to introduce a second locator.

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 270 of file LSControlBuilder.php.

271 {
272 if ($this->loc) {
273 throw new \LogicException("Only one locator per view...", 1);
274 }
275 $this->loc = new LSLocatorBuilder($command, $this);
276 return $this->loc;
277 }
Class LSTOCBuilder.
Build a locator for the view.

References $loc.

◆ mode()

LSControlBuilder::mode ( string  $command,
array  $labels 
)

A mode control can be used to switch between different modes in the view.Uses the indizes of the labels in the array as parameter for the command.

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 257 of file LSControlBuilder.php.

258 {
259 $actions = [];
260 foreach ($labels as $parameter => $label) {
261 $actions[$label] = $this->url_builder->getHref($command, $parameter);
262 }
263 $this->mode_controls[] = $this->ui_factory->viewControl()->mode($actions, '');
264 return $this;
265 }
mode(string $command, array $labels)
A mode control can be used to switch between different modes in the view.

References ILIAS\KioskMode\ControlBuilder\mode().

+ Here is the call graph for this function:

◆ next()

LSControlBuilder::next ( string  $command,
int  $parameter = null 
)

A next control allows the user to progress to the next item in the object.The $parameter can be used to pass additional information to View::updateGet if required, e.g. about a chapter in the content.

Exceptions

LogicException if view wants to introduce a second next button.

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 176 of file LSControlBuilder.php.

177 {
178 if ($this->next_control) {
179 throw new \LogicException("Only one next-control per view...", 1);
180 }
181 $label = $this->lng->txt('lso_player_next');
182 $cmd = $this->url_builder->getHref($command, $parameter);
183 $btn = $this->ui_factory->button()->standard($label, $cmd);
184 if ($command === '') {
185 $btn = $btn->withUnavailableAction();
186 }
187 $this->next_control = $btn;
188 return $this;
189 }

◆ previous()

LSControlBuilder::previous ( string  $command,
int  $parameter = null 
)

A previous control allows the user to go back to the previous item in the object.The $parameter can be used to pass additional information to View::updateGet if required, e.g. about a chapter in the content.

Exceptions

LogicException if view wants to introduce a second previous button.

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 194 of file LSControlBuilder.php.

195 {
196 if ($this->previous_control) {
197 throw new \LogicException("Only one previous-control per view...", 1);
198 }
199 $label = $this->lng->txt('lso_player_previous');
200 $cmd = $this->url_builder->getHref($command, $parameter);
201 $btn = $this->ui_factory->button()->standard($label, $cmd);
202 if ($command === '') {
203 $btn = $btn->withUnavailableAction();
204 }
205 $this->previous_control = $btn;
206 return $this;
207 }

◆ setListenerJS()

LSControlBuilder::setListenerJS ( string  $check_lp_url,
string  $on_lp_change_url 
)
protected

Definition at line 339 of file LSControlBuilder.php.

342 {
343 $this->additional_js =
344<<<JS
345function lso_checkLPOfObject()
346{
347 if(! il.UICore.isPageVisible()) {
348 return;
349 }
350
351 $.ajax({
352 url: "$check_lp_url",
353 }).done(function(data) {
354 if(window._lso_current_item_lp === -1) {
355 window._lso_current_item_lp = data;
356 }
357 if (window._lso_current_item_lp !== data) {
358 location.replace('$on_lp_change_url');
359 }
360 });
361}
362JS;
363 }
done(string $command, int $parameter=null)
A done control allows the user to mark the object as done.The $parameter can be used to pass addition...
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12

References if.

◆ start()

LSControlBuilder::start ( string  $label,
string  $url,
int  $parameter = null 
)

Add a "start"-button as primary.

This is NOT regular behavior, but a special feature for the LegacyView of LearningSequence's sub-objects that do not implement a KioskModeView.

The start-control is exclusively used to open an ILIAS-Object in a new windwow/tab.

Definition at line 302 of file LSControlBuilder.php.

303 {
304 if ($this->start) {
305 throw new \LogicException("Only one start-control per view...", 1);
306 }
307 $this_cmd = $this->url_builder->getHref(self::CMD_START_OBJECT, $parameter);
308 $lp_cmd = str_replace(
309 '&cmd=view&',
310 '&cmd=' . self::CMD_CHECK_CURRENT_ITEM_LP . '&',
311 $this_cmd
312 );
313
314 $this->setListenerJS($lp_cmd, $this_cmd);
315 $this->start = $this->ui_factory->button()
316 ->primary($label, '')
317 ->withOnLoadCode(function ($id) use ($url) {
318 $interval = $this->global_settings->getPollingIntervalMilliseconds();
319 return "$('#{$id}').on('click', function(ev) {
320 var il_ls_win = window.open('$url');
321 window._lso_current_item_lp = -1;
322 window.setInterval(lso_checkLPOfObject, $interval);
323 })";
324 });
325
326 return $this;
327 }
start(string $label, string $url, int $parameter=null)
Add a "start"-button as primary.
setListenerJS(string $check_lp_url, string $on_lp_change_url)
$url

References $url.

◆ tableOfContent()

LSControlBuilder::tableOfContent ( string  $label,
string  $command,
int  $parameter = null,
  $state = null 
)

A table of content allows the user to get an overview over the generally available content in the object.The command will be enhanced with a parameter defined here on in the locator builder.If a parameter is defined here, the view provides an overview-page.

Exceptions

LogicException if view wants to introduce a second TOC.

Parameters
mixed$stateone of the STATE_ constants from TOCBuilder

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 282 of file LSControlBuilder.php.

287 : TOCBuilder {
288 if ($this->toc) {
289 throw new \LogicException("Only one ToC per view...", 1);
290 }
291 $this->toc = new LSTOCBuilder($this, $command, $label, $parameter, $state);
292 return $this->toc;
293 }
Class LSTOCBuilder.
Build a nested table of contents for the view.
Definition: TOCBuilder.php:12

◆ toggle()

LSControlBuilder::toggle ( string  $label,
string  $on_command,
string  $off_command 
)

A toggle can be used to switch some behaviour in the view on or of.

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 244 of file LSControlBuilder.php.

245 {
246 throw new \Exception("NYI: Toggles", 1);
247
248 $cmd_on = $this->url_builder->getHref($on_command, 0);
249 $cmd_off = $this->url_builder->getHref($off_command, 0);
250 //build toggle and add to $this->toggles
251 //return $this;
252 }

Field Documentation

◆ $additional_js

LSControlBuilder::$additional_js
protected

Definition at line 84 of file LSControlBuilder.php.

◆ $controls

LSControlBuilder::$controls = []
protected

Definition at line 44 of file LSControlBuilder.php.

Referenced by getControls().

◆ $done_control

LSControlBuilder::$done_control
protected

Definition at line 39 of file LSControlBuilder.php.

Referenced by getDoneControl().

◆ $exit_control

LSControlBuilder::$exit_control
protected

Definition at line 24 of file LSControlBuilder.php.

Referenced by getExitControl().

◆ $global_settings

LSControlBuilder::$global_settings
protected

Definition at line 89 of file LSControlBuilder.php.

Referenced by __construct().

◆ $loc

LSControlBuilder::$loc
protected

Definition at line 64 of file LSControlBuilder.php.

Referenced by getLocator(), and locator().

◆ $mode_controls

LSControlBuilder::$mode_controls = []
protected

Definition at line 54 of file LSControlBuilder.php.

Referenced by getModeControls().

◆ $next_control

LSControlBuilder::$next_control
protected

Definition at line 34 of file LSControlBuilder.php.

Referenced by getNextControl().

◆ $previous_control

LSControlBuilder::$previous_control
protected

Definition at line 29 of file LSControlBuilder.php.

Referenced by getPreviousControl().

◆ $start

LSControlBuilder::$start
protected

Definition at line 79 of file LSControlBuilder.php.

◆ $toc

LSControlBuilder::$toc
protected

Definition at line 59 of file LSControlBuilder.php.

Referenced by getToc().

◆ $toggles

LSControlBuilder::$toggles = []
protected

Definition at line 49 of file LSControlBuilder.php.

Referenced by getToggles().

◆ $ui_factory

LSControlBuilder::$ui_factory
protected

Definition at line 69 of file LSControlBuilder.php.

Referenced by __construct().

◆ $url_builder

LSControlBuilder::$url_builder
protected

Definition at line 74 of file LSControlBuilder.php.

Referenced by __construct().

◆ CMD_CHECK_CURRENT_ITEM_LP

const LSControlBuilder::CMD_CHECK_CURRENT_ITEM_LP = 'ccilp'

Definition at line 19 of file LSControlBuilder.php.

Referenced by ilObjLearningSequenceLearnerGUI\executeCommand().

◆ CMD_START_OBJECT

const LSControlBuilder::CMD_START_OBJECT = 'start_legacy_obj'

Definition at line 18 of file LSControlBuilder.php.


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