protected function addFieldsToEditForm(ilPropertyFormGUI $a_form)
 {
     // subtype
     $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
     $subtype->setRequired(false);
     $subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr");
     foreach ($subtypes as $idx => $st) {
         $subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx));
     }
     $a_form->addItem($subtype);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_appearance"));
     $a_form->addItem($header);
     // column separators
     $column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators");
     $column_separators->setValue(1);
     $column_separators->setInfo($this->lng->txt("matrix_column_separators_description"));
     $column_separators->setRequired(false);
     $a_form->addItem($column_separators);
     // row separators
     $row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators");
     $row_separators->setValue(1);
     $row_separators->setInfo($this->lng->txt("matrix_row_separators_description"));
     $row_separators->setRequired(false);
     $a_form->addItem($row_separators);
     // neutral column separators
     $neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator");
     $neutral_column_separator->setValue(1);
     $neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description"));
     $neutral_column_separator->setRequired(false);
     $a_form->addItem($neutral_column_separator);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_columns"));
     $a_form->addItem($header);
     // Answers
     include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
     $columns = new ilCategoryWizardInputGUI("", "columns");
     $columns->setRequired(false);
     $columns->setAllowMove(true);
     $columns->setShowWizard(true);
     $columns->setShowNeutralCategory(true);
     $columns->setDisabledScale(false);
     $columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer'));
     $columns->setCategoryText($this->lng->txt('matrix_standard_answers'));
     $columns->setShowSavePhrase(true);
     $a_form->addItem($columns);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_column_settings"));
     $a_form->addItem($header);
     // bipolar adjectives
     $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives"));
     $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description"));
     // left pole
     $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1");
     $bipolar1->setRequired(false);
     $bipolar->addSubItem($bipolar1);
     // right pole
     $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2");
     $bipolar2->setRequired(false);
     $bipolar->addSubItem($bipolar2);
     $a_form->addItem($bipolar);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_rows"));
     $a_form->addItem($header);
     // matrix rows
     include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
     $rows = new ilMatrixRowWizardInputGUI("", "rows");
     $rows->setRequired(false);
     $rows->setAllowMove(true);
     $rows->setLabelText($this->lng->txt('label'));
     $rows->setUseOtherAnswer(true);
     $a_form->addItem($rows);
     // values
     $subtype->setValue($this->object->getSubtype());
     $column_separators->setChecked($this->object->getColumnSeparators());
     $row_separators->setChecked($this->object->getRowSeparators());
     $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
     if (!$this->object->getColumnCount()) {
         $this->object->columns->addCategory("");
     }
     $columns->setValues($this->object->getColumns());
     $bipolar1->setValue($this->object->getBipolarAdjective(0));
     $bipolar2->setValue($this->object->getBipolarAdjective(1));
     if ($this->object->getRowCount() == 0) {
         $this->object->getRows()->addCategory("");
     }
     $rows->setValues($this->object->getRows());
 }
 /**
  * Creates an output of the edit form for the question
  *
  * @access public
  */
 public function editQuestion($checkonly = FALSE)
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTitle($this->lng->txt($this->getQuestionType()));
     $form->setMultipart(FALSE);
     $form->setTableWidth("100%");
     $form->setId("multiplechoice");
     // title
     $title = new ilTextInputGUI($this->lng->txt("title"), "title");
     $title->setValue($this->object->getTitle());
     $title->setRequired(TRUE);
     $form->addItem($title);
     // label
     $label = new ilTextInputGUI($this->lng->txt("label"), "label");
     $label->setValue($this->object->label);
     $label->setInfo($this->lng->txt("label_info"));
     $label->setRequired(false);
     $form->addItem($label);
     // author
     $author = new ilTextInputGUI($this->lng->txt("author"), "author");
     $author->setValue($this->object->getAuthor());
     $author->setRequired(TRUE);
     $form->addItem($author);
     // description
     $description = new ilTextInputGUI($this->lng->txt("description"), "description");
     $description->setValue($this->object->getDescription());
     $description->setRequired(FALSE);
     $form->addItem($description);
     // questiontext
     $question = new ilTextAreaInputGUI($this->lng->txt("question"), "question");
     $question->setValue($this->object->prepareTextareaOutput($this->object->getQuestiontext()));
     $question->setRequired(TRUE);
     $question->setRows(10);
     $question->setCols(80);
     $question->setUseRte(TRUE);
     include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
     $question->setRteTags(ilObjAdvancedEditing::_getUsedHTMLTags("survey"));
     $question->addPlugin("latex");
     $question->addButton("latex");
     $question->addButton("pastelatex");
     $question->setRTESupport($this->object->getId(), "spl", "survey", null, false, "3.4.7");
     $form->addItem($question);
     // subtype
     $subtype = new ilRadioGroupInputGUI($this->lng->txt("subtype"), "type");
     $subtype->setRequired(false);
     $subtype->setValue($this->object->getSubtype());
     $subtypes = array("0" => "matrix_subtype_sr", "1" => "matrix_subtype_mr");
     foreach ($subtypes as $idx => $st) {
         $subtype->addOption(new ilRadioOption($this->lng->txt($st), $idx));
     }
     $form->addItem($subtype);
     // obligatory
     $shuffle = new ilCheckboxInputGUI($this->lng->txt("obligatory"), "obligatory");
     $shuffle->setValue(1);
     $shuffle->setChecked($this->object->getObligatory());
     $shuffle->setRequired(FALSE);
     $form->addItem($shuffle);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_appearance"));
     $form->addItem($header);
     // column separators
     $column_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_column_separators"), "column_separators");
     $column_separators->setValue(1);
     $column_separators->setInfo($this->lng->txt("matrix_column_separators_description"));
     $column_separators->setChecked($this->object->getColumnSeparators());
     $column_separators->setRequired(false);
     $form->addItem($column_separators);
     // row separators
     $row_separators = new ilCheckboxInputGUI($this->lng->txt("matrix_row_separators"), "row_separators");
     $row_separators->setValue(1);
     $row_separators->setInfo($this->lng->txt("matrix_row_separators_description"));
     $row_separators->setChecked($this->object->getRowSeparators());
     $row_separators->setRequired(false);
     $form->addItem($row_separators);
     // neutral column separators
     $neutral_column_separator = new ilCheckboxInputGUI($this->lng->txt("matrix_neutral_column_separator"), "neutral_column_separator");
     $neutral_column_separator->setValue(1);
     $neutral_column_separator->setInfo($this->lng->txt("matrix_neutral_column_separator_description"));
     $neutral_column_separator->setChecked($this->object->getNeutralColumnSeparator());
     $neutral_column_separator->setRequired(false);
     $form->addItem($neutral_column_separator);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_columns"));
     $form->addItem($header);
     // Answers
     include_once "./Modules/SurveyQuestionPool/classes/class.ilCategoryWizardInputGUI.php";
     $columns = new ilCategoryWizardInputGUI("", "columns");
     $columns->setRequired(false);
     $columns->setAllowMove(true);
     $columns->setShowWizard(true);
     $columns->setShowNeutralCategory(true);
     $columns->setDisabledScale(false);
     $columns->setNeutralCategoryTitle($this->lng->txt('matrix_neutral_answer'));
     $columns->setCategoryText($this->lng->txt('matrix_standard_answers'));
     $columns->setShowSavePhrase(true);
     if (!$this->object->getColumnCount()) {
         $this->object->columns->addCategory("");
     }
     $columns->setValues($this->object->getColumns());
     $form->addItem($columns);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_column_settings"));
     $form->addItem($header);
     // bipolar adjectives
     $bipolar = new ilCustomInputGUI($this->lng->txt("matrix_bipolar_adjectives"));
     $bipolar->setInfo($this->lng->txt("matrix_bipolar_adjectives_description"));
     // left pole
     $bipolar1 = new ilTextInputGUI($this->lng->txt("matrix_left_pole"), "bipolar1");
     $bipolar1->setValue($this->object->getBipolarAdjective(0));
     $bipolar1->setRequired(false);
     $bipolar->addSubItem($bipolar1);
     // right pole
     $bipolar2 = new ilTextInputGUI($this->lng->txt("matrix_right_pole"), "bipolar2");
     $bipolar2->setValue($this->object->getBipolarAdjective(1));
     $bipolar2->setRequired(false);
     $bipolar->addSubItem($bipolar2);
     $form->addItem($bipolar);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("matrix_rows"));
     $form->addItem($header);
     // matrix rows
     include_once "./Modules/SurveyQuestionPool/classes/class.ilMatrixRowWizardInputGUI.php";
     $rows = new ilMatrixRowWizardInputGUI("", "rows");
     $rows->setRequired(false);
     $rows->setAllowMove(true);
     $rows->setLabelText($this->lng->txt('label'));
     $rows->setUseOtherAnswer(true);
     if ($this->object->getRowCount() == 0) {
         $this->object->getRows()->addCategory("");
     }
     $rows->setValues($this->object->getRows());
     $form->addItem($rows);
     $this->addCommandButtons($form);
     $errors = false;
     if ($this->isSaveCommand(array("wizardcolumns", "savePhrasecolumns"))) {
         $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("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }