24 include_once(
"./Services/Form/classes/class.ilCheckboxOption.php");
49 $this->
setType(
"checkboxgroup");
59 $this->use_values_as_keys = $a_val;
79 $this->options[] = $a_option;
89 foreach($a_options as $key => $label) {
90 if (is_string($label)) {
92 $this->options[] = $chb;
95 $this->options[] = $label;
117 $this->value = $a_value;
140 foreach($option->getSubItems() as $item)
142 $item->setValueByArray($a_values);
158 $this->
setAlert($lng->txt(
"msg_input_is_required"));
166 foreach($option->getSubItems() as $item)
168 $item_ok = $item->checkInput();
169 if (!$item_ok && in_array($option->getValue(),
$_POST[$this->
getPostVar()]))
186 $a_tpl->setCurrentBlock(
"prop_generic");
187 $a_tpl->setVariable(
"PROP_GENERIC", $this->
render());
188 $a_tpl->parseCurrentBlock();
205 foreach($option->getSubItems() as $item)
207 if ($item->getType() !=
"section_header")
209 $ret = $item->getItemByPostVar($a_post_var);
228 return $this->
render(
'toolbar');
233 $tpl =
new ilTemplate(
"tpl.prop_checkbox_group.html",
true,
true,
"Services/Form");
238 if ($option->getInfo() !=
"")
240 $tpl->setCurrentBlock(
"checkbox_option_desc");
241 $tpl->setVariable(
"CHECKBOX_OPTION_DESC", $option->getInfo());
242 $tpl->parseCurrentBlock();
246 if (count($option->getSubItems()) > 0)
248 $tpl->setCurrentBlock(
"checkbox_option_subform");
250 $pf->setMode(
"subform");
251 $pf->setItems($option->getSubItems());
252 $tpl->setVariable(
"SUB_FORM", $pf->getContent());
253 $tpl->setVariable(
"SOP_ID", $this->
getFieldId().
"_".$option->getValue());
254 if ($pf->getMultipart())
258 $tpl->parseCurrentBlock();
259 if ($pf->getMultipart())
265 $tpl->setCurrentBlock(
"prop_checkbox_option");
270 $tpl->setVariable(
"VAL_CHECKBOX_OPTION", $option->getValue());
274 $tpl->setVariable(
"POST_VAR", $this->
getPostVar().
'['.$option->getValue().
']');
275 $tpl->setVariable(
"VAL_CHECKBOX_OPTION",
"1");
278 $tpl->setVariable(
"OP_ID", $this->
getFieldId().
"_".$option->getValue());
283 $tpl->setVariable(
'DISABLED',
'disabled="disabled" ');
290 if (in_array($option->getValue(), $this->
getValue()))
292 $tpl->setVariable(
"CHK_CHECKBOX_OPTION",
293 'checked="checked"');
299 if ($cval[$option->getValue()] == 1)
301 $tpl->setVariable(
"CHK_CHECKBOX_OPTION",
302 'checked="checked"');
306 $tpl->setVariable(
"TXT_CHECKBOX_OPTION", $option->getTitle());
309 $tpl->parseCurrentBlock();
329 $subInputItems = array_merge( $subInputItems, $option->getSubInputItemsRecursive() );
332 return $subInputItems;