/** * builds the questions hints form * * @access private * @global ilCtrl $ilCtrl * @global ilLanguage $lng * @return ilPropertyFormGUI $form */ private function buildForm(ilAssQuestionHint $questionHint = null) { global $ilCtrl, $lng; require_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php'; require_once 'Services/Form/classes/class.ilNumberInputGUI.php'; require_once 'Services/Form/classes/class.ilHiddenInputGUI.php'; $form = new ilPropertyFormGUI(); $form->setTableWidth('100%'); if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) { // form input: hint text $areaInp = new ilTextAreaInputGUI($lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text'); $areaInp->setRequired(true); $areaInp->setRows(10); $areaInp->setCols(80); if (!$this->questionOBJ->getPreventRteUsage()) { $areaInp->setUseRte(true); } include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php"; $areaInp->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("assessment")); $areaInp->setRTESupport($this->questionOBJ->getId(), 'qpl', 'assessment'); $areaInp->addPlugin("latex"); $areaInp->addButton("latex"); $areaInp->addButton("pastelatex"); $form->addItem($areaInp); } // form input: hint points $numInp = new ilNumberInputGUI($lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points'); $numInp->allowDecimals(true); $numInp->setRequired(true); $numInp->setSize(3); $form->addItem($numInp); if ($questionHint instanceof ilAssQuestionHint) { // build form title for an existing hint $form->setTitle(sprintf($lng->txt('tst_question_hints_form_header_edit'), $questionHint->getIndex(), $this->questionOBJ->getTitle())); // hidden input: hint id $hiddenInp = new ilHiddenInputGUI('hint_id'); $form->addItem($hiddenInp); // init values require_once 'Services/Utilities/classes/class.ilUtil.php'; if (!$this->questionOBJ->isAdditionalContentEditingModePageObject()) { $areaInp->setValue(ilUtil::prepareTextareaOutput($questionHint->getText(), true)); } $numInp->setValue($questionHint->getPoints()); $hiddenInp->setValue($questionHint->getId()); } else { // build form title for a new hint $form->setTitle(sprintf($lng->txt('tst_question_hints_form_header_create'), $this->questionOBJ->getTitle())); } if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) { if ($questionHint instanceof ilAssQuestionHint) { $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points'); } else { $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save_points_and_edit_page'); } } else { $saveCmdLabel = $lng->txt('tst_question_hints_form_cmd_save'); } $form->setFormAction($ilCtrl->getFormAction($this)); $form->addCommandButton(self::CMD_CANCEL_FORM, $lng->txt('cancel')); $form->addCommandButton(self::CMD_SAVE_FORM, $saveCmdLabel); return $form; }