Example #1
0
 /**
  * @param ilPropertyFormGUI $form
  * @return \ilPropertyFormGUI|void
  */
 public function populateAnswerSpecificFormPart(ilPropertyFormGUI $form)
 {
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("errors_section"));
     $form->addItem($header);
     include_once "./Modules/TestQuestionPool/classes/class.ilErrorTextWizardInputGUI.php";
     $errordata = new ilErrorTextWizardInputGUI($this->lng->txt("errors"), "errordata");
     $errordata->setKeyName($this->lng->txt('text_wrong'));
     $errordata->setValueName($this->lng->txt('text_correct'));
     $errordata->setValues($this->object->getErrorData());
     $form->addItem($errordata);
     // points for wrong selection
     $points_wrong = new ilNumberInputGUI($this->lng->txt("points_wrong"), "points_wrong");
     $points_wrong->allowDecimals(true);
     $points_wrong->setValue($this->object->getPointsWrong());
     $points_wrong->setInfo($this->lng->txt("points_wrong_info"));
     $points_wrong->setSize(6);
     $points_wrong->setRequired(true);
     $form->addItem($points_wrong);
     return $form;
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     $save = $this->isSaveCommand();
     $this->getQuestionTemplate();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->outQuestionType());
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("orderinghorizontal");
     $this->addBasicQuestionFormProperties($form);
     // errortext
     $errortext = new ilTextAreaInputGUI($this->lng->txt("errortext"), "errortext");
     $errortext->setValue(ilUtil::prepareFormOutput($this->object->getErrorText()));
     $errortext->setRequired(TRUE);
     $errortext->setInfo($this->lng->txt("errortext_info"));
     $errortext->setRows(10);
     $errortext->setCols(80);
     $form->addItem($errortext);
     if (!$this->getSelfAssessmentEditingMode()) {
         // textsize
         $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
         $textsize->setValue(strlen($this->object->getTextSize()) ? $this->object->getTextSize() : 100.0);
         $textsize->setInfo($this->lng->txt("textsize_errortext_info"));
         $textsize->setSize(6);
         $textsize->setSuffix("%");
         $textsize->setMinValue(10);
         $textsize->setRequired(true);
         $form->addItem($textsize);
     }
     if (count($this->object->getErrorData()) || $checkonly) {
         $header = new ilFormSectionHeaderGUI();
         $header->setTitle($this->lng->txt("errors_section"));
         $form->addItem($header);
         include_once "./Modules/TestQuestionPool/classes/class.ilErrorTextWizardInputGUI.php";
         $errordata = new ilErrorTextWizardInputGUI($this->lng->txt("errors"), "errordata");
         $values = array();
         $errordata->setKeyName($this->lng->txt('text_wrong'));
         $errordata->setValueName($this->lng->txt('text_correct'));
         $errordata->setValues($this->object->getErrorData());
         $form->addItem($errordata);
         // points for wrong selection
         $points_wrong = new ilNumberInputGUI($this->lng->txt("points_wrong"), "points_wrong");
         $points_wrong->setValue($this->object->getPointsWrong());
         $points_wrong->setInfo($this->lng->txt("points_wrong_info"));
         $points_wrong->setSize(6);
         $points_wrong->setRequired(true);
         $form->addItem($points_wrong);
     }
     $form->addCommandButton("analyze", $this->lng->txt('analyze_errortext'));
     $this->addQuestionFormCommandButtons($form);
     $errors = false;
     if ($save) {
         $form->setValuesByPost();
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         // again, because checkInput now performs the whole stripSlashes handling and we need this if we don't want to have duplication of backslashes
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }