19declare(strict_types=1);
72 $this->
lng = $language;
133 if ($this->exit_control) {
134 throw new \LogicException(
"Only one exit-control per view...", 1);
136 $cmd = $this->url_builder->getHref($command);
138 $label =
'lso_player_suspend';
140 $label =
'lso_player_finish';
143 $exit_button = $this->ui_factory->button()->bulky(
144 $this->ui_factory->symbol()->glyph()->close(),
145 $this->lng->txt($label),
149 $this->exit_control = $exit_button;
155 if ($this->next_control) {
156 throw new \LogicException(
"Only one next-control per view...", 1);
158 $label = $this->
lng->txt(
'lso_player_next');
159 $cmd = $this->url_builder->getHref($command, $parameter);
160 $btn = $this->ui_factory->button()->standard($label, $cmd);
161 if ($command ===
'') {
162 $btn = $btn->withUnavailableAction();
164 $this->next_control = $btn;
170 if ($this->previous_control) {
171 throw new \LogicException(
"Only one previous-control per view...", 1);
173 $label = $this->
lng->txt(
'lso_player_previous');
174 $cmd = $this->url_builder->getHref($command, $parameter);
175 $btn = $this->ui_factory->button()->standard($label, $cmd);
176 if ($command ===
'') {
177 $btn = $btn->withUnavailableAction();
179 $this->previous_control = $btn;
185 if ($this->done_control) {
186 throw new \LogicException(
"Only one done-control per view...", 1);
188 $label = $this->
lng->txt(
'lso_player_done');
189 $cmd = $this->url_builder->getHref($command, $parameter);
190 $btn = $this->ui_factory->button()->primary($label, $cmd);
191 $this->done_control = $btn;
195 public function generic(
string $label,
string $command, ?
int $parameter =
null):
ControlBuilder
197 $cmd = $this->url_builder->getHref($command, $parameter);
198 $this->controls[] = $this->ui_factory->button()->standard($label, $cmd);
204 $this->controls[] = $this->ui_factory->button()->standard($label,
'')
205 ->withOnClick($signal);
211 throw new \Exception(
"NYI: Toggles", 1);
217 foreach ($labels as $parameter => $label) {
218 $actions[$label] = $this->url_builder->getHref($command, $parameter);
220 $this->mode_controls[] = $this->ui_factory->viewControl()->
mode($actions,
'');
227 throw new \LogicException(
"Only one locator per view...", 1);
236 ?
int $parameter =
null,
240 throw new \LogicException(
"Only one ToC per view...", 1);
242 $this->toc =
new LSTOCBuilder($this, $command, $label, $parameter, $state);
256 throw new \LogicException(
"Only one start-control per view...", 1);
259 $this_cmd = $this->url_builder->getHref(self::CMD_START_OBJECT, 0);
260 $lp_cmd = $this->lp_url_builder->getHref(self::CMD_CHECK_CURRENT_ITEM_LP, $obj_id);
262 $this->setListenerJS($lp_cmd, $this_cmd);
263 $this->start = $this->ui_factory->button()
264 ->primary($label,
'')
265 ->withOnLoadCode(
function (
$id) use (
$url) {
266 $interval = $this->global_settings->getPollingIntervalMilliseconds();
267 return "$('#$id').on('click', function(ev) {
268 var _lso_win = window.open('$url');
270 window._lso_current_item_lp = -1;
271 window.setInterval(lso_checkLPOfObject, $interval);
285 return $this->additional_js;
289 string $check_lp_url,
290 string $on_lp_change_url
292 $this->additional_js =
294function lso_checkLPOfObject()
296 if(! il.UICore.isPageVisible()) {
301 url:
"$check_lp_url",
302 }).done(
function(data) {
303 if(window._lso_current_item_lp === -1) {
304 window._lso_current_item_lp = data;
306 if (window._lso_current_item_lp !== data) {
307 location.replace(
'$on_lp_change_url');
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Builds a Color from either hex- or rgb values.
JavaScriptBindable $start
done(string $command, ?int $parameter=null)
A done control allows the user to mark the object as done.
LSURLBuilder $lp_url_builder
previous(string $command, ?int $parameter=null)
A previous control allows the user to go back to the previous item in the object.
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.
next(string $command, ?int $parameter=null)
A next control allows the user to progress to the next item in the object.
locator(string $command)
A locator allows the user to see the path leading to her current location and jump back to previous i...
Component $previous_control
LSURLBuilder $url_builder
setListenerJS(string $check_lp_url, string $on_lp_change_url)
genericWithSignal(string $label, Signal $signal)
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...
start(string $label, string $url, int $obj_id)
Add a "start"-button as primary.
toggle(string $label, string $on_command, string $off_command)
A toggle can be used to switch some behaviour in the view on or of.
LSGlobalSettings $global_settings
__construct(Factory $ui_factory, LSURLBuilder $url_builder, ilLanguage $language, LSGlobalSettings $global_settings, LSURLBuilder $lp_url_builder)
Global Settings of the Learning Sequence.
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.
A component is the most general form of an entity in the UI.
Interface to be extended by components that have the possibility to bind to Javascript.
This is how the factory for UI elements looks.
trait JavaScriptBindable
Trait for components implementing JavaScriptBindable providing standard implementation.
if(!file_exists('../ilias.ini.php'))