ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCheckboxListOverlayGUI Class Reference

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

+ Collaboration diagram for ilCheckboxListOverlayGUI:

Public Member Functions

 __construct (string $a_id="")
 
 setId (string $a_val)
 
 getId ()
 
 setLinkTitle (string $a_val)
 
 getLinkTitle ()
 
 setItems (array $a_val)
 
 getItems ()
 
 setSelectionHeaderClass (string $a_selectionheaderclass)
 
 getSelectionHeaderClass ()
 
 setFormCmd (string $a_val)
 
 getFormCmd ()
 
 setFieldVar (string $a_val)
 
 getFieldVar ()
 
 setHiddenVar (string $a_val)
 
 getHiddenVar ()
 
 getHTML (bool $pull_right=true)
 

Protected Attributes

ilLanguage $lng
 
string $id
 
string $link_title
 
string $selectionheaderclass
 
string $form_cmd
 
string $field_var
 
string $hidden_var
 
ilGlobalTemplateInterface $main_tpl
 

Private Attributes

array $items = array()
 

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 User interface class for a checkbox list overlay

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Deprecated:
with ILIAS 12. Only used in legacy tables, do not introduce this anywhere else

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

Constructor & Destructor Documentation

◆ __construct()

ilCheckboxListOverlayGUI::__construct ( string  $a_id = "")

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

39 {
40 global $DIC;
41
42 $this->lng = $DIC->language();
43 $this->setId($a_id);
44 $this->main_tpl = $DIC->ui()->mainTemplate();
45 }
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ getFieldVar()

ilCheckboxListOverlayGUI::getFieldVar ( )

Definition at line 103 of file class.ilCheckboxListOverlayGUI.php.

103 : string
104 {
105 return $this->field_var;
106 }

◆ getFormCmd()

ilCheckboxListOverlayGUI::getFormCmd ( )

Definition at line 93 of file class.ilCheckboxListOverlayGUI.php.

93 : string
94 {
95 return $this->form_cmd;
96 }

◆ getHiddenVar()

ilCheckboxListOverlayGUI::getHiddenVar ( )

Definition at line 113 of file class.ilCheckboxListOverlayGUI.php.

113 : string
114 {
115 return $this->hidden_var;
116 }

◆ getHTML()

ilCheckboxListOverlayGUI::getHTML ( bool  $pull_right = true)

Definition at line 118 of file class.ilCheckboxListOverlayGUI.php.

