ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilCheckboxInputGUI Class Reference

This class represents a checkbox property in a property form. More...

+ Inheritance diagram for ilCheckboxInputGUI:
+ Collaboration diagram for ilCheckboxInputGUI:

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 setValue (string $a_value)
 
 getValue ()
 
 setChecked (bool $a_checked)
 
 getChecked ()
 
 setOptionTitle (string $a_optiontitle)
 
 getOptionTitle ()
 
 setValueByArray (array $a_values)
 
 setAdditionalAttributes (string $a_attrs)
 
 getAdditionalAttributes ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 hideSubForm ()
 
 render ($a_mode='')
 
 insert (ilTemplate $a_tpl)
 
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem (ilFormPropertyGUI $a_item)
 
 getSubItems ()
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 
 getItemByPostVar (string $a_post_var)
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterLabelFor ()
 Get label "for" attribute value. More...
 

Protected Attributes

string $value = "1"
 
bool $checked = false
 
string $optiontitle = ""
 
string $additional_attributes = ''
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
array $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 symbol ()
 
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Detailed Description

This class represents a checkbox property in a property form.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Deprecated:
12 This component will be removed with ILIAS 12

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

Constructor & Destructor Documentation

◆ __construct()

ilCheckboxInputGUI::__construct ( string  $a_title = "",
string  $a_postvar = "" 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), and ilFormPropertyGUI\setType().

37  {
38  global $DIC;
39 
40  $this->lng = $DIC->language();
41  parent::__construct($a_title, $a_postvar);
42  $this->setType("checkbox");
43  }
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilCheckboxInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Returns
bool Input ok, true/false

Definition at line 98 of file class.ilCheckboxInputGUI.php.

References ilSubEnabledFormPropertyGUI\checkSubItemsInput(), and getInput().

98  : bool
99  {
100  $ok = $this->checkSubItemsInput();
101 
102  // only not ok, if checkbox not checked
103  if ($this->getInput() == "") {
104  $ok = true;
105  }
106 
107  return $ok;
108  }
+ Here is the call graph for this function:

◆ getAdditionalAttributes()

ilCheckboxInputGUI::getAdditionalAttributes ( )

Definition at line 89 of file class.ilCheckboxInputGUI.php.

References $additional_attributes.

Referenced by render().

89  : string
90  {
92  }
+ Here is the caller graph for this function:

◆ getChecked()

ilCheckboxInputGUI::getChecked ( )

Definition at line 60 of file class.ilCheckboxInputGUI.php.

References $checked.

Referenced by hideSubForm(), render(), and serializeData().

60  : bool
61  {
62  return $this->checked;
63  }
+ Here is the caller graph for this function:

◆ getInput()

ilCheckboxInputGUI::getInput ( )

Definition at line 110 of file class.ilCheckboxInputGUI.php.

References ilFormPropertyGUI\getPostVar(), and ilFormPropertyGUI\str().

Referenced by checkInput().

