3declare(strict_types=1);
153 if ($this->exit_control) {
154 throw new \LogicException(
"Only one exit-control per view...", 1);
156 $cmd = $this->url_builder->getHref($command);
158 $label =
'lso_player_suspend';
160 $label =
'lso_player_finish';
163 $exit_button = $this->ui_factory->button()->shy(
164 $this->lng->txt($label),
168 $this->exit_control = $exit_button;
177 if ($this->next_control) {
178 throw new \LogicException(
"Only one next-control per view...", 1);
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();
186 $this->next_control = $btn;
195 if ($this->previous_control) {
196 throw new \LogicException(
"Only one previous-control per view...", 1);
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();
204 $this->previous_control = $btn;
213 if ($this->done_control) {
214 throw new \LogicException(
"Only one done-control per view...", 1);
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;
226 public function generic(
string $label,
string $command,
int $parameter =
null) :
ControlBuilder
228 $cmd = $this->url_builder->getHref($command, $parameter);
229 $this->controls[] = $this->ui_factory->button()->standard($label, $cmd);
238 throw new \Exception(
"NYI: Toggles", 1);
240 $cmd_on = $this->url_builder->getHref($on_command, 0);
241 $cmd_off = $this->url_builder->getHref($off_command, 0);
252 foreach ($labels as $parameter => $label) {
253 $actions[$label] = $this->url_builder->getHref($command, $parameter);
255 $this->mode_controls[] = $this->ui_factory->viewControl()->
mode($actions,
'');
265 throw new \LogicException(
"Only one locator per view...", 1);
277 int $parameter =
null,
281 throw new \LogicException(
"Only one ToC per view...", 1);
297 throw new \LogicException(
"Only one start-control per view...", 1);
300 $this_cmd = $this->url_builder->getHref(self::CMD_START_OBJECT, 0);
301 $lp_cmd = str_replace(
303 '&cmd=' . self::CMD_CHECK_CURRENT_ITEM_LP .
'&',
307 $current_obj_id = $parameter;
308 $lp_cmd .=
'&' . self::PARAM_LP_CURRENT_ITEM_OBJID .
'=' . $current_obj_id;
310 $signal = $this->getStartSignal();
311 $this->setListenerJS($signal->getId(),
$url, $lp_cmd, $this_cmd);
313 $this->start = $this->ui_factory->button()
314 ->primary($label,
'')
315 ->withOnClick($signal);
341 return $this->additional_js;
347 string $check_lp_url,
348 string $on_lp_change_url
350 $interval = $this->global_settings->getPollingIntervalMilliseconds();
351 $this->additional_js =
353function lso_checkLPOfObject() {
355 url:
"$check_lp_url",
356 }).done(
function(
data) {
357 if(window._lso_current_item_lp === -1) {
358 window._lso_current_item_lp = data;
360 if (window._lso_current_item_lp !==
data) {
361 location.replace(
'$on_lp_change_url');
366$(document).on(
'{$signal_id}',
function() {
367 var il_ls_win = window.open(
'$new_win_url');
369window._lso_current_item_lp = -1;
370lso_checkLPOfObject();
371window.setInterval(lso_checkLPOfObject, $interval);
if(!array_key_exists('stateid', $_REQUEST)) $state
Handle linkback() response from LinkedIn.
An exception for terminatinating execution or to throw for unit testing.
const PARAM_LP_CURRENT_ITEM_OBJID
__construct(Factory $ui_factory, LSURLBuilder $url_builder, ilLanguage $language, LSGlobalSettings $global_settings)
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 obj...
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...
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 b...
getStartSignal()
This is a hack and not supposed to be considered as a common way to inject JS-Code and bind it to a b...
exit(string $command)
An exit control allows the user to gracefully leave the object providing the kiosk mode....
const CMD_CHECK_CURRENT_ITEM_LP
mode(string $command, array $labels)
A mode control can be used to switch between different modes in the view.Uses the indizes of the labe...
locator(string $command)
A locator allows the user to see the path leading to her current location and jump back to previous i...
start(string $label, string $url, int $parameter=null)
Add a "start"-button as primary.
setListenerJS(string $signal_id, string $new_win_url, string $check_lp_url, string $on_lp_change_url)
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 ...
toggle(string $label, string $on_command, string $off_command)
A toggle can be used to switch some behaviour in the view on or of.
Global Settings of the Learning Sequence.
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
if(!array_key_exists('StateId', $_REQUEST)) $id
Build controls for the view.
mode(string $command, array $labels)
A mode control can be used to switch between different modes in the view.
Build a locator for the view.
Build a nested table of contents for the view.
The URLBuilder allows views to get links that are used somewhere inline in the content.
This is how the factory for UI elements looks.