ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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
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
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
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
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...
 
 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
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
More...
 
 start (string $label, string $url, int $parameter=null)
 Add a "start"-button as primary. More...
 
 getStartControl ()
 
 getAdditionalJS ()
 

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 15 of file LSControlBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 90 of file LSControlBuilder.php.

References $global_settings, $ui_factory, and $url_builder.

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

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

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 211 of file LSControlBuilder.php.

Referenced by setListenerJS().

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

◆ exit()

LSControlBuilder::exit ( string  $command)

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

Exceptions

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 150 of file LSControlBuilder.php.

References ilLSPlayer\LSO_CMD_FINISH.

Referenced by ilLSPlayer\buildDefaultControls().

151  {
152  if ($this->exit_control) {
153  throw new \LogicException("Only one exit-control per view...", 1);
154  }
155  $cmd = $this->url_builder->getHref($command);
156 
157  $label = 'lso_player_suspend';
158  if ($command === ilLSPlayer::LSO_CMD_FINISH) {
159  $label = 'lso_player_finish';
160  }
161 
162  $exit_button = $this->ui_factory->button()->bulky(
163  $this->ui_factory->symbol()->glyph()->close(),
164  $this->lng->txt($label),
165  $cmd
166  );
167 
168  $this->exit_control = $exit_button;
169  return $this;
170  }
const LSO_CMD_FINISH
Build controls for the view.
+ 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 226 of file LSControlBuilder.php.

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

◆ getAdditionalJS()

LSControlBuilder::getAdditionalJS ( )

Definition at line 326 of file LSControlBuilder.php.

References $additional_js.

Referenced by ilKioskPageRenderer\render().

326  : string
327  {
328  return $this->additional_js;
329  }
+ Here is the caller graph for this function:

◆ getControls()

LSControlBuilder::getControls ( )

Definition at line 132 of file LSControlBuilder.php.

References $controls.

Referenced by ilKioskPageRenderer\render().

132  : array
133  {
134  return $this->controls;
135  }
+ Here is the caller graph for this function:

◆ getDoneControl()

LSControlBuilder::getDoneControl ( )

Definition at line 117 of file LSControlBuilder.php.

References $done_control.

Referenced by ilKioskPageRenderer\render().

118  {
119  return $this->done_control;
120  }
+ Here is the caller graph for this function:

◆ getExitControl()

LSControlBuilder::getExitControl ( )

Definition at line 102 of file LSControlBuilder.php.

References $exit_control.

Referenced by ilLSPlayer\buildDefaultControls().

103  {
104  return $this->exit_control;
105  }
+ Here is the caller graph for this function:

◆ getLocator()

LSControlBuilder::getLocator ( )

Definition at line 137 of file LSControlBuilder.php.

References $loc.

Referenced by ilKioskPageRenderer\render().

138  {
139  return $this->loc;
140  }
+ Here is the caller graph for this function:

◆ getModeControls()

LSControlBuilder::getModeControls ( )

Definition at line 127 of file LSControlBuilder.php.

References $mode_controls.

Referenced by ilKioskPageRenderer\render().

128  {
129  return $this->mode_controls;
130  }
+ Here is the caller graph for this function:

◆ getNextControl()

LSControlBuilder::getNextControl ( )

Definition at line 112 of file LSControlBuilder.php.

References $next_control.

Referenced by ilLSPlayer\buildDefaultControls(), and ilKioskPageRenderer\render().

113  {
114  return $this->next_control;
115  }
+ Here is the caller graph for this function:

◆ getPreviousControl()

LSControlBuilder::getPreviousControl ( )

Definition at line 107 of file LSControlBuilder.php.

References $previous_control.

Referenced by ilLSPlayer\buildDefaultControls(), and ilKioskPageRenderer\render().

108  {
110  }
+ Here is the caller graph for this function:

◆ getStartControl()

LSControlBuilder::getStartControl ( )

Definition at line 321 of file LSControlBuilder.php.

References $start.

Referenced by ilKioskPageRenderer\render().

322  {
323  return $this->start;
324  }
+ Here is the caller graph for this function:

◆ getToc()

LSControlBuilder::getToc ( )

Definition at line 142 of file LSControlBuilder.php.

References $toc.

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

◆ getToggles()

LSControlBuilder::getToggles ( )

Definition at line 122 of file LSControlBuilder.php.

References $toggles.

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

◆ 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

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 262 of file LSControlBuilder.php.

References $loc.

263  {
264  if ($this->loc) {
265  throw new \LogicException("Only one locator per view...", 1);
266  }
267  $this->loc = new LSLocatorBuilder($command, $this);
268  return $this->loc;
269  }
Class LSTOCBuilder.
Build a locator for the view.

◆ 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 249 of file LSControlBuilder.php.

References ILIAS\KioskMode\ControlBuilder\mode().

250  {
251  $actions = [];
252  foreach ($labels as $parameter => $label) {
253  $actions[$label] = $this->url_builder->getHref($command, $parameter);
254  }
255  $this->mode_controls[] = $this->ui_factory->viewControl()->mode($actions, '');
256  return $this;
257  }
mode(string $command, array $labels)
A mode control can be used to switch between different modes in the view.
Build controls for the view.
+ 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

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 175 of file LSControlBuilder.php.

Referenced by ilLSPlayer\buildDefaultControls().

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

◆ 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

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 193 of file LSControlBuilder.php.

Referenced by ilLSPlayer\buildDefaultControls().

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