110  : string
111  {
112  return $this->str($this->getPostVar());
113  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOptionTitle()

ilCheckboxInputGUI::getOptionTitle ( )

Definition at line 70 of file class.ilCheckboxInputGUI.php.

References $optiontitle.

Referenced by render().

70  : string
71  {
72  return $this->optiontitle;
73  }
+ Here is the caller graph for this function:

◆ getTableFilterHTML()

ilCheckboxInputGUI::getTableFilterHTML ( )

Get input item HTML to be inserted into table filters.

Implements ilTableFilterItem.

Definition at line 168 of file class.ilCheckboxInputGUI.php.

References render().

168  : string
169  {
170  $html = $this->render();
171  return $html;
172  }
+ Here is the call graph for this function:

◆ getToolbarHTML()

ilCheckboxInputGUI::getToolbarHTML ( )

Get input item HTML to be inserted into ilToolbarGUI.

Implements ilToolbarItem.

Definition at line 189 of file class.ilCheckboxInputGUI.php.

References render().

189  : string
190  {
191  $html = $this->render('toolbar');
192  return $html;
193  }
+ Here is the call graph for this function:

◆ getValue()

ilCheckboxInputGUI::getValue ( )

Definition at line 50 of file class.ilCheckboxInputGUI.php.

References $value.

Referenced by render().

50  : string
51  {
52  return $this->value;
53  }
+ Here is the caller graph for this function:

◆ hideSubForm()

ilCheckboxInputGUI::hideSubForm ( )

Definition at line 115 of file class.ilCheckboxInputGUI.php.

References getChecked().

115  : bool
116  {
117  return !$this->getChecked();
118  }
+ Here is the call graph for this function:

◆ insert()

ilCheckboxInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 159 of file class.ilCheckboxInputGUI.php.

References ilTemplate\parseCurrentBlock(), render(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

159  : void
160  {
161  $html = $this->render();
162 
163  $a_tpl->setCurrentBlock("prop_generic");
164  $a_tpl->setVariable("PROP_GENERIC", $html);
165  $a_tpl->parseCurrentBlock();
166  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:

◆ render()

ilCheckboxInputGUI::render (   $a_mode = '')

Definition at line 120 of file class.ilCheckboxInputGUI.php.

References getAdditionalAttributes(), getChecked(), ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), ilFormPropertyGUI\getInfo(), getOptionTitle(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getTitle(), getValue(), and ilLegacyFormElementsUtil\prepareFormOutput().

Referenced by getTableFilterHTML(), getToolbarHTML(), and insert().

120  : string
121  {
122  $tpl = new ilTemplate("tpl.prop_checkbox.html", true, true, "components/ILIAS/Form");
123 
124  $tpl->setVariable("POST_VAR", $this->getPostVar());
125  $tpl->setVariable("ID", $this->getFieldId());
126  $tpl->setVariable("PROPERTY_VALUE", $this->getValue());
127  $tpl->setVariable("OPTION_TITLE", $this->getOptionTitle());
128  if (strlen($this->getAdditionalAttributes())) {
129  $tpl->setVariable('PROP_CHECK_ATTRS', $this->getAdditionalAttributes());
130  }
131  if ($this->getChecked()) {
132  $tpl->setVariable(
133  "PROPERTY_CHECKED",
134  'checked="checked"'
135  );
136  }
137  if ($this->getDisabled()) {
138  $tpl->setVariable(
139  "DISABLED",
140  'disabled="disabled"'
141  );
142  }
143 
144  if ($a_mode == "toolbar") {
145  // block-inline hack, see: http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/
146  // -moz-inline-stack for FF2
147  // zoom 1; *display:inline for IE6 & 7
148  $tpl->setVariable("STYLE_PAR", 'display: -moz-inline-stack; display:inline-block; zoom: 1; *display:inline;');
149  }
150 
151  $tpl->setVariable("ARIA_LABEL", ilLegacyFormElementsUtil::prepareFormOutput($this->getTitle()));
152  if ($this->getInfo() !== '') {
153  $tpl->setVariable('DESCRIBED_BY_FIELD_ID', $this->getFieldId());
154  }
155 
156  return $tpl->get();
157  }
static prepareFormOutput($a_str, bool $a_strip=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializeData()

ilCheckboxInputGUI::serializeData ( )

Definition at line 174 of file class.ilCheckboxInputGUI.php.

References getChecked().

174  : string
175  {
176  return serialize($this->getChecked());
177  }
+ Here is the call graph for this function:

◆ setAdditionalAttributes()

ilCheckboxInputGUI::setAdditionalAttributes ( string  $a_attrs)

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

84  : void
85  {
86  $this->additional_attributes = $a_attrs;
87  }

◆ setChecked()

ilCheckboxInputGUI::setChecked ( bool  $a_checked)

Definition at line 55 of file class.ilCheckboxInputGUI.php.

References ILIAS\UI\examples\Symbol\Glyph\Checked\checked().

Referenced by ilPCSectionGUI\initForm(), setValueByArray(), and unserializeData().

55  : void
56  {
57  $this->checked = $a_checked;
58  }
checked()
description: > Example for rendering a Checked Glyph.
Definition: checked.php:25
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setOptionTitle()

ilCheckboxInputGUI::setOptionTitle ( string  $a_optiontitle)

Definition at line 65 of file class.ilCheckboxInputGUI.php.

65  : void
66  {
67  $this->optiontitle = $a_optiontitle;
68  }

◆ setValue()

ilCheckboxInputGUI::setValue ( string  $a_value)

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

Referenced by ilPCSectionGUI\initForm(), and unserializeData().

45  : void
46  {
47  $this->value = $a_value;
48  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilCheckboxInputGUI::setValueByArray ( array  $a_values)

Definition at line 75 of file class.ilCheckboxInputGUI.php.

References ilFormPropertyGUI\getPostVar(), ilSubEnabledFormPropertyGUI\getSubItems(), and setChecked().

75  : void
76  {
77  $checked = $a_values[$this->getPostVar()] ?? false;
78  $this->setChecked((bool) $checked);
79  foreach ($this->getSubItems() as $item) {
80  $item->setValueByArray($a_values);
81  }
82  }
+ Here is the call graph for this function:

◆ unserializeData()

ilCheckboxInputGUI::unserializeData ( string  $a_data)

Definition at line 179 of file class.ilCheckboxInputGUI.php.

References $data, setChecked(), and setValue().

179  : void
180  {
181  $data = unserialize($a_data);
182 
183  if ($data) {
184  $this->setValue((string) $data);
185  $this->setChecked(true);
186  }
187  }
+ Here is the call graph for this function:

Field Documentation

◆ $additional_attributes

string ilCheckboxInputGUI::$additional_attributes = ''
protected

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

Referenced by getAdditionalAttributes().

◆ $checked

bool ilCheckboxInputGUI::$checked = false
protected

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

Referenced by getChecked().

◆ $optiontitle

string ilCheckboxInputGUI::$optiontitle = ""
protected

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

Referenced by getOptionTitle().

◆ $value

string ilCheckboxInputGUI::$value = "1"
protected

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

Referenced by getValue().


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