public function populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
 {
     // Definitions
     include_once "./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
     $definitions = new ilMatchingWizardInputGUI($this->lng->txt("definitions"), "definitions");
     if ($this->object->getSelfAssessmentEditingMode()) {
         $definitions->setHideImages(true);
     }
     $definitions->setRequired(true);
     $definitions->setQuestionObject($this->object);
     $definitions->setTextName($this->lng->txt('definition_text'));
     $definitions->setImageName($this->lng->txt('definition_image'));
     include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
     if (!count($this->object->getDefinitions())) {
         $this->object->addDefinition(new assAnswerMatchingDefinition());
     }
     $definitionvalues = $this->object->getDefinitions();
     $definitions->setValues($definitionvalues);
     $form->addItem($definitions);
     // Terms
     include_once "./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
     $terms = new ilMatchingWizardInputGUI($this->lng->txt("terms"), "terms");
     if ($this->object->getSelfAssessmentEditingMode()) {
         $terms->setHideImages(true);
     }
     $terms->setRequired(true);
     $terms->setQuestionObject($this->object);
     $terms->setTextName($this->lng->txt('term_text'));
     $terms->setImageName($this->lng->txt('term_image'));
     include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
     if (!count($this->object->getTerms())) {
         $this->object->addTerm(new assAnswerMatchingTerm());
     }
     $termvalues = $this->object->getTerms();
     $terms->setValues($termvalues);
     $form->addItem($terms);
     // Matching Pairs
     include_once "./Modules/TestQuestionPool/classes/class.ilMatchingPairWizardInputGUI.php";
     $pairs = new ilMatchingPairWizardInputGUI($this->lng->txt('matching_pairs'), 'pairs');
     $pairs->setRequired(true);
     $pairs->setTerms($this->object->getTerms());
     $pairs->setDefinitions($this->object->getDefinitions());
     include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
     if (count($this->object->getMatchingPairs()) == 0) {
         $this->object->addMatchingPair(new assAnswerMatchingPair($termvalues[0], $definitionvalues[0], 0));
     }
     $pairs->setPairs($this->object->getMatchingPairs());
     $form->addItem($pairs);
     return $form;
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access 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("matching");
     // Edit mode
     $hidden = new ilHiddenInputGUI("matching_type");
     $hidden->setValue($matchingtype);
     $form->addItem($hidden);
     // title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     if (!$this->getSelfAssessmentEditingMode()) {
         // shuffle
         $shuffle = new ilSelectInputGUI($this->lng->txt("shuffle_answers"), "shuffle");
         $shuffle_options = array(0 => $this->lng->txt("no"), 1 => $this->lng->txt("matching_shuffle_terms_definitions"), 2 => $this->lng->txt("matching_shuffle_terms"), 3 => $this->lng->txt("matching_shuffle_definitions"));
         $shuffle->setOptions($shuffle_options);
         $shuffle->setValue($this->object->getShuffle());
         $shuffle->setRequired(FALSE);
         $form->addItem($shuffle);
         $element_height = new ilNumberInputGUI($this->lng->txt("element_height"), "element_height");
         $element_height->setValue($this->object->getElementHeight());
         $element_height->setRequired(false);
         $element_height->setMaxLength(6);
         $element_height->setMinValue(20);
         $element_height->setSize(6);
         $element_height->setInfo($this->lng->txt("element_height_info"));
         $form->addItem($element_height);
         $geometry = new ilNumberInputGUI($this->lng->txt("thumb_geometry"), "thumb_geometry");
         $geometry->setValue($this->object->getThumbGeometry());
         $geometry->setRequired(true);
         $geometry->setMaxLength(6);
         $geometry->setMinValue(20);
         $geometry->setSize(6);
         $geometry->setInfo($this->lng->txt("thumb_geometry_info"));
         $form->addItem($geometry);
     }
     // Definitions
     include_once "./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
     $definitions = new ilMatchingWizardInputGUI($this->lng->txt("definitions"), "definitions");
     if ($this->getSelfAssessmentEditingMode()) {
         $definitions->setHideImages(true);
     }
     $definitions->setRequired(true);
     $definitions->setQuestionObject($this->object);
     $definitions->setTextName($this->lng->txt('definition_text'));
     $definitions->setImageName($this->lng->txt('definition_image'));
     include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingDefinition.php";
     if (!count($this->object->getDefinitions())) {
         $this->object->addDefinition(new assAnswerMatchingDefinition());
     }
     $definitionvalues = $this->object->getDefinitions();
     $definitions->setValues($definitionvalues);
     $form->addItem($definitions);
     // Terms
     include_once "./Modules/TestQuestionPool/classes/class.ilMatchingWizardInputGUI.php";
     $terms = new ilMatchingWizardInputGUI($this->lng->txt("terms"), "terms");
     if ($this->getSelfAssessmentEditingMode()) {
         $terms->setHideImages(true);
     }
     $terms->setRequired(true);
     $terms->setQuestionObject($this->object);
     $terms->setTextName($this->lng->txt('term_text'));
     $terms->setImageName($this->lng->txt('term_image'));
     include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingTerm.php";
     if (!count($this->object->getTerms())) {
         $this->object->addTerm(new assAnswerMatchingTerm());
     }
     $termvalues = $this->object->getTerms();
     $terms->setValues($termvalues);
     $form->addItem($terms);
     // Matching Pairs
     include_once "./Modules/TestQuestionPool/classes/class.ilMatchingPairWizardInputGUI.php";
     $pairs = new ilMatchingPairWizardInputGUI($this->lng->txt('matching_pairs'), 'pairs');
     $pairs->setRequired(true);
     $pairs->setTerms($this->object->getTerms());
     $pairs->setDefinitions($this->object->getDefinitions());
     include_once "./Modules/TestQuestionPool/classes/class.assAnswerMatchingPair.php";
     if (count($this->object->getMatchingPairs()) == 0) {
         $this->object->addMatchingPair(new assAnswerMatchingPair($termvalues[0], $definitionvalues[0], 0));
     }
     $pairs->setPairs($this->object->getMatchingPairs());
     $form->addItem($pairs);
     $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 && count($terms->getValues()) < count($definitions->getValues()) && !$this->getSelfAssessmentEditingMode()) {
             $errors = true;
             $terms->setAlert($this->lng->txt("msg_number_of_terms_too_low"));
             ilUtil::sendFailure($this->lng->txt('form_input_not_valid'));
         }
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("QUESTION_DATA", $form->getHTML());
     }
     return $errors;
 }