コード例 #1
0
 /**
  * @param ilPropertyFormGUI $form
  * @return ilPropertyFormGUI
  */
 public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
 {
     // shuffle answers
     $shuffleAnswers = new ilCheckboxInputGUI($this->lng->txt("shuffle_answers"), "shuffle_answers_enabled");
     $shuffleAnswers->setChecked($this->object->isShuffleAnswersEnabled());
     $form->addItem($shuffleAnswers);
     if (!$this->object->getSelfAssessmentEditingMode()) {
         // answer mode (single-/multi-line)
         $answerType = new ilSelectInputGUI($this->lng->txt('answer_types'), 'answer_type');
         $answerType->setOptions($this->object->getAnswerTypeSelectOptions($this->lng));
         $answerType->setValue($this->object->getAnswerType());
         $form->addItem($answerType);
     }
     if (!$this->object->getSelfAssessmentEditingMode() && $this->object->isSingleLineAnswerType($this->object->getAnswerType())) {
         // thumb size
         $thumbSize = new ilNumberInputGUI($this->lng->txt('thumb_size'), 'thumb_size');
         $thumbSize->setSuffix($this->lng->txt("thumb_size_unit_pixel"));
         $thumbSize->setInfo($this->lng->txt('thumb_size_info'));
         $thumbSize->setDecimals(false);
         $thumbSize->setMinValue(20);
         $thumbSize->setSize(6);
         $thumbSize->setValue($this->object->getThumbSize());
         $form->addItem($thumbSize);
     }
     // option label
     $optionLabel = new ilRadioGroupInputGUI($this->lng->txt('option_label'), 'option_label');
     $optionLabel->setInfo($this->lng->txt('option_label_info'));
     $optionLabel->setRequired(true);
     $optionLabel->setValue($this->object->getOptionLabel());
     foreach ($this->object->getValidOptionLabelsTranslated($this->lng) as $labelValue => $labelText) {
         $option = new ilRadioOption($labelText, $labelValue);
         $optionLabel->addOption($option);
         if ($this->object->isCustomOptionLabel($labelValue)) {
             $customLabelTrue = new ilTextInputGUI($this->lng->txt('option_label_custom_true'), 'option_label_custom_true');
             $customLabelTrue->setValue($this->object->getCustomTrueOptionLabel());
             $option->addSubItem($customLabelTrue);
             $customLabelFalse = new ilTextInputGUI($this->lng->txt('option_label_custom_false'), 'option_label_custom_false');
             $customLabelFalse->setValue($this->object->getCustomFalseOptionLabel());
             $option->addSubItem($customLabelFalse);
         }
     }
     $form->addItem($optionLabel);
     // points
     $points = new ilNumberInputGUI($this->lng->txt('points'), 'points');
     $points->setRequired(true);
     $points->setSize(3);
     $points->allowDecimals(true);
     $points->setMinValue(0);
     $points->setMinvalueShouldBeGreater(true);
     $points->setValue($this->object->getPoints());
     $form->addItem($points);
     // score partial solution
     $scorePartialSolution = new ilCheckboxInputGUI($this->lng->txt('score_partsol_enabled'), 'score_partsol_enabled');
     $scorePartialSolution->setInfo($this->lng->txt('score_partsol_enabled_info'));
     $scorePartialSolution->setChecked($this->object->isScorePartialSolutionEnabled());
     $form->addItem($scorePartialSolution);
     return $form;
 }