/** * Init form. * * @param int $a_mode Edit Mode */ public function initForm($a_mode = "edit") { global $lng, $ilCtrl; include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $this->form = new ilPropertyFormGUI(); // select skill template include_once "./Services/Skill/classes/class.ilSkillTreeNode.php"; $tmplts = ilSkillTreeNode::getTopTemplates(); // title $ti = new ilTextInputGUI($lng->txt("title"), "title"); $ti->setRequired(true); $this->form->addItem($ti); // order nr $ni = new ilNumberInputGUI($lng->txt("skmg_order_nr"), "order_nr"); $ni->setMaxLength(6); $ni->setSize(6); $ni->setRequired(true); $this->form->addItem($ni); // template $options = array("" => $lng->txt("please_select")); foreach ($tmplts as $tmplt) { $options[$tmplt["child"]] = $tmplt["title"]; } if ($a_mode != "edit") { $si = new ilSelectInputGUI($lng->txt("skmg_skill_template"), "skill_template_id"); $si->setOptions($options); $si->setRequired(true); $this->form->addItem($si); } else { $ne = new ilNonEditableValueGUI($lng->txt("skmg_skill_template"), ""); $ne->setValue($options[$this->node_object->getSkillTemplateId()]); $this->form->addItem($ne); } // status $this->addStatusInput($this->form); // selectable $cb = new ilCheckboxInputGUI($lng->txt("skmg_selectable"), "selectable"); $cb->setInfo($lng->txt("skmg_selectable_info")); $this->form->addItem($cb); if ($a_mode == "create") { $this->form->addCommandButton("save", $lng->txt("save")); $this->form->addCommandButton("cancel", $lng->txt("cancel")); $this->form->setTitle($lng->txt("skmg_new_sktr")); } else { $this->form->addCommandButton("updateSkillTemplateReference", $lng->txt("save")); $this->form->setTitle($lng->txt("skmg_edit_sktr")); } $this->form->setFormAction($ilCtrl->getFormAction($this)); }