◆ setListenerJS()

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

Definition at line 331 of file LSControlBuilder.php.

References done(), and if.

Referenced by start().

334  {
335  $this->additional_js =
336 <<<JS
337 function lso_checkLPOfObject()
338 {
339  if(! il.UICore.isPageVisible()) {
340  return;
341  }
342 
343  $.ajax({
344  url: "$check_lp_url",
345  }).done(function(data) {
346  if(window._lso_current_item_lp === -1) {
347  window._lso_current_item_lp = data;
348  }
349  if (window._lso_current_item_lp !== data) {
350  location.replace('$on_lp_change_url');
351  }
352  });
353 }
354 JS;
355  }
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12
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...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 294 of file LSControlBuilder.php.

References setListenerJS().

295  {
296  if ($this->start) {
297  throw new \LogicException("Only one start-control per view...", 1);
298  }
299  $this_cmd = $this->url_builder->getHref(self::CMD_START_OBJECT, $parameter);
300  $lp_cmd = str_replace(
301  '&cmd=view&',
302  '&cmd=' . self::CMD_CHECK_CURRENT_ITEM_LP . '&',
303  $this_cmd
304  );
305 
306  $this->setListenerJS($lp_cmd, $this_cmd);
307  $this->start = $this->ui_factory->button()
308  ->primary($label, '')
309  ->withOnLoadCode(function ($id) use ($url) {
310  $interval = $this->global_settings->getPollingIntervalMilliseconds();
311  return "$('#{$id}').on('click', function(ev) {
312  var il_ls_win = window.open('$url');
313  window._lso_current_item_lp = -1;
314  window.setInterval(lso_checkLPOfObject, $interval);
315  })";
316  });
317 
318  return $this;
319  }
setListenerJS(string $check_lp_url, string $on_lp_change_url)
start(string $label, string $url, int $parameter=null)
Add a "start"-button as primary.
Build controls for the view.
$url
+ Here is the call graph for this function:

◆ 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

Implements ILIAS\KioskMode\ControlBuilder.

Definition at line 274 of file LSControlBuilder.php.

References $toc.

279  : TOCBuilder {
280  if ($this->toc) {
281  throw new \LogicException("Only one ToC per view...", 1);
282  }
283  $this->toc = new LSTOCBuilder($this, $command, $label, $parameter, $state);
284  return $this->toc;
285  }
Build a nested table of contents for the view.
Definition: TOCBuilder.php:11
Class LSTOCBuilder.

◆ 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 236 of file LSControlBuilder.php.

237  {
238  throw new \Exception("NYI: Toggles", 1);
239 
240  $cmd_on = $this->url_builder->getHref($on_command, 0);
241  $cmd_off = $this->url_builder->getHref($off_command, 0);
242  //build toggle and add to $this->toggles
243  //return $this;
244  }
Build controls for the view.

Field Documentation

◆ $additional_js

LSControlBuilder::$additional_js
protected

Definition at line 83 of file LSControlBuilder.php.

Referenced by getAdditionalJS().

◆ $controls

LSControlBuilder::$controls = []
protected

Definition at line 43 of file LSControlBuilder.php.

Referenced by getControls().

◆ $done_control

LSControlBuilder::$done_control
protected

Definition at line 38 of file LSControlBuilder.php.

Referenced by getDoneControl().

◆ $exit_control

LSControlBuilder::$exit_control
protected

Definition at line 23 of file LSControlBuilder.php.

Referenced by getExitControl().

◆ $global_settings

LSControlBuilder::$global_settings
protected

Definition at line 88 of file LSControlBuilder.php.

Referenced by __construct().

◆ $loc

LSControlBuilder::$loc
protected

Definition at line 63 of file LSControlBuilder.php.

Referenced by getLocator(), and locator().

◆ $mode_controls

LSControlBuilder::$mode_controls = []
protected

Definition at line 53 of file LSControlBuilder.php.

Referenced by getModeControls().

◆ $next_control

LSControlBuilder::$next_control
protected

Definition at line 33 of file LSControlBuilder.php.

Referenced by getNextControl().

◆ $previous_control

LSControlBuilder::$previous_control
protected

Definition at line 28 of file LSControlBuilder.php.

Referenced by getPreviousControl().

◆ $start

LSControlBuilder::$start
protected

Definition at line 78 of file LSControlBuilder.php.

Referenced by getStartControl().

◆ $toc

LSControlBuilder::$toc
protected

Definition at line 58 of file LSControlBuilder.php.

Referenced by getToc(), and tableOfContent().

◆ $toggles

LSControlBuilder::$toggles = []
protected

Definition at line 48 of file LSControlBuilder.php.

Referenced by getToggles().

◆ $ui_factory

LSControlBuilder::$ui_factory
protected

Definition at line 68 of file LSControlBuilder.php.

Referenced by __construct().

◆ $url_builder

LSControlBuilder::$url_builder
protected

Definition at line 73 of file LSControlBuilder.php.

Referenced by __construct().

◆ CMD_CHECK_CURRENT_ITEM_LP

const LSControlBuilder::CMD_CHECK_CURRENT_ITEM_LP = 'ccilp'

Definition at line 18 of file LSControlBuilder.php.

Referenced by ilObjLearningSequenceLearnerGUI\executeCommand().

◆ CMD_START_OBJECT

const LSControlBuilder::CMD_START_OBJECT = 'start_legacy_obj'

Definition at line 17 of file LSControlBuilder.php.


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