19 declare(strict_types=1);
40 string $a_postvar =
"" 44 $this->
lng = $DIC->language();
51 $this->options = $a_options;
56 return $this->options ?: array();
66 return $this->langresolve($this->
getOptions(), $key);
76 if ($this->
getMulti() && is_array($a_value)) {
78 $a_value = array_shift($a_value);
80 $this->value = $a_value;
98 $item->setValueByArray($a_values);
116 foreach ($values as
$value) {
117 if (!array_key_exists($value, $this->
getOptions())) {
122 if ($this->
getRequired() && !trim(implode(
"", $values))) {
146 $this->cust_attr[] = $a_attr;
154 public function render($a_mode =
""): string
157 $tpl =
new ilTemplate(
"tpl.prop_select.html",
true,
true,
"components/ILIAS/Form");
160 $tpl->setCurrentBlock(
'cust_attr');
161 $tpl->setVariable(
'CUSTOM_ATTR', $attr);
162 $tpl->parseCurrentBlock();
166 $tpl->setCurrentBlock(
'required_attribute');
167 $tpl->setVariable(
'REQUIRED',
'required');
168 $tpl->parseCurrentBlock();
174 foreach ($this->
getOptions() as $option_value => $option_text) {
176 $sel_value = $option_value;
179 if ((
string) $option_value == (
string) $this->
getValue()) {
180 $sel_value = $option_value;
183 foreach ($this->
getOptions() as $option_value => $option_text) {
184 $tpl->setCurrentBlock(
"prop_select_option");
186 if ((
string) $sel_value == (
string) $option_value) {
189 ' selected="selected"' 192 $tpl->setVariable(
"TXT_SELECT_OPTION", $option_text);
194 if ($this->langresolve) {
197 $tpl->setVariable(
"OPTION_LANG",
' lang="' .
$lang .
'"');
200 $tpl->parseCurrentBlock();
209 $tpl->setVariable(
"POST_VAR",
$postvar);
215 foreach (
$value as $item) {
223 $tpl->setVariable(
"DISABLED",
" disabled=\"disabled\"");
224 $tpl->setVariable(
"HIDDEN_INPUT", $hidden);
230 $tpl->touchBlock(
"inline_in_bl");
254 $html = $this->
render(
"toolbar");
263 ?
string $a_condition =
null 265 $this->hide_sub = $a_value;
269 ' { il.Form.showSubForm(\'subform_' . $this->
getFieldId() .
'\', \
'il_prop_cont_' . $this->
getFieldId() .
'\'); }
' . 270 ' else { il.Form.hideSubForm(\
'subform_' . $this->
getFieldId() .
'\'); };
"'); 274 public function hideSubForm(): bool 276 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...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setVariable($variable, $value='')
Sets a variable value.
Interface for multi values support.
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
__construct(Container $dic, ilPlugin $plugin)