118 : string
119 {
121
122 $items = $this->getItems();
123
124 $tpl = new ilTemplate(
125 "tpl.checkbox_list_overlay.html",
126 true,
127 true,
128 "components/ILIAS/UIComponent/CheckboxListOverlay",
129 "DEFAULT",
130 false,
131 true
132 );
133
134 $this->main_tpl->addOnLoadCode("
135 const o = document.getElementById('chkbxlstovl_{$this->getId()}');
136 o.addEventListener('click', (e) => {
137 e.stopPropagation();
138 });
139 let b;
140 const close = () => {
141 b.parentNode.classList.remove('open');
142 b.area_expanded = 'false';
143 document.removeEventListener('click', close);
144 }
145 const closeOnEscape = (e) => {
146 if (e.key === 'Escape') {
147 close();
148 document.removeEventListener('keydown', closeOnEscape);
149 }
150 }
151 o.previousElementSibling.addEventListener('click', (e) => {
152 e.stopPropagation();
153 b = e.target.closest('button');
154 if (b.parentNode.classList.contains('open')) {
155 close();
156 return;
157 }
158 b.parentNode.classList.add('open');
159 b.area_expanded = 'true';
160 document.body.click();
161 document.addEventListener('click', close);
162 document.addEventListener('keydown', closeOnEscape);
163 });
164 ");
165
166 $tpl->touchBlock("top_img");
167
168 // do not repeat title (accessibility) -> empty alt
169 $tpl->setVariable("TXT_SEL_TOP", $this->getLinkTitle());
170
171 $tpl->parseCurrentBlock();
172
173 reset($items);
174 $cnt = 0;
175 foreach ($items as $k => $v) {
176 $tpl->setCurrentBlock("list_entry");
177 $tpl->setVariable("VAR", $this->getFieldVar());
178 $tpl->setVariable("VAL_ENTRY", $k);
179 $tpl->setVariable("TXT_ENTRY", $v["txt"]);
180 $tpl->setVariable("IDX_ENTRY", ++$cnt);
181 if ($v["selected"]) {
182 $tpl->setVariable("CHECKED", "checked='checked'");
183 }
184 $tpl->parseCurrentBlock();
185 }
186
187 if ($pull_right) {
188 $tpl->touchBlock("pr");
189 }
190
191 $tpl->setVariable("ID", $this->getId());
192 $tpl->setVariable("HIDDEN_VAR", $this->getHiddenVar());
193 $tpl->setVariable("CMD_SUBMIT", $this->getFormCmd());
194 $tpl->setVariable("VAL_SUBMIT", $lng->txt("refresh"));
195 return $tpl->get();
196 }
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...
special template class to simplify handling of ITX/PEAR

References $lng, and ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ getId()

ilCheckboxListOverlayGUI::getId ( )

Definition at line 52 of file class.ilCheckboxListOverlayGUI.php.

52 : string
53 {
54 return $this->id;
55 }

References $id.

◆ getItems()

ilCheckboxListOverlayGUI::getItems ( )

Definition at line 72 of file class.ilCheckboxListOverlayGUI.php.

72 : array
73 {
74 return $this->items;
75 }

References $items.

◆ getLinkTitle()

ilCheckboxListOverlayGUI::getLinkTitle ( )

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

62 : string
63 {
64 return $this->link_title;
65 }

References $link_title.

◆ getSelectionHeaderClass()

ilCheckboxListOverlayGUI::getSelectionHeaderClass ( )

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

83 : string
84 {
86 }

◆ setFieldVar()

ilCheckboxListOverlayGUI::setFieldVar ( string  $a_val)

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

98 : void
99 {
100 $this->field_var = $a_val;
101 }

◆ setFormCmd()

ilCheckboxListOverlayGUI::setFormCmd ( string  $a_val)

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

88 : void
89 {
90 $this->form_cmd = $a_val;
91 }

◆ setHiddenVar()

ilCheckboxListOverlayGUI::setHiddenVar ( string  $a_val)

Definition at line 108 of file class.ilCheckboxListOverlayGUI.php.

108 : void
109 {
110 $this->hidden_var = $a_val;
111 }

◆ setId()

ilCheckboxListOverlayGUI::setId ( string  $a_val)

Definition at line 47 of file class.ilCheckboxListOverlayGUI.php.

47 : void
48 {
49 $this->id = $a_val;
50 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setItems()

ilCheckboxListOverlayGUI::setItems ( array  $a_val)

Definition at line 67 of file class.ilCheckboxListOverlayGUI.php.

67 : void
68 {
69 $this->items = $a_val;
70 }

◆ setLinkTitle()

ilCheckboxListOverlayGUI::setLinkTitle ( string  $a_val)

Definition at line 57 of file class.ilCheckboxListOverlayGUI.php.

57 : void
58 {
59 $this->link_title = $a_val;
60 }

◆ setSelectionHeaderClass()

ilCheckboxListOverlayGUI::setSelectionHeaderClass ( string  $a_selectionheaderclass)

Definition at line 77 of file class.ilCheckboxListOverlayGUI.php.

79 : void {
80 $this->selectionheaderclass = $a_selectionheaderclass;
81 }

Field Documentation

◆ $field_var

string ilCheckboxListOverlayGUI::$field_var
protected

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

◆ $form_cmd

string ilCheckboxListOverlayGUI::$form_cmd
protected

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

◆ $hidden_var

string ilCheckboxListOverlayGUI::$hidden_var
protected

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

◆ $id

string ilCheckboxListOverlayGUI::$id
protected

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

Referenced by getId().

◆ $items

array ilCheckboxListOverlayGUI::$items = array()
private

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

Referenced by getItems().

◆ $link_title

string ilCheckboxListOverlayGUI::$link_title
protected

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

Referenced by getLinkTitle().

◆ $lng

ilLanguage ilCheckboxListOverlayGUI::$lng
protected

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

◆ $main_tpl

ilGlobalTemplateInterface ilCheckboxListOverlayGUI::$main_tpl
protected

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

◆ $selectionheaderclass

string ilCheckboxListOverlayGUI::$selectionheaderclass
protected

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


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