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

Functions

 base ()
 

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

 
 engaged ()
 

description: > Example for rendering an engaged primary 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_load_anim ()
 

description: > Example for rendering a primary button with a loading animation More...

 
 with_tooltip ()
 

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

 

Function Documentation

◆ base()

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


description: > Example for rendering a primary button.

expected output: > ILIAS shows an active, very colorful button with a title. Clicking the button will open 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()->primary("Goto ILIAS", "http://www.ilias.de"));
40 }
$renderer
global $DIC
Definition: shib_login.php:22

◆ engaged()

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


description: > Example for rendering an engaged primary button

expected output: >

ILIAS shows a white button with a title. A click onto 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()->primary("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\Primary\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 grayed out inactive button with a title. Clicking the button won't activate any actions.

Hovering over the button will change the look of the cursor.

Definition at line 35 of file unavailable_action.php.

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

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

◆ with_glyph()

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


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

expected output: >

ILIAS shows buttons with the Search Gylph and in some cases a label in different states.

Definition at line 32 of file with_glyph.php.

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

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

◆ with_load_anim()

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


description: > Example for rendering a primary button with a loading animation

expected output: > ILIAS shows an active, very colorful button with a title. After clicking the button the text will change to "Working..." and the button's color will change to grey. During that process you cannot click the button. After a

while the button will change to it's origin color and the text will be "Done".

Definition at line 34 of file with_load_anim.php.

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

35 {
36  global $DIC;
37  $f = $DIC->ui()->factory();
38  $renderer = $DIC->ui()->renderer();
39 
40  return $renderer->render(
41  $f->button()->primary("Goto ILIAS", "")
42  ->withLoadingAnimationOnClick(true)
43  ->withOnLoadCode(function ($id) {
44  return
45  "$('#$id').click(function(e) {
46  $('#$id').html('Working...');
47  setInterval(
48  function(){
49  $('#$id').html('Done');
50  il.UI.button.deactivateLoadingAnimation('$id');
51  }
52  ,3000);
53  });";
54  })
55  );
56 }
$renderer
global $DIC
Definition: shib_login.php:22
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ with_tooltip()

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


description: > Example for rendering a primary button with tooltips

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

content: "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  $primary = $f->button()->primary("Goto ILIAS", "http://www.ilias.de")
39  ->withHelpTopics(
40  ...$f->helpTopics("ilias", "learning management system")
41  );
42  return $renderer->render($primary);
43 }
$renderer
global $DIC
Definition: shib_login.php:22