ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\UI\examples\Button\Standard Namespace Reference

Functions

 base ()
 

description: > Example for rendering a standard button. More...

 
 engaged ()
 

description: > Example for rendering an engaged standard button More...

 
 unavailable_action ()
 

description: > This example provides the given button with an unavailable action. More...

 
 with_glyph ()
 

description: > This example provides buttons with a Glyph in (and as) the label. More...

 
 with_js_binding ()
 

description: > Example for rendering a standard button with JS binding More...

 
 with_load_anim ()
 

description: > In this example we create a button that ships with the on load animation on click. More...

 
 with_tooltip ()
 

description: > Example for rendering a standard button with tooltips More...

 

Function Documentation

◆ base()

ILIAS\UI\examples\Button\Standard\base ( )


description: > Example for rendering a standard button.

expected output: > ILIAS shows a colored, active button with a title. Clicking the button opens the website www.ilias.de

in the same browser window.

Definition at line 33 of file base.php.

References $DIC, Vendor\Package\$f, and $renderer.

34 {
35  global $DIC;
36  $f = $DIC->ui()->factory();
37  $renderer = $DIC->ui()->renderer();
38 
39  return $renderer->render($f->button()->standard("Goto ILIAS", "http://www.ilias.de"));
40 }
$renderer
global $DIC
Definition: shib_login.php:22

◆ engaged()

ILIAS\UI\examples\Button\Standard\engaged ( )


description: > Example for rendering an engaged standard button

expected output: >

ILIAS shows a white, active button with a title. Clicking the button won't activate any actions.

Definition at line 32 of file engaged.php.

References $DIC, Vendor\Package\$f, and $renderer.

33 {
34  global $DIC;
35  $f = $DIC->ui()->factory();
36  $renderer = $DIC->ui()->renderer();
37 
38  $button = $f->button()->standard("Engaged Button", "#")
39  ->withEngagedState(true);
40  return $renderer->render($button);
41 }
$renderer
global $DIC
Definition: shib_login.php:22

◆ unavailable_action()

ILIAS\UI\examples\Button\Standard\unavailable_action ( )


description: > This example provides the given button with an unavailable action.

Note that the disabled attribute is set in the DOM. No action must be fired, even if done by keyboard.

expected output: >

ILIAS shows a inactive button with a title. Clicking the button won't activate any actions.

Definition at line 34 of file unavailable_action.php.

References $DIC, Vendor\Package\$f, and $renderer.

35 {
36  global $DIC;
37  $f = $DIC->ui()->factory();
38  $renderer = $DIC->ui()->renderer();
39 
40  $button = $f->button()->standard('Unavailable', '#')->withUnavailableAction();
41 
42  return $renderer->render([$button]);
43 }
$renderer
global $DIC
Definition: shib_login.php:22

◆ with_glyph()

ILIAS\UI\examples\Button\Standard\with_glyph ( )


description: > This example provides buttons with a Glyph in (and as) the label.

expected output: > ILIAS shows a button with the Search Gylph and in some cases a label in different states. Clicking the button

won't activate any actions.

Definition at line 33 of file with_glyph.php.

References $DIC, Vendor\Package\$f, and $renderer.

34 {
35  global $DIC;
36  $f = $DIC->ui()->factory();
37  $renderer = $DIC->ui()->renderer();
38 
39  $glyph = $f->symbol()->glyph()->search();
40  $button = $f->button()->standard('search', '#')
41  ->withSymbol($glyph);
42  $button2 = $button->withLabel('')
43  ->withAriaLabel('search');
44 
45  return $renderer->render([
46  $button,
47  $button->withEngagedState(true),
48  $button->withUnavailableAction(true),
49  $f->divider()->vertical(),
50  $button2,
51  $button2->withEngagedState(true),
52  $button2->withUnavailableAction(true),
53 
54  ]);
55 }
$renderer
global $DIC
Definition: shib_login.php:22

◆ with_js_binding()

ILIAS\UI\examples\Button\Standard\with_js_binding ( )


description: > Example for rendering a standard button with JS binding

expected output: >

ILIAS shows an active button with a title. Clicking the button opens a dialog with a click-ID.

Definition at line 32 of file with_js_binding.php.

References $DIC, Vendor\Package\$f, $id, and $renderer.

33 {
34  global $DIC;
35  $f = $DIC->ui()->factory();
36  $renderer = $DIC->ui()->renderer();
37 
38  return $renderer->render(
39  $f->button()->standard("Goto ILIAS", "#")
40  ->withOnLoadCode(function ($id) {
41  return
42  "$(\"#$id\").click(function() { alert(\"Clicked: $id\"); return false;});";
43  })
44  );
45 }
$renderer
global $DIC
Definition: shib_login.php:22
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ with_load_anim()

ILIAS\UI\examples\Button\Standard\with_load_anim ( )


description: > In this example we create a button that ships with the on load animation on click.

note: > Note that the button will trigger a page-reload as soon as the work is done, no additional magic is needed. However, in Async scenario, one can make use of the il.UI.button interface containing the functions activateLoadingAnimation and deactivateLoadingAnimation as shown below.

expected output: > ILIAS shows an active button with a title. The color of the button will change after clicking the button and the word "Working" will appear, which is referencing to the loading status. After a while the button's content

will change to "Done".

Definition at line 41 of file with_load_anim.php.

References $DIC, Vendor\Package\$f, $id, and $renderer.

42 {
43  global $DIC;
44  $f = $DIC->ui()->factory();
45  $renderer = $DIC->ui()->renderer();
46 
47  return $renderer->render(
48  //Create a button with the LoadingAnimation on click and some additional JS-Magic.
49  $f->button()->standard("Do Something", "")
50  ->withLoadingAnimationOnClick(true)
51  ->withOnLoadCode(function ($id) {
52  return " $('#$id').click(
53  function(e) {
54  $('#$id').html('Working...');
55  setInterval(
56  function(){
57  $('#$id').html('Done');
58  il.UI.button.deactivateLoadingAnimation('$id');
59  }
60  ,3000
61  );
62  });";
63  })
64  );
65 }
$renderer
global $DIC
Definition: shib_login.php:22
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ with_tooltip()

ILIAS\UI\examples\Button\Standard\with_tooltip ( )


description: > Example for rendering a standard button with tooltips

expected output: > Hovering over the rendered button will show you a tooltip with the following

lines: "tooltip: ilias" and "tooltip: learning management system".

Definition at line 33 of file with_tooltip.php.

References $DIC, Vendor\Package\$f, and $renderer.

34 {
35  global $DIC;
36  $f = $DIC->ui()->factory();
37  $renderer = $DIC->ui()->renderer();
38 
39  $button = $f->button()
40  ->standard("Goto ILIAS", "http://www.ilias.de")
41  ->withHelpTopics(
42  ...$f->helpTopics("ilias", "learning management system")
43  );
44 
45  return $renderer->render($button);
46 }
$renderer
global $DIC
Definition: shib_login.php:22