19 declare(strict_types=1);
39 string $a_postvar =
"" 43 $this->
lng = $DIC->language();
50 $this->options = $a_options;
55 return $this->options ?: array();
75 if ($this->
getMulti() && is_array($a_value)) {
77 $a_value = array_shift($a_value);
79 $this->value = $a_value;
97 $item->setValueByArray($a_values);
115 foreach ($values as
$value) {
116 if (!array_key_exists($value, $this->
getOptions())) {
121 if ($this->
getRequired() && !trim(implode(
"", $values))) {
145 $this->cust_attr[] = $a_attr;
153 public function render($a_mode =
""): string
156 $tpl =
new ilTemplate(
"tpl.prop_select.html",
true,
true,
"Services/Form");
159 $tpl->setCurrentBlock(
'cust_attr');
160 $tpl->setVariable(
'CUSTOM_ATTR', $attr);
161 $tpl->parseCurrentBlock();
165 $tpl->setCurrentBlock(
'required_attribute');
166 $tpl->setVariable(
'REQUIRED',
'required');
167 $tpl->parseCurrentBlock();
173 foreach ($this->
getOptions() as $option_value => $option_text) {
175 $sel_value = $option_value;
178 if ((
string) $option_value == (
string) $this->
getValue()) {
179 $sel_value = $option_value;
182 foreach ($this->
getOptions() as $option_value => $option_text) {
183 $tpl->setCurrentBlock(
"prop_select_option");
185 if ((
string) $sel_value == (
string) $option_value) {
188 ' selected="selected"' 191 $tpl->setVariable(
"TXT_SELECT_OPTION", $option_text);
193 if ($this->langresolve) {
196 $tpl->setVariable(
"OPTION_LANG",
' lang="' .
$lang .
'"');
199 $tpl->parseCurrentBlock();
208 $tpl->setVariable(
"POST_VAR",
$postvar);
214 foreach (
$value as $item) {
222 $tpl->setVariable(
"DISABLED",
" disabled=\"disabled\"");
223 $tpl->setVariable(
"HIDDEN_INPUT", $hidden);
229 $tpl->touchBlock(
"inline_in_bl");
253 $html = $this->
render(
"toolbar");
262 ?
string $a_condition = null
264 $this->hide_sub = $a_value;
268 ' { il.Form.showSubForm(\'subform_' . $this->
getFieldId() .
'\', \
'il_prop_cont_' . $this->
getFieldId() .
'\'); }
' . 269 ' else { il.Form.hideSubForm(\
'subform_' . $this->
getFieldId() .
'\'); };
"'); 273 public function hideSubForm(): bool 275 return $this->hide_sub; 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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)