ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilButtonBase Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilButtonBase:
+ Collaboration diagram for ilButtonBase:

Public Member Functions

 __clone ()
 
 getType ()
 
 setId (?string $a_value)
 
 getId ()
 
 setCaption (string $a_value, bool $a_is_lng_id=true)
 
 getCaption (bool $a_translate=true)
 
 setPrimary (bool $a_value)
 
 isPrimary ()
 
 setOmitPreventDoubleSubmission (bool $a_value)
 Toggle double submission prevention status. More...
 
 getOmitPreventDoubleSubmission ()
 
 setOnClick (string $a_value)
 
 getOnClick ()
 
 setDisabled (bool $a_value)
 
 isDisabled ()
 
 addCSSClass (string $a_value)
 
 getCSSClasses ()
 
 applyDefaultCss (?bool $apply_default_css=null)
 
 render ()
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 

Static Public Member Functions

static getInstance ()
 

Data Fields

const TYPE_SUBMIT = 1
 
const TYPE_LINK = 2
 
const TYPE_SPLIT = 3
 
const TYPE_BUTTON = 4
 

Protected Member Functions

 __construct (int $a_type)
 
 setType (int $a_value)
 
 gatherCssClasses ()
 
 renderAttributesHelper (array $a_attr)
 
 renderAttributes (array $a_additional_attr=null)
 Render current HTML attributes. More...
 
 prepareRender ()
 

Protected Attributes

ilLanguage $lng
 
int $type = 0
 
string $id = ""
 
string $caption = ""
 
bool $caption_is_lng_id = false
 
bool $primary = false
 
bool $omit_prevent_double_submission = false
 
string $onclick = ""
 
int $acc_key = 0
 
bool $disabled = false
 
array $css = array()
 
bool $apply_default_css = true
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Button GUI

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Deprecated:
use KS Buttons instead

Definition at line 25 of file class.ilButtonBase.php.

Constructor & Destructor Documentation

◆ __construct()

ilButtonBase::__construct ( int  $a_type)
protected

Definition at line 45 of file class.ilButtonBase.php.

References $DIC, ILIAS\Repository\lng(), and setType().

46  {
47  global $DIC;
48 
49  $this->lng = $DIC->language();
50  $this->setType($a_type);
51  }
global $DIC
Definition: feed.php:28
setType(int $a_value)
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

ilButtonBase::__clone ( )

Definition at line 53 of file class.ilButtonBase.php.

References getInstance(), and setId().

54  {
55  $this->setId(null);
56  }
setId(?string $a_value)
+ Here is the call graph for this function:

◆ addCSSClass()

ilButtonBase::addCSSClass ( string  $a_value)

Definition at line 147 of file class.ilButtonBase.php.

Referenced by ilAssFileUploadFileTableDeleteButton\__construct(), and prepareRender().

147  : void
148  {
149  $this->css[] = $a_value;
150  }
+ Here is the caller graph for this function:

◆ applyDefaultCss()

ilButtonBase::applyDefaultCss ( ?bool  $apply_default_css = null)

Definition at line 221 of file class.ilButtonBase.php.

References $apply_default_css, and render().

Referenced by prepareRender().

