public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form) { // is MultipleChoice? $radioGroup = new ilRadioGroupInputGUI($this->lng->txt('tst_imap_qst_mode'), 'is_multiple_choice'); $radioGroup->setValue($this->object->getIsMultipleChoice()); $modeSingleChoice = new ilRadioOption($this->lng->txt('tst_imap_qst_mode_sc'), assImagemapQuestion::MODE_SINGLE_CHOICE); $modeMultipleChoice = new ilRadioOption($this->lng->txt('tst_imap_qst_mode_mc'), assImagemapQuestion::MODE_MULTIPLE_CHOICE); $radioGroup->addOption($modeSingleChoice); $radioGroup->addOption($modeMultipleChoice); $form->addItem($radioGroup); // image include_once "./Modules/TestQuestionPool/classes/class.ilImagemapFileInputGUI.php"; $image = new ilImagemapFileInputGUI($this->lng->txt('image'), 'image'); $image->setPointsUncheckedFieldEnabled($this->object->getIsMultipleChoice()); $image->setRequired(true); if (strlen($this->object->getImageFilename())) { $image->setImage($this->object->getImagePathWeb() . $this->object->getImageFilename()); $image->setValue($this->object->getImageFilename()); $image->setAreas($this->object->getAnswers()); $assessmentSetting = new ilSetting("assessment"); $linecolor = strlen($assessmentSetting->get("imap_line_color")) ? "\"#" . $assessmentSetting->get("imap_line_color") . "\"" : "\"#FF0000\""; $image->setLineColor($linecolor); $image->setImagePath($this->object->getImagePath()); $image->setImagePathWeb($this->object->getImagePathWeb()); } $form->addItem($image); // imagemapfile $imagemapfile = new ilFileInputGUI($this->lng->txt('add_imagemap'), 'imagemapfile'); $imagemapfile->setRequired(false); $form->addItem($imagemapfile); 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(TRUE); $form->setTableWidth("100%"); $form->setId("assimagemap"); // title, author, description, question, working time (assessment mode) $this->addBasicQuestionFormProperties($form); // image include_once "./Modules/TestQuestionPool/classes/class.ilImagemapFileInputGUI.php"; $image = new ilImagemapFileInputGUI($this->lng->txt('image'), 'image'); $image->setRequired(true); if (strlen($this->object->getImageFilename())) { $image->setImage($this->object->getImagePathWeb() . $this->object->getImageFilename()); $image->setValue($this->object->getImageFilename()); $image->setAreas($this->object->getAnswers()); $assessmentSetting = new ilSetting("assessment"); $linecolor = strlen($assessmentSetting->get("imap_line_color")) ? "\"#" . $assessmentSetting->get("imap_line_color") . "\"" : "\"#FF0000\""; $image->setLineColor($linecolor); $image->setImagePath($this->object->getImagePath()); $image->setImagePathWeb($this->object->getImagePathWeb()); } $form->addItem($image); // imagemapfile $imagemapfile = new ilFileInputGUI($this->lng->txt('add_imagemap'), 'imagemapfile'); $imagemapfile->setRequired(false); $form->addItem($imagemapfile); $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; }