19 declare(strict_types=1);
41 string $a_postvar =
"" 45 $this->
lng = $DIC->language();
53 $this->width = $a_width;
63 $this->height = $a_height;
76 $this->options = $a_options;
93 if (is_array($a_array)) {
94 $this->value = $a_array;
103 return is_array($this->value) ? $this->value : array();
116 $this->select_all = $a_value;
121 $this->selected_first = $a_value;
133 if (count($val) > 0) {
137 foreach ($val as $key => $val2) {
138 if ($key != 0 || $val2 !=
"") {
139 if (!in_array((
string) $val2, $options)) {
158 $tpl =
new ilTemplate(
"tpl.prop_multi_select.html",
true,
true,
"components/ILIAS/Form");
163 if ($this->select_all) {
165 $tpl->setCurrentBlock(
"item");
166 $tpl->setVariable(
"VAL",
"");
168 $tpl->setVariable(
"IID", $this->
getFieldId());
169 $tpl->setVariable(
"TXT_OPTION",
"<em>" .
$lng->
txt(
"select_all") .
"</em>");
170 $tpl->setVariable(
"POST_VAR", $this->
getPostVar());
171 $tpl->parseCurrentBlock();
173 $tpl->setVariable(
"TOGGLE_FIELD_ID", $this->
getFieldId());
174 $tpl->setVariable(
"TOGGLE_ALL_ID", $this->
getFieldId() .
"_all__toggle");
175 $tpl->setVariable(
"TOGGLE_ALL_CBOX_ID", $this->
getFieldId() .
"_");
178 if ($this->selected_first) {
180 $tmp_checked = $tmp_unchecked = array();
181 foreach ($options as $option_value => $option_text) {
182 if (in_array($option_value, $values)) {
183 $tmp_checked[$option_value] = $option_text;
185 $tmp_unchecked[$option_value] = $option_text;
188 $options = $tmp_checked + $tmp_unchecked;
190 unset($tmp_unchecked);
193 foreach ($options as $option_value => $option_text) {
194 $tpl->setCurrentBlock(
"item");
198 " disabled=\"disabled\"" 201 if (in_array($option_value, $values)) {
204 " checked=\"checked\"" 210 $tpl->setVariable(
"IID", $this->
getFieldId());
211 $tpl->setVariable(
"TXT_OPTION", $option_text);
212 $tpl->setVariable(
"POST_VAR", $this->
getPostVar());
213 $tpl->parseCurrentBlock();
256 $this->custom_attributes[] = $custom_attribute;
281 $data = unserialize($a_data);
283 if (is_array(
$data)) {
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
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...
setVariable($variable, $value='')
Sets a variable value.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)