ILIAS  release_8 Revision v8.24
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)
 Get item by post var. More...
 
- 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...
 
 getToolbarHTML ()
 Get input item HTML to be inserted into ilToolbarGUI. More...
 
- Public Member Functions inherited from ilTableFilterItem
 getTableFilterHTML ()
 Get input item HTML to be inserted into table filters. More...
 
 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
 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

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

36 {
37 global $DIC;
38
39 $this->lng = $DIC->language();
40 parent::__construct($a_title, $a_postvar);
41 $this->setType("checkbox");
42 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ 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

Reimplemented from ilFormPropertyGUI.

Reimplemented in ilDclCheckboxInputGUI.

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

97 : bool
98 {
99 $ok = $this->checkSubItemsInput();
100
101 // only not ok, if checkbox not checked
102 if ($this->getInput() == "") {
103 $ok = true;
104 }
105
106 return $ok;
107 }

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

+ Here is the call graph for this function:

◆ getAdditionalAttributes()

ilCheckboxInputGUI::getAdditionalAttributes ( )

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

88 : string
89 {
91 }

References $additional_attributes.

Referenced by render().

+ Here is the caller graph for this function:

◆ getChecked()

ilCheckboxInputGUI::getChecked ( )

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

59 : bool
60 {
61 return $this->checked;
62 }

References $checked.

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

+ Here is the caller graph for this function:

◆ getInput()

ilCheckboxInputGUI::getInput ( )

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

109 : string
110 {
111 return $this->str($this->getPostVar());
112 }

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

Referenced by checkInput().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getOptionTitle()

ilCheckboxInputGUI::getOptionTitle ( )

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

69 : string
70 {
71 return $this->optiontitle;
72 }

References $optiontitle.

Referenced by render().

+ 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 167 of file class.ilCheckboxInputGUI.php.

167 : string
168 {
169 $html = $this->render();
170 return $html;
171 }

References render().

+ 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 188 of file class.ilCheckboxInputGUI.php.

188 : string
189 {
190 $html = $this->render('toolbar');
191 return $html;
192 }

References render().

+ Here is the call graph for this function:

◆ getValue()

ilCheckboxInputGUI::getValue ( )

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

49 : string
50 {
51 return $this->value;
52 }

References $value.

Referenced by render().

+ Here is the caller graph for this function:

◆ hideSubForm()

ilCheckboxInputGUI::hideSubForm ( )

Reimplemented from ilFormPropertyGUI.

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

114 : bool
115 {
116 return !$this->getChecked();
117 }

References getChecked().

+ Here is the call graph for this function:

◆ insert()

ilCheckboxInputGUI::insert ( ilTemplate  $a_tpl)

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

158 : void
159 {
160 $html = $this->render();
161
162 $a_tpl->setCurrentBlock("prop_generic");
163 $a_tpl->setVariable("PROP_GENERIC", $html);
164 $a_tpl->parseCurrentBlock();
165 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

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

+ Here is the call graph for this function:

◆ render()

ilCheckboxInputGUI::render (   $a_mode = '')

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

119 : string
120 {
121 $tpl = new ilTemplate("tpl.prop_checkbox.html", true, true, "Services/Form");
122
123 $tpl->setVariable("POST_VAR", $this->getPostVar());
124 $tpl->setVariable("ID", $this->getFieldId());
125 $tpl->setVariable("PROPERTY_VALUE", $this->getValue());
126 $tpl->setVariable("OPTION_TITLE", $this->getOptionTitle());
127 if (strlen($this->getAdditionalAttributes())) {
128 $tpl->setVariable('PROP_CHECK_ATTRS', $this->getAdditionalAttributes());
129 }
130 if ($this->getChecked()) {
131 $tpl->setVariable(
132 "PROPERTY_CHECKED",
133 'checked="checked"'
134 );
135 }
136 if ($this->getDisabled()) {
137 $tpl->setVariable(
138 "DISABLED",
139 'disabled="disabled"'
140 );
141 }
142
143 if ($a_mode == "toolbar") {
144 // block-inline hack, see: http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/
145 // -moz-inline-stack for FF2
146 // zoom 1; *display:inline for IE6 & 7
147 $tpl->setVariable("STYLE_PAR", 'display: -moz-inline-stack; display:inline-block; zoom: 1; *display:inline;');
148 }
149
150 $tpl->setVariable("ARIA_LABEL", ilLegacyFormElementsUtil::prepareFormOutput($this->getTitle()));
151 if ($this->getInfo() !== '') {
152 $tpl->setVariable('DESCRIBED_BY_FIELD_ID', $this->getFieldId());
153 }
154
155 return $tpl->get();
156 }
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serializeData()

ilCheckboxInputGUI::serializeData ( )

Reimplemented from ilFormPropertyGUI.

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

173 : string
174 {
175 return serialize($this->getChecked());
176 }

References getChecked().

+ Here is the call graph for this function:

◆ setAdditionalAttributes()

ilCheckboxInputGUI::setAdditionalAttributes ( string  $a_attrs)

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

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

◆ setChecked()

ilCheckboxInputGUI::setChecked ( bool  $a_checked)

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

54 : void
55 {
56 $this->checked = $a_checked;
57 }

Referenced by setValueByArray(), and unserializeData().

+ Here is the caller graph for this function:

◆ setOptionTitle()

ilCheckboxInputGUI::setOptionTitle ( string  $a_optiontitle)

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

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

◆ setValue()

ilCheckboxInputGUI::setValue ( string  $a_value)

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

44 : void
45 {
46 $this->value = $a_value;
47 }

Referenced by unserializeData().

+ Here is the caller graph for this function:

◆ setValueByArray()

ilCheckboxInputGUI::setValueByArray ( array  $a_values)

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

74 : void
75 {
76 $checked = $a_values[$this->getPostVar()] ?? false;
77 $this->setChecked((bool) $checked);
78 foreach ($this->getSubItems() as $item) {
79 $item->setValueByArray($a_values);
80 }
81 }

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

+ Here is the call graph for this function:

◆ unserializeData()

ilCheckboxInputGUI::unserializeData ( string  $a_data)

Reimplemented from ilFormPropertyGUI.

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

178 : void
179 {
180 $data = unserialize($a_data);
181
182 if ($data) {
183 $this->setValue((string) $data);
184 $this->setChecked(true);
185 }
186 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $additional_attributes

string ilCheckboxInputGUI::$additional_attributes = ''
protected

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

Referenced by getAdditionalAttributes().

◆ $checked

bool ilCheckboxInputGUI::$checked = false
protected

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

Referenced by getChecked(), and setValueByArray().

◆ $optiontitle

string ilCheckboxInputGUI::$optiontitle = ""
protected

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

Referenced by getOptionTitle().

◆ $value

string ilCheckboxInputGUI::$value = "1"
protected

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

Referenced by getValue().


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