/** * Get sub form html * */ final function getSubForm() { // subitems $pf = null; if (count($this->getSubItems()) > 0) { $pf = new ilPropertyFormGUI(); $pf->setMode("subform"); $pf->setItems($this->getSubItems()); } return $pf; }
protected function render($a_mode = '') { $tpl = new ilTemplate("tpl.prop_checkbox_group.html", true, true, "Services/Form"); foreach ($this->getOptions() as $option) { // information text for option if ($option->getInfo() != "") { $tpl->setCurrentBlock("checkbox_option_desc"); $tpl->setVariable("CHECKBOX_OPTION_DESC", $option->getInfo()); $tpl->parseCurrentBlock(); } if (count($option->getSubItems()) > 0) { $tpl->setCurrentBlock("checkbox_option_subform"); $pf = new ilPropertyFormGUI(); $pf->setMode("subform"); $pf->setItems($option->getSubItems()); $tpl->setVariable("SUB_FORM", $pf->getContent()); $tpl->setVariable("SOP_ID", $this->getFieldId() . "_" . $option->getValue()); if ($pf->getMultipart()) { $this->getParentForm()->setMultipart(true); } $tpl->parseCurrentBlock(); if ($pf->getMultipart()) { $this->getParentForm()->setMultipart(true); } } $tpl->setCurrentBlock("prop_checkbox_option"); if (!$this->getUseValuesAsKeys()) { $tpl->setVariable("POST_VAR", $this->getPostVar() . '[]'); $tpl->setVariable("VAL_CHECKBOX_OPTION", $option->getValue()); } else { $tpl->setVariable("POST_VAR", $this->getPostVar() . '[' . $option->getValue() . ']'); $tpl->setVariable("VAL_CHECKBOX_OPTION", "1"); } $tpl->setVariable("OP_ID", $this->getFieldId() . "_" . $option->getValue()); $tpl->setVariable("FID", $this->getFieldId()); if ($this->getDisabled() or $option->getDisabled()) { $tpl->setVariable('DISABLED', 'disabled="disabled" '); } if (is_array($this->getValue())) { if (!$this->getUseValuesAsKeys()) { if (in_array($option->getValue(), $this->getValue())) { $tpl->setVariable("CHK_CHECKBOX_OPTION", 'checked="checked"'); } } else { $cval = $this->getValue(); if ($cval[$option->getValue()] == 1) { $tpl->setVariable("CHK_CHECKBOX_OPTION", 'checked="checked"'); } } } $tpl->setVariable("TXT_CHECKBOX_OPTION", $option->getTitle()); $tpl->parseCurrentBlock(); } $tpl->setVariable("ID", $this->getFieldId()); return $tpl->get(); }
/** * Insert property html */ function render() { $tpl = new ilTemplate("tpl.prop_radio.html", true, true, "Services/Form"); foreach ($this->getOptions() as $option) { // information text for option if ($option->getInfo() != "") { $tpl->setCurrentBlock("radio_option_desc"); $tpl->setVariable("RADIO_OPTION_DESC", $option->getInfo()); $tpl->parseCurrentBlock(); } if (count($option->getSubItems()) > 0) { if ($option->getValue() != $this->getValue()) { // #10930 $tpl->setCurrentBlock("prop_radio_opt_hide"); $tpl->setVariable("HOP_ID", $this->getFieldId() . "_" . $option->getValue()); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("radio_option_subform"); $pf = new ilPropertyFormGUI(); $pf->setMode("subform"); $pf->setItems($option->getSubItems()); $tpl->setVariable("SUB_FORM", $pf->getContent()); $tpl->setVariable("SOP_ID", $this->getFieldId() . "_" . $option->getValue()); if ($pf->getMultipart()) { $this->getParentForm()->setMultipart(true); } $tpl->parseCurrentBlock(); if ($pf->getMultipart()) { $this->getParentForm()->setMultipart(true); } } $tpl->setCurrentBlock("prop_radio_option"); if (!$this->getDisabled()) { $tpl->setVariable("POST_VAR", $this->getPostVar()); } $tpl->setVariable("VAL_RADIO_OPTION", $option->getValue()); $tpl->setVariable("OP_ID", $this->getFieldId() . "_" . $option->getValue()); $tpl->setVariable("FID", $this->getFieldId()); if ($this->getDisabled() or $option->getDisabled()) { $tpl->setVariable('DISABLED', 'disabled="disabled" '); } if ($option->getValue() == $this->getValue()) { $tpl->setVariable("CHK_RADIO_OPTION", 'checked="checked"'); } $tpl->setVariable("TXT_RADIO_OPTION", $option->getTitle()); $tpl->parseCurrentBlock(); } $tpl->setVariable("ID", $this->getFieldId()); if ($this->getDisabled()) { $tpl->setVariable("HIDDEN_INPUT", $this->getHiddenTag($this->getPostVar(), $this->getValue())); } return $tpl->get(); }