221  : ?bool
222  {
223  if (null === $apply_default_css) {
225  }
226 
227  $this->apply_default_css = $apply_default_css;
228  return false;
229  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gatherCssClasses()

ilButtonBase::gatherCssClasses ( )
protected

Definition at line 162 of file class.ilButtonBase.php.

References getCSSClasses(), getOmitPreventDoubleSubmission(), and isPrimary().

Referenced by renderAttributes().

162  : string
163  {
164  $css = array_unique($this->getCSSClasses());
165 
166  if ($this->isPrimary()) {
167  $css[] = "btn-primary";
168  }
169  if ($this->getOmitPreventDoubleSubmission()) {
170  $css[] = "omitPreventDoubleSubmission";
171  }
172 
173  return implode(" ", $css);
174  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCaption()

ilButtonBase::getCaption ( bool  $a_translate = true)

Definition at line 90 of file class.ilButtonBase.php.

References $caption, $lng, and ilLanguage\txt().

Referenced by ilSubmitButton\render(), ilButton\render(), ilJsLinkButton\renderCaption(), ilLinkButton\renderCaption(), and ilImageLinkButton\renderCaption().

90  : string
91  {
92  $lng = $this->lng;
93 
95 
96  if ($this->caption_is_lng_id &&
97  $a_translate) {
99  }
100 
101  return $caption;
102  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCSSClasses()

ilButtonBase::getCSSClasses ( )

Definition at line 152 of file class.ilButtonBase.php.

References $css.

Referenced by gatherCssClasses().

152  : array
153  {
154  return $this->css;
155  }
+ Here is the caller graph for this function:

◆ getId()

ilButtonBase::getId ( )

Definition at line 79 of file class.ilButtonBase.php.

References $id.

Referenced by renderAttributes().

79  : ?string
80  {
81  return $this->id;
82  }
+ Here is the caller graph for this function:

◆ getInstance()

static ilButtonBase::getInstance ( )
staticabstract

Referenced by __clone().

+ Here is the caller graph for this function:

◆ getOmitPreventDoubleSubmission()

ilButtonBase::getOmitPreventDoubleSubmission ( )

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

References $omit_prevent_double_submission.

Referenced by gatherCssClasses().

122  : bool
123  {
125  }
bool $omit_prevent_double_submission
+ Here is the caller graph for this function:

◆ getOnClick()

ilButtonBase::getOnClick ( )

Definition at line 132 of file class.ilButtonBase.php.

References $onclick.

Referenced by ilJsLinkButton\render(), and renderAttributes().

132  : string
133  {
134  return $this->onclick;
135  }
+ Here is the caller graph for this function:

◆ getToolbarHTML()

ilButtonBase::getToolbarHTML ( )

Get input item HTML to be inserted into ilToolbarGUI.

Implements ilToolbarItem.

Definition at line 233 of file class.ilButtonBase.php.

References render().

233  : string
234  {
235  return $this->render();
236  }
+ Here is the call graph for this function:

◆ getType()

ilButtonBase::getType ( )

Definition at line 69 of file class.ilButtonBase.php.

References $type.

69  : int
70  {
71  return $this->type;
72  }

◆ isDisabled()

ilButtonBase::isDisabled ( )

Definition at line 142 of file class.ilButtonBase.php.

References $disabled.

Referenced by renderAttributes().

142  : bool
143  {
144  return $this->disabled;
145  }
+ Here is the caller graph for this function:

◆ isPrimary()

ilButtonBase::isPrimary ( )

Definition at line 109 of file class.ilButtonBase.php.

References $primary.

Referenced by ilToolbarGUI\addButtonInstance(), gatherCssClasses(), and ilSplitButtonGUI\render().

109  : bool
110  {
111  return $this->primary;
112  }
+ Here is the caller graph for this function:

◆ prepareRender()

ilButtonBase::prepareRender ( )
protected

Definition at line 213 of file class.ilButtonBase.php.

References addCSSClass(), and applyDefaultCss().

Referenced by ilJsLinkButton\render(), ilSubmitButton\render(), ilTestPlayerNavButton\render(), ilLinkButton\render(), and ilButton\render().

213  : void
214  {
215  if ($this->applyDefaultCss()) {
216  $this->addCSSClass("btn");
217  $this->addCSSClass("btn-default");
218  }
219  }
addCSSClass(string $a_value)
applyDefaultCss(?bool $apply_default_css=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ render()

ilButtonBase::render ( )
abstract

Referenced by applyDefaultCss(), and getToolbarHTML().

+ Here is the caller graph for this function:

◆ renderAttributes()

ilButtonBase::renderAttributes ( array  $a_additional_attr = null)
protected

Render current HTML attributes.

Definition at line 195 of file class.ilButtonBase.php.

References gatherCssClasses(), getId(), getOnClick(), isDisabled(), and renderAttributesHelper().

Referenced by ilJsLinkButton\render(), ilSubmitButton\render(), and ilButton\render().

195  : string
196  {
197  $attr = array();
198  $attr["id"] = $this->getId();
199  $attr["class"] = $this->gatherCssClasses();
200  $attr["onclick"] = $this->getOnClick();
201 
202  if ($this->isDisabled()) {
203  $attr["disabled"] = "disabled";
204  }
205 
206  if (count($a_additional_attr)) {
207  $attr = array_merge($attr, $a_additional_attr);
208  }
209 
210  return $this->renderAttributesHelper($attr);
211  }
renderAttributesHelper(array $a_attr)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderAttributesHelper()

ilButtonBase::renderAttributesHelper ( array  $a_attr)
protected

Definition at line 176 of file class.ilButtonBase.php.

References $res.

Referenced by ilDclLinkButton\render(), renderAttributes(), and ilImageLinkButton\renderCaption().

176  : string
177  {
178  $res = array();
179 
180  foreach ($a_attr as $id => $value) {
181  if (trim($value)) {
182  $res[] = strtolower(trim($id)) . '="' . $value . '"';
183  }
184  }
185 
186  if (count($res)) {
187  return " " . implode(" ", $res);
188  }
189  return "";
190  }
$res
Definition: ltiservices.php:69
+ Here is the caller graph for this function:

◆ setCaption()

ilButtonBase::setCaption ( string  $a_value,
bool  $a_is_lng_id = true 
)

Definition at line 84 of file class.ilButtonBase.php.

Referenced by ilAssFileUploadFileTableReuseButton\__construct(), and ilAssFileUploadFileTableDeleteButton\__construct().

84  : void
85  {
86  $this->caption = $a_value;
87  $this->caption_is_lng_id = $a_is_lng_id;
88  }
+ Here is the caller graph for this function:

◆ setDisabled()

ilButtonBase::setDisabled ( bool  $a_value)

Definition at line 137 of file class.ilButtonBase.php.

References ILIAS\UI\examples\Input\Field\Checkbox\disabled().

137  : void
138  {
139  $this->disabled = $a_value;
140  }
disabled()
Example showing how to plug a disabled checkbox into a form.
Definition: disabled.php:10
+ Here is the call graph for this function:

◆ setId()

ilButtonBase::setId ( ?string  $a_value)

Definition at line 74 of file class.ilButtonBase.php.

Referenced by __clone().

74  : void
75  {
76  $this->id = $a_value;
77  }
+ Here is the caller graph for this function:

◆ setOmitPreventDoubleSubmission()

ilButtonBase::setOmitPreventDoubleSubmission ( bool  $a_value)

Toggle double submission prevention status.

Definition at line 117 of file class.ilButtonBase.php.

117  : void
118  {
119  $this->omit_prevent_double_submission = $a_value;
120  }

◆ setOnClick()

ilButtonBase::setOnClick ( string  $a_value)

Definition at line 127 of file class.ilButtonBase.php.

127  : void
128  {
129  $this->onclick = trim($a_value);
130  }

◆ setPrimary()

ilButtonBase::setPrimary ( bool  $a_value)

Definition at line 104 of file class.ilButtonBase.php.

104  : void
105  {
106  $this->primary = $a_value;
107  }

◆ setType()

ilButtonBase::setType ( int  $a_value)
protected

Definition at line 64 of file class.ilButtonBase.php.

Referenced by __construct().

64  : void
65  {
66  $this->type = $a_value;
67  }
+ Here is the caller graph for this function:

Field Documentation

◆ $acc_key

int ilButtonBase::$acc_key = 0
protected

Definition at line 35 of file class.ilButtonBase.php.

◆ $apply_default_css

bool ilButtonBase::$apply_default_css = true
protected

Definition at line 38 of file class.ilButtonBase.php.

Referenced by applyDefaultCss().

◆ $caption

string ilButtonBase::$caption = ""
protected

Definition at line 30 of file class.ilButtonBase.php.

Referenced by getCaption(), and ilTestPlayerNavButton\renderCaption().

◆ $caption_is_lng_id

bool ilButtonBase::$caption_is_lng_id = false
protected

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

◆ $css

array ilButtonBase::$css = array()
protected

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

Referenced by getCSSClasses().

◆ $disabled

bool ilButtonBase::$disabled = false
protected

Definition at line 36 of file class.ilButtonBase.php.

Referenced by isDisabled().

◆ $id

string ilButtonBase::$id = ""
protected

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

Referenced by getId().

◆ $lng

ilLanguage ilButtonBase::$lng
protected

Definition at line 27 of file class.ilButtonBase.php.

Referenced by getCaption(), and ilAssFileUploadFileTableCommandButton\lng().

◆ $omit_prevent_double_submission

bool ilButtonBase::$omit_prevent_double_submission = false
protected

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

Referenced by getOmitPreventDoubleSubmission().

◆ $onclick

string ilButtonBase::$onclick = ""
protected

Definition at line 34 of file class.ilButtonBase.php.

Referenced by getOnClick().

◆ $primary

bool ilButtonBase::$primary = false
protected

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

Referenced by isPrimary().

◆ $type

int ilButtonBase::$type = 0
protected

◆ TYPE_BUTTON

const ilButtonBase::TYPE_BUTTON = 4

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

◆ TYPE_LINK

const ilButtonBase::TYPE_LINK = 2

Definition at line 41 of file class.ilButtonBase.php.

◆ TYPE_SPLIT

const ilButtonBase::TYPE_SPLIT = 3

Definition at line 42 of file class.ilButtonBase.php.

◆ TYPE_SUBMIT

const ilButtonBase::TYPE_SUBMIT = 1

Definition at line 40 of file class.ilButtonBase.php.


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