/** * 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"; $orderingtype = array_key_exists('ordering_type', $_POST) ? $_POST['ordering_type'] : $this->object->getOrderingType(); if (strcmp($this->ctrl->getCmd(), 'changeToText') == 0) { $orderingtype = OQ_TERMS; } if (strcmp($this->ctrl->getCmd(), 'changeToPictures') == 0) { $orderingtype = OQ_PICTURES; } $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->outQuestionType()); $form->setMultipart($orderingtype == OQ_PICTURES ? TRUE : FALSE); $form->setTableWidth("100%"); $form->setId("ordering"); // Edit mode $hidden = new ilHiddenInputGUI("ordering_type"); $hidden->setValue($orderingtype); $form->addItem($hidden); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); if (!$this->getSelfAssessmentEditingMode()) { $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); } if ($orderingtype == OQ_PICTURES) { $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); } if (count($this->object->getAnswers()) == 0) { $this->object->addAnswer(); } // Answers if ($orderingtype == OQ_PICTURES) { include_once "./Modules/TestQuestionPool/classes/class.ilImageWizardInputGUI.php"; $answers = new ilImageWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(TRUE); $answers->setQuestionObject($this->object); $answers->setInfo($this->lng->txt('ordering_answer_sequence_info')); $answers->setAllowMove(TRUE); $answervalues = array(); foreach ($this->object->getAnswers() as $index => $answervalue) { $answervalues[$index] = $answervalue->getAnswertext(); } $answers->setValues($answervalues); $form->addItem($answers); } else { $answers = new ilTextWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(TRUE); $answers->setInfo($this->lng->txt('ordering_answer_sequence_info')); $answers->setAllowMove(TRUE); $answervalues = array(); foreach ($this->object->getAnswers() as $index => $answervalue) { $answervalues[$index] = $answervalue->getAnswertext(); } ksort($answervalues); $answers->setValues($answervalues); $form->addItem($answers); } // points $points = new ilNumberInputGUI($this->lng->txt("points"), "points"); $points->setValue($this->object->getPoints()); $points->setRequired(TRUE); $points->setSize(3); $points->setMinValue(0); $points->setMinvalueShouldBeGreater(true); $form->addItem($points); if (true || !$this->getSelfAssessmentEditingMode()) { if ($orderingtype == OQ_PICTURES) { $form->addCommandButton("changeToText", $this->lng->txt("order_terms")); } else { $form->addCommandButton("changeToPictures", $this->lng->txt("order_pictures")); } } $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; }
/** * @return \ilImageWizardInputGUI */ private function getAnswerImageFileUploadWizardFormProperty() { include_once "./Modules/TestQuestionPool/classes/class.ilImageWizardInputGUI.php"; $answers = new ilImageWizardInputGUI($this->lng->txt("answers"), "answers"); $answers->setRequired(TRUE); $answers->setQuestionObject($this->object); $answers->setInfo($this->lng->txt('ordering_answer_sequence_info')); $answers->setAllowMove(TRUE); $answervalues = array(); foreach ($this->object->getAnswers() as $index => $answervalue) { $answervalues[$index] = $answervalue->getAnswertext(); } $answers->setValues($answervalues); return $answers; }