ILIAS  trunk Revision v11.0_alpha-1749-g1a06bdef097
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI Class Reference
+ Collaboration diagram for ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI:

Public Member Functions

 __construct (string $caption, string $cmd)
 
 submit ()
 
 primary ()
 
 onClick (string $on_click)
 
 disabled (bool $disabled)
 
 toToolbar (bool $sticky=false, ?\ilToolbarGUI $toolbar=null)
 
 render ()
 

Protected Member Functions

 getSubmitButton ()
 
 getStandardButton ()
 
 getStdPrimaryButton ()
 
 getButton ()
 

Protected Attributes

const TYPE_STD = 0
 
const TYPE_SUBMIT = 1
 
const TYPE_STD_PRIMARY = 2
 
bool $is_primary = false
 
string $on_click = ""
 
int $type
 
Button $button
 
ilToolbarGUI $toolbar
 
ILIAS DI UIServices $ui
 
string $caption = ""
 
string $cmd = ""
 
bool $disabled = false
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 29 of file class.ButtonAdapterGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::__construct ( string  $caption,
string  $cmd 
)

Definition at line 48 of file class.ButtonAdapterGUI.php.

References ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\$caption, ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\$cmd, $DIC, ILIAS\Repository\toolbar(), and ILIAS\Repository\ui().

51  {
52  global $DIC;
53 
54  $this->caption = $caption;
55  $this->cmd = $cmd;
56  $this->ui = $DIC->ui();
57  $this->toolbar = $DIC->toolbar();
58  $this->type = self::TYPE_STD;
59  $this->on_click = "";
60  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ disabled()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::disabled ( bool  $disabled)

◆ getButton()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::getButton ( )
protected

Definition at line 130 of file class.ButtonAdapterGUI.php.

References ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\$button, $id, ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\$on_click, ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\disabled(), ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\getStandardButton(), ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\getStdPrimaryButton(), ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\getSubmitButton(), and ILIAS\UI\Implementation\Component\Button\Button\withUnavailableAction().

Referenced by ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\render(), and ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\toToolbar().

130  : \ILIAS\UI\Component\Button\Button
131  {
132  switch ($this->type) {
133  case self::TYPE_SUBMIT:
134  $button = $this->getSubmitButton();
135  break;
136 
137  case self::TYPE_STD_PRIMARY:
138  $button = $this->getStdPrimaryButton();
139  break;
140 
141  default:
142  $button = $this->getStandardButton();
143  break;
144  }
145  if ($this->on_click !== "") {
146  $click = $this->on_click;
147  $button = $button->withOnLoadCode(function ($id) use ($click) {
148  $code = <<<EOT
149 (function() {
150  const el = document.getElementById('$id').addEventListener('click', () => { $click });
151 }());
152 EOT;
153  return $code;
154  });
155  }
156 
157  if ($this->disabled) {
159  }
160 
161  return $button;
162  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStandardButton()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::getStandardButton ( )
protected

Definition at line 114 of file class.ButtonAdapterGUI.php.

References ILIAS\Repository\ui().

Referenced by ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\getButton().

114  : \ILIAS\UI\Component\Button\Button
115  {
116  return $this->ui->factory()->button()->standard(
117  $this->caption,
118  $this->cmd
119  );
120  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStdPrimaryButton()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::getStdPrimaryButton ( )
protected

Definition at line 122 of file class.ButtonAdapterGUI.php.

References ILIAS\Repository\ui().

Referenced by ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\getButton().

122  : \ILIAS\UI\Component\Button\Button
123  {
124  return $this->ui->factory()->button()->primary(
125  $this->caption,
126  $this->cmd
127  );
128  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSubmitButton()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::getSubmitButton ( )
protected

Definition at line 87 of file class.ButtonAdapterGUI.php.

References Vendor\Package\$b, ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\$cmd, $id, and ILIAS\Repository\ui().

Referenced by ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\getButton().

87  : \ILIAS\UI\Component\Button\Button
88  {
89  $cmd = $this->cmd;
90  if ($this->is_primary) {
91  $b = $this->ui->factory()->button()->primary(
92  $this->caption,
93  ""
94  );
95  } else {
96  $b = $this->ui->factory()->button()->standard(
97  $this->caption,
98  ""
99  );
100  }
101  $b = $b->withOnLoadCode(function ($id) use ($cmd) {
102  $code = <<<EOT
103 (function() {
104  const el = document.getElementById('$id');
105  el.name = "cmd[$cmd]";
106  el.type = "submit";
107 }());
108 EOT;
109  return $code;
110  });
111  return $b;
112  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ onClick()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::onClick ( string  $on_click)

◆ primary()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::primary ( )

Definition at line 68 of file class.ButtonAdapterGUI.php.

68  : self
69  {
70  $this->type = self::TYPE_STD_PRIMARY;
71  $this->is_primary = true;
72  return $this;
73  }

◆ render()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::render ( )

Definition at line 177 of file class.ButtonAdapterGUI.php.

References ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\getButton(), and ILIAS\Repository\ui().

177  : string
178  {
179  return $this->ui->renderer()->render($this->getButton());
180  }
+ Here is the call graph for this function:

◆ submit()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::submit ( )

Definition at line 62 of file class.ButtonAdapterGUI.php.

62  : self
63  {
64  $this->type = self::TYPE_SUBMIT;
65  return $this;
66  }

◆ toToolbar()

ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::toToolbar ( bool  $sticky = false,
?\ilToolbarGUI  $toolbar = null 
)

Definition at line 164 of file class.ButtonAdapterGUI.php.

References ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\$toolbar, ilToolbarGUI\addStickyItem(), and ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI\getButton().

164  : void
165  {
166  $button = $this->getButton();
167  if (is_null($toolbar)) {
169  }
170  if ($sticky) {
172  } else {
174  }
175  }
addComponent(\ILIAS\UI\Component\Component $a_comp)
addStickyItem( $a_item, bool $a_output_label=false)
Add a sticky item.
+ Here is the call graph for this function:

Field Documentation

◆ $button

Button ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::$button
protected

◆ $caption

string ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::$caption = ""
protected

◆ $cmd

string ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::$cmd = ""
protected

◆ $disabled

bool ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::$disabled = false
protected

◆ $is_primary

bool ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::$is_primary = false
protected

Definition at line 37 of file class.ButtonAdapterGUI.php.

◆ $on_click

string ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::$on_click = ""
protected

◆ $toolbar

ilToolbarGUI ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::$toolbar
protected

◆ $type

int ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::$type
protected

Definition at line 39 of file class.ButtonAdapterGUI.php.

◆ $ui

ILIAS DI UIServices ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::$ui
protected

Definition at line 43 of file class.ButtonAdapterGUI.php.

◆ TYPE_STD

const ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::TYPE_STD = 0
protected

Definition at line 31 of file class.ButtonAdapterGUI.php.

◆ TYPE_STD_PRIMARY

const ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::TYPE_STD_PRIMARY = 2
protected

Definition at line 33 of file class.ButtonAdapterGUI.php.

◆ TYPE_SUBMIT

const ILIAS\UI\Implementation\Component\Button\Button\ButtonAdapterGUI::TYPE_SUBMIT = 1
protected

Definition at line 32 of file class.ButtonAdapterGUI.php.


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