/**
  * 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(TRUE);
     $form->setTableWidth("100%");
     $form->setId("asstextquestion");
     // title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     // maxchars
     $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
     $maxchars->setSize(5);
     if ($this->object->getMaxNumOfChars() > 0) {
         $maxchars->setValue($this->object->getMaxNumOfChars());
     }
     $maxchars->setInfo($this->lng->txt("description_maxchars"));
     $form->addItem($maxchars);
     if (!$this->getSelfAssessmentEditingMode()) {
         if ($this->object->getAnswerCount() == 0) {
             $this->object->addAnswer("", 0, 0, 0);
         }
         $scoringMode = new ilRadioGroupInputGUI($this->lng->txt('essay_scoring_mode'), 'scoring_mode');
         $scoringOptionNone = new ilRadioOption($this->lng->txt('essay_scoring_mode_without_keywords'), 'non', $this->lng->txt('essay_scoring_mode_without_keywords_desc'));
         $scoringOptionAnyKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_any'), 'any', $this->lng->txt('essay_scoring_mode_keyword_relation_any_desc'));
         $scoringOptionAllKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_all'), 'all', $this->lng->txt('essay_scoring_mode_keyword_relation_all_desc'));
         $scoringOptionOneKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_one'), 'one', $this->lng->txt('essay_scoring_mode_keyword_relation_one_desc'));
         $scoringMode->addOption($scoringOptionNone);
         $scoringMode->addOption($scoringOptionAnyKeyword);
         $scoringMode->addOption($scoringOptionAllKeyword);
         $scoringMode->addOption($scoringOptionOneKeyword);
         $scoringMode->setRequired(true);
         $scoringMode->setValue(strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation() : 'non');
         require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
         // Without Keywords
         $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points");
         $nonKeywordPoints->setValue($this->object->getPoints());
         $nonKeywordPoints->setRequired(TRUE);
         $nonKeywordPoints->setSize(3);
         $nonKeywordPoints->setMinValue(0.0);
         $nonKeywordPoints->setMinvalueShouldBeGreater(true);
         $scoringOptionNone->addSubItem($nonKeywordPoints);
         // Any Keyword
         $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword");
         $anyKeyword->setRequired(TRUE);
         $anyKeyword->setQuestionObject($this->object);
         $anyKeyword->setSingleline(TRUE);
         $anyKeyword->setValues($this->object->getAnswers());
         $scoringOptionAnyKeyword->addSubItem($anyKeyword);
         // All Keywords
         $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword");
         $allKeyword->setRequired(TRUE);
         //$allKeyword->setQuestionObject($this->object);
         //$allKeyword->setSingleline(TRUE);
         $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
         $scoringOptionAllKeyword->addSubItem($allKeyword);
         $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points");
         $allKeywordPoints->setValue($this->object->getPoints());
         $allKeywordPoints->setRequired(TRUE);
         $allKeywordPoints->setSize(3);
         $allKeywordPoints->setMinValue(0.0);
         $allKeywordPoints->setMinvalueShouldBeGreater(true);
         $scoringOptionAllKeyword->addSubItem($allKeywordPoints);
         // One Keywords
         $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword");
         $oneKeyword->setRequired(TRUE);
         //$oneKeyword->setQuestionObject($this->object);
         //$oneKeyword->setSingleline(TRUE);
         $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
         $scoringOptionOneKeyword->addSubItem($oneKeyword);
         $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points");
         $oneKeywordPoints->setValue($this->object->getPoints());
         $oneKeywordPoints->setRequired(TRUE);
         $oneKeywordPoints->setSize(3);
         $oneKeywordPoints->setMinValue(0.0);
         $oneKeywordPoints->setMinvalueShouldBeGreater(true);
         $scoringOptionOneKeyword->addSubItem($oneKeywordPoints);
         $form->addItem($scoringMode);
     }
     $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;
 }
 public function populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
 {
     $scoringMode = new ilRadioGroupInputGUI($this->lng->txt('essay_scoring_mode'), 'scoring_mode');
     $scoringOptionNone = new ilRadioOption($this->lng->txt('essay_scoring_mode_without_keywords'), 'non', $this->lng->txt('essay_scoring_mode_without_keywords_desc'));
     $scoringOptionAnyKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_any'), 'any', $this->lng->txt('essay_scoring_mode_keyword_relation_any_desc'));
     $scoringOptionAllKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_all'), 'all', $this->lng->txt('essay_scoring_mode_keyword_relation_all_desc'));
     $scoringOptionOneKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_one'), 'one', $this->lng->txt('essay_scoring_mode_keyword_relation_one_desc'));
     $scoringMode->addOption($scoringOptionNone);
     $scoringMode->addOption($scoringOptionAnyKeyword);
     $scoringMode->addOption($scoringOptionAllKeyword);
     $scoringMode->addOption($scoringOptionOneKeyword);
     $scoringMode->setRequired(true);
     $scoringMode->setValue(strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation() : 'non');
     if ($this->object->getAnswerCount() == 0) {
         $this->object->addAnswer("", 1, 0, 0);
     }
     require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
     // Without Keywords
     $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points");
     $nonKeywordPoints->allowDecimals(true);
     $nonKeywordPoints->setValue($this->object->getPoints());
     $nonKeywordPoints->setRequired(TRUE);
     $nonKeywordPoints->setSize(3);
     $nonKeywordPoints->setMinValue(0.0);
     $nonKeywordPoints->setMinvalueShouldBeGreater(true);
     $scoringOptionNone->addSubItem($nonKeywordPoints);
     // Any Keyword
     $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword");
     $anyKeyword->setRequired(TRUE);
     $anyKeyword->setQuestionObject($this->object);
     $anyKeyword->setSingleline(TRUE);
     $anyKeyword->setValues($this->object->getAnswers());
     $scoringOptionAnyKeyword->addSubItem($anyKeyword);
     // All Keywords
     $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword");
     $allKeyword->setRequired(TRUE);
     //$allKeyword->setQuestionObject($this->object);
     //$allKeyword->setSingleline(TRUE);
     $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
     $scoringOptionAllKeyword->addSubItem($allKeyword);
     $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points");
     $allKeywordPoints->allowDecimals(true);
     $allKeywordPoints->setValue($this->object->getPoints());
     $allKeywordPoints->setRequired(TRUE);
     $allKeywordPoints->setSize(3);
     $allKeywordPoints->setMinValue(0.0);
     $allKeywordPoints->setMinvalueShouldBeGreater(true);
     $scoringOptionAllKeyword->addSubItem($allKeywordPoints);
     // One Keywords
     $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword");
     $oneKeyword->setRequired(TRUE);
     //$oneKeyword->setQuestionObject($this->object);
     //$oneKeyword->setSingleline(TRUE);
     $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
     $scoringOptionOneKeyword->addSubItem($oneKeyword);
     $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points");
     $oneKeywordPoints->allowDecimals(true);
     $oneKeywordPoints->setValue($this->object->getPoints());
     $oneKeywordPoints->setRequired(TRUE);
     $oneKeywordPoints->setSize(3);
     $oneKeywordPoints->setMinValue(0.0);
     $oneKeywordPoints->setMinvalueShouldBeGreater(true);
     $scoringOptionOneKeyword->addSubItem($oneKeywordPoints);
     $form->addItem($scoringMode);
 }