public function build()
 {
     $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI));
     $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_general_form'));
     $this->setId('tstRndQuestSetCfgGeneralForm');
     $this->addCommandButton(ilTestRandomQuestionSetConfigGUI::CMD_SAVE_GENERAL_CONFIG_FORM, $this->lng->txt('save'));
     // Require Pools with Homogeneous Scored Questions
     $requirePoolsQuestionsHomoScored = new ilCheckboxInputGUI($this->lng->txt('tst_inp_all_quest_points_equal_per_pool'), 'quest_points_equal_per_pool');
     $requirePoolsQuestionsHomoScored->setInfo($this->lng->txt('tst_inp_all_quest_points_equal_per_pool_desc'));
     $requirePoolsQuestionsHomoScored->setChecked($this->questionSetConfig->arePoolsWithHomogeneousScoredQuestionsRequired());
     $this->addItem($requirePoolsQuestionsHomoScored);
     // question amount config mode (per test / per pool)
     $questionAmountConfigMode = new ilRadioGroupInputGUI($this->lng->txt('tst_inp_quest_amount_cfg_mode'), 'quest_amount_cfg_mode');
     $questionAmountConfigMode->setValue($this->fetchValidQuestionAmountConfigModeWithFallbackModePerTest($this->questionSetConfig));
     $questionAmountConfigModePerTest = new ilRadioOption($this->lng->txt('tst_inp_quest_amount_cfg_mode_test'), ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_TEST);
     $questionAmountConfigMode->addOption($questionAmountConfigModePerTest);
     $questionAmountConfigModePerPool = new ilRadioOption($this->lng->txt('tst_inp_quest_amount_cfg_mode_pool'), ilTestRandomQuestionSetConfig::QUESTION_AMOUNT_CONFIG_MODE_PER_POOL);
     $questionAmountConfigMode->addOption($questionAmountConfigModePerPool);
     $questionAmountConfigMode->setRequired(true);
     $this->addItem($questionAmountConfigMode);
     // question amount per test
     $questionAmountPerTest = new ilNumberInputGUI($this->lng->txt('tst_inp_quest_amount_per_test'), 'quest_amount_per_test');
     $questionAmountPerTest->setRequired(true);
     $questionAmountPerTest->setMinValue(0);
     $questionAmountPerTest->allowDecimals(false);
     $questionAmountPerTest->setMinvalueShouldBeGreater(true);
     $questionAmountPerTest->setSize(4);
     $questionAmountPerTest->setValue($this->questionSetConfig->getQuestionAmountPerTest());
     $questionAmountConfigModePerTest->addSubItem($questionAmountPerTest);
     if ($this->testOBJ->participantDataExist()) {
         $requirePoolsQuestionsHomoScored->setDisabled(true);
         $questionAmountConfigMode->setDisabled(true);
         $questionAmountPerTest->setDisabled(true);
     }
 }
示例#2
0
 private function formTimingObject()
 {
     global $ilAccess;
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("tst_change_workingtime");
     $form->setTitle($this->lng->txt("tst_change_workingtime"));
     // test users
     $participantslist = new ilSelectInputGUI($this->lng->txt('participants'), "participant");
     $participants =& $this->object->getTestParticipants();
     $times = $this->object->getStartingTimeOfParticipants();
     $addons = $this->object->getTimeExtensionsOfParticipants();
     $options = array('' => $this->lng->txt('please_select'), '0' => $this->lng->txt('all_participants'));
     foreach ($participants as $participant) {
         $started = "";
         if ($this->object->getAnonymity()) {
             $name = $this->lng->txt("anonymous");
         } else {
             $name = $participant['lastname'] . ', ' . $participant['firstname'];
         }
         if ($times[$participant['active_id']]) {
             $started = ", " . $this->lng->txt('tst_started') . ': ' . ilDatePresentation::formatDate(new ilDateTime($times[$participant['active_id']], IL_CAL_DATETIME));
         }
         if ($addons[$participant['active_id']] > 0) {
             $started .= ", " . $this->lng->txt('extratime') . ': ' . $addons[$participant['active_id']] . ' ' . $this->lng->txt('minutes');
         }
         $options[$participant['active_id']] = $participant['login'] . ' (' . $name . ')' . $started;
     }
     $participantslist->setRequired(true);
     $participantslist->setOptions($options);
     $form->addItem($participantslist);
     // extra time
     $extratime = new ilNumberInputGUI($this->lng->txt("extratime"), "extratime");
     $extratime->setInfo($this->lng->txt('tst_extratime_info'));
     $extratime->setRequired(true);
     $extratime->setMinValue(0);
     $extratime->setMinvalueShouldBeGreater(false);
     $extratime->setSuffix($this->lng->txt('minutes'));
     $extratime->setSize(5);
     $form->addItem($extratime);
     if (is_array($_POST) && strlen($_POST['cmd']['timing'])) {
         $form->setValuesByArray($_POST);
     }
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form->addCommandButton("timing", $this->lng->txt("save"));
     }
     $form->addCommandButton('timingOverview', $this->lng->txt("cancel"));
     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(FALSE);
     $form->setTableWidth("100%");
     $form->setId("orderinghorizontal");
     $this->addBasicQuestionFormProperties($form);
     // ordertext
     $ordertext = new ilTextAreaInputGUI($this->lng->txt("ordertext"), "ordertext");
     $ordertext->setValue($this->object->prepareTextareaOutput($this->object->getOrderText()));
     $ordertext->setRequired(TRUE);
     $ordertext->setInfo(sprintf($this->lng->txt("ordertext_info"), $this->object->separator));
     $ordertext->setRows(10);
     $ordertext->setCols(80);
     $form->addItem($ordertext);
     // textsize
     $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
     $textsize->setValue($this->object->getTextSize());
     $textsize->setInfo($this->lng->txt("textsize_info"));
     $textsize->setSize(6);
     $textsize->setMinValue(10);
     $textsize->setRequired(FALSE);
     $form->addItem($textsize);
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     // mbecker: Fix for mantis bug 7866: Predefined values schould make sense.
     // This implements a default value of "1" for this question type.
     if ($this->object->getPoints() == null) {
         $points->setValue("1");
     } else {
         $points->setValue($this->object->getPoints());
     }
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0.0);
     $points->setMinvalueShouldBeGreater(true);
     $form->addItem($points);
     $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;
 }
 /**
  * Initializes the preview settings form.
  */
 private function initPreviewSettingsForm()
 {
     global $ilCtrl, $lng;
     require_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($ilCtrl->getFormAction($this));
     $form->setTitle($lng->txt("settings"));
     require_once "Services/Preview/classes/class.ilPreviewSettings.php";
     // drag and drop file upload in repository
     $chk_prop = new ilCheckboxInputGUI($lng->txt("enable_preview"), "enable_preview");
     $chk_prop->setValue('1');
     $chk_prop->setChecked(ilPreviewSettings::isPreviewEnabled());
     $chk_prop->setInfo($lng->txt('enable_preview_info'));
     $form->addItem($chk_prop);
     $num_prop = new ilNumberInputGUI($lng->txt("max_previews_per_object"), "max_previews_per_object");
     $num_prop->setDecimals(0);
     $num_prop->setMinValue(1);
     $num_prop->setMinvalueShouldBeGreater(false);
     $num_prop->setMaxValue(ilPreviewSettings::MAX_PREVIEWS_MAX);
     $num_prop->setMaxvalueShouldBeLess(false);
     $num_prop->setMaxLength(5);
     $num_prop->setSize(10);
     $num_prop->setValue(ilPreviewSettings::getMaximumPreviews());
     $num_prop->setInfo($lng->txt('max_previews_per_object_info'));
     $form->addItem($num_prop);
     // command buttons
     $form->addCommandButton('savePreviewSettings', $lng->txt('save'));
     $form->addCommandButton('view', $lng->txt('cancel'));
     return $form;
 }
 public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
 {
     $orderingtype = $this->getOrderingTypeFromPost();
     // Edit mode
     $hidden = new ilHiddenInputGUI("ordering_type");
     $hidden->setValue($orderingtype);
     $form->addItem($hidden);
     if (!$this->object->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);
     }
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->allowDecimals(true);
     $points->setValue($this->object->getPoints());
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0);
     $points->setMinvalueShouldBeGreater(true);
     $form->addItem($points);
     return $form;
 }
 public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
 {
     // ordertext
     $ordertext = new ilTextAreaInputGUI($this->lng->txt("ordertext"), "ordertext");
     $ordertext->setValue($this->object->prepareTextareaOutput($this->object->getOrderText()));
     $ordertext->setRequired(TRUE);
     $ordertext->setInfo(sprintf($this->lng->txt("ordertext_info"), $this->object->separator));
     $ordertext->setRows(10);
     $ordertext->setCols(80);
     $form->addItem($ordertext);
     // textsize
     $textsize = new ilNumberInputGUI($this->lng->txt("textsize"), "textsize");
     $textsize->setValue($this->object->getTextSize());
     $textsize->setInfo($this->lng->txt("textsize_info"));
     $textsize->setSize(6);
     $textsize->setMinValue(10);
     $textsize->setRequired(FALSE);
     $form->addItem($textsize);
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->allowDecimals(true);
     // mbecker: Fix for mantis bug 7866: Predefined values schould make sense.
     // This implements a default value of "1" for this question type.
     if ($this->object->getPoints() == null) {
         $points->setValue("1");
     } else {
         $points->setValue($this->object->getPoints());
     }
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0.0);
     $points->setMinvalueShouldBeGreater(true);
     $form->addItem($points);
 }
 /**
  * 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("assnumeric");
     $this->addBasicQuestionFormProperties($form);
     // maxchars
     $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
     $maxchars->setSize(10);
     $maxchars->setDecimals(0);
     $maxchars->setMinValue(1);
     $maxchars->setRequired(true);
     if ($this->object->getMaxChars() > 0) {
         $maxchars->setValue($this->object->getMaxChars());
     }
     $form->addItem($maxchars);
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->setValue($this->object->getPoints() > 0 ? $this->object->getPoints() : '');
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0.0);
     $points->setMinvalueShouldBeGreater(true);
     $form->addItem($points);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("range"));
     $form->addItem($header);
     // lower bound
     $lower_limit = new ilFormulaInputGUI($this->lng->txt("range_lower_limit"), "lowerlimit");
     $lower_limit->setSize(25);
     $lower_limit->setMaxLength(20);
     $lower_limit->setRequired(true);
     $lower_limit->setValue($this->object->getLowerLimit());
     $form->addItem($lower_limit);
     // upper bound
     $upper_limit = new ilFormulaInputGUI($this->lng->txt("range_upper_limit"), "upperlimit");
     $upper_limit->setSize(25);
     $upper_limit->setMaxLength(20);
     $upper_limit->setRequired(true);
     $upper_limit->setValue($this->object->getUpperLimit());
     $form->addItem($upper_limit);
     $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;
 }
 /**
  * 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;
 }
 /**
  * @param ilPropertyFormGUI $form
  */
 private function addTestRunProperties(ilPropertyFormGUI $form)
 {
     // section header test run
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("tst_settings_header_test_run"));
     $form->addItem($header);
     // max. number of passes
     $limitPasses = new ilCheckboxInputGUI($this->lng->txt("tst_limit_nr_of_tries"), 'limitPasses');
     $limitPasses->setInfo($this->lng->txt("tst_nr_of_tries_desc"));
     $limitPasses->setChecked($this->testOBJ->getNrOfTries() > 0);
     $nr_of_tries = new ilNumberInputGUI($this->lng->txt("tst_nr_of_tries"), "nr_of_tries");
     $nr_of_tries->setSize(3);
     $nr_of_tries->allowDecimals(false);
     $nr_of_tries->setMinValue(1);
     $nr_of_tries->setMinvalueShouldBeGreater(false);
     $nr_of_tries->setValue($this->testOBJ->getNrOfTries() ? $this->testOBJ->getNrOfTries() : 1);
     $nr_of_tries->setRequired(true);
     if ($this->testOBJ->participantDataExist()) {
         $limitPasses->setDisabled(true);
         $nr_of_tries->setDisabled(true);
     }
     $limitPasses->addSubItem($nr_of_tries);
     $form->addItem($limitPasses);
     // enable max. processing time
     $processing = new ilCheckboxInputGUI($this->lng->txt("tst_processing_time"), "chb_processing_time");
     $processing->setInfo($this->lng->txt("tst_processing_time_desc"));
     $processing->setValue(1);
     if ($this->settingsTemplate && $this->getTemplateSettingValue('chb_processing_time')) {
         $processing->setChecked(true);
     } else {
         $processing->setChecked($this->testOBJ->getEnableProcessingTime());
     }
     // max. processing time
     $processingtime = new ilNumberInputGUI($this->lng->txt("tst_processing_time_duration"), 'processing_time');
     $processingtime->allowDecimals(false);
     $processingtime->setMinValue(1);
     $processingtime->setMinvalueShouldBeGreater(false);
     $processingtime->setValue($this->testOBJ->getProcessingTimeAsMinutes());
     $processingtime->setSize(5);
     $processingtime->setSuffix($this->lng->txt('minutes'));
     $processingtime->setInfo($this->lng->txt("tst_processing_time_duration_desc"));
     $processing->addSubItem($processingtime);
     // reset max. processing time
     $resetprocessing = new ilCheckboxInputGUI('', "chb_reset_processing_time");
     $resetprocessing->setValue(1);
     $resetprocessing->setOptionTitle($this->lng->txt("tst_reset_processing_time"));
     $resetprocessing->setChecked($this->testOBJ->getResetProcessingTime());
     $resetprocessing->setInfo($this->lng->txt("tst_reset_processing_time_desc"));
     $processing->addSubItem($resetprocessing);
     $form->addItem($processing);
     // kiosk mode
     $kiosk = new ilCheckboxInputGUI($this->lng->txt("kiosk"), "kiosk");
     $kiosk->setValue(1);
     $kiosk->setChecked($this->testOBJ->getKioskMode());
     $kiosk->setInfo($this->lng->txt("kiosk_description"));
     // kiosk mode options
     $kiosktitle = new ilCheckboxGroupInputGUI($this->lng->txt("kiosk_options"), "kiosk_options");
     $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_title"), 'kiosk_title', ''));
     $kiosktitle->addOption(new ilCheckboxOption($this->lng->txt("kiosk_show_participant"), 'kiosk_participant', ''));
     $values = array();
     if ($this->testOBJ->getShowKioskModeTitle()) {
         array_push($values, 'kiosk_title');
     }
     if ($this->testOBJ->getShowKioskModeParticipant()) {
         array_push($values, 'kiosk_participant');
     }
     $kiosktitle->setValue($values);
     $kiosktitle->setInfo($this->lng->txt("kiosk_options_desc"));
     $kiosk->addSubItem($kiosktitle);
     $form->addItem($kiosk);
     $examIdInPass = new ilCheckboxInputGUI($this->lng->txt('examid_in_test_pass'), 'examid_in_test_pass');
     $examIdInPass->setInfo($this->lng->txt('examid_in_test_pass_desc'));
     $examIdInPass->setChecked($this->testOBJ->isShowExamIdInTestPassEnabled());
     $form->addItem($examIdInPass);
 }
 public function populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
 {
     $scoringMode = new ilRadioGroupInputGUI($this->lng->txt('essay_scoring_mode'), 'scoring_mode');
     $scoringOptionNone = new ilRadioOption($this->lng->txt('essay_scoring_mode_without_keywords'), 'non', $this->lng->txt('essay_scoring_mode_without_keywords_desc'));
     $scoringOptionAnyKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_any'), 'any', $this->lng->txt('essay_scoring_mode_keyword_relation_any_desc'));
     $scoringOptionAllKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_all'), 'all', $this->lng->txt('essay_scoring_mode_keyword_relation_all_desc'));
     $scoringOptionOneKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_one'), 'one', $this->lng->txt('essay_scoring_mode_keyword_relation_one_desc'));
     $scoringMode->addOption($scoringOptionNone);
     $scoringMode->addOption($scoringOptionAnyKeyword);
     $scoringMode->addOption($scoringOptionAllKeyword);
     $scoringMode->addOption($scoringOptionOneKeyword);
     $scoringMode->setRequired(true);
     $scoringMode->setValue(strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation() : 'non');
     if ($this->object->getAnswerCount() == 0) {
         $this->object->addAnswer("", 1, 0, 0);
     }
     require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
     // Without Keywords
     $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points");
     $nonKeywordPoints->allowDecimals(true);
     $nonKeywordPoints->setValue($this->object->getPoints());
     $nonKeywordPoints->setRequired(TRUE);
     $nonKeywordPoints->setSize(3);
     $nonKeywordPoints->setMinValue(0.0);
     $nonKeywordPoints->setMinvalueShouldBeGreater(true);
     $scoringOptionNone->addSubItem($nonKeywordPoints);
     // Any Keyword
     $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword");
     $anyKeyword->setRequired(TRUE);
     $anyKeyword->setQuestionObject($this->object);
     $anyKeyword->setSingleline(TRUE);
     $anyKeyword->setValues($this->object->getAnswers());
     $scoringOptionAnyKeyword->addSubItem($anyKeyword);
     // All Keywords
     $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword");
     $allKeyword->setRequired(TRUE);
     //$allKeyword->setQuestionObject($this->object);
     //$allKeyword->setSingleline(TRUE);
     $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
     $scoringOptionAllKeyword->addSubItem($allKeyword);
     $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points");
     $allKeywordPoints->allowDecimals(true);
     $allKeywordPoints->setValue($this->object->getPoints());
     $allKeywordPoints->setRequired(TRUE);
     $allKeywordPoints->setSize(3);
     $allKeywordPoints->setMinValue(0.0);
     $allKeywordPoints->setMinvalueShouldBeGreater(true);
     $scoringOptionAllKeyword->addSubItem($allKeywordPoints);
     // One Keywords
     $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword");
     $oneKeyword->setRequired(TRUE);
     //$oneKeyword->setQuestionObject($this->object);
     //$oneKeyword->setSingleline(TRUE);
     $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
     $scoringOptionOneKeyword->addSubItem($oneKeyword);
     $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points");
     $oneKeywordPoints->allowDecimals(true);
     $oneKeywordPoints->setValue($this->object->getPoints());
     $oneKeywordPoints->setRequired(TRUE);
     $oneKeywordPoints->setSize(3);
     $oneKeywordPoints->setMinValue(0.0);
     $oneKeywordPoints->setMinvalueShouldBeGreater(true);
     $scoringOptionOneKeyword->addSubItem($oneKeywordPoints);
     $form->addItem($scoringMode);
 }
 public function build(ilTestRandomQuestionSetSourcePoolDefinition $sourcePool, $availableTaxonomyIds)
 {
     $this->setFormAction($this->ctrl->getFormAction($this->questionSetConfigGUI));
     $this->setTitle($this->lng->txt('tst_rnd_quest_set_cfg_pool_form'));
     $this->setId('tstRndQuestSetCfgPoolForm');
     $this->addCommandButton($this->getSaveCommand(), $this->lng->txt('save_and_back'));
     if (null !== $this->getSaveAndNewCommand()) {
         $this->addCommandButton($this->getSaveAndNewCommand(), $this->lng->txt('tst_save_and_create_new_rule'));
     }
     $this->addCommandButton(ilTestRandomQuestionSetConfigGUI::CMD_SHOW_SRC_POOL_DEF_LIST, $this->lng->txt('cancel'));
     $hiddenDefId = new ilHiddenInputGUI('src_pool_def_id');
     $hiddenDefId->setValue($sourcePool->getId());
     $this->addItem($hiddenDefId);
     $hiddenPoolId = new ilHiddenInputGUI('quest_pool_id');
     $hiddenPoolId->setValue($sourcePool->getPoolId());
     $this->addItem($hiddenPoolId);
     $nonEditablePoolLabel = new ilNonEditableValueGUI($this->lng->txt('tst_inp_source_pool_label'), 'quest_pool_label');
     $nonEditablePoolLabel->setValue($sourcePool->getPoolInfoLabel($this->lng));
     $this->addItem($nonEditablePoolLabel);
     if (count($availableTaxonomyIds)) {
         $taxRadio = new ilRadioGroupInputGUI($this->lng->txt('tst_inp_source_pool_filter_tax'), 'filter_tax');
         $taxRadio->setRequired(true);
         $taxRadio->addOption(new ilRadioOption($this->lng->txt('tst_inp_source_pool_no_tax_filter'), 0));
         $taxRadio->setValue(0);
         require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
         foreach ($availableTaxonomyIds as $taxId) {
             $taxonomy = new ilObjTaxonomy($taxId);
             $label = sprintf($this->lng->txt('tst_inp_source_pool_filter_tax_x'), $taxonomy->getTitle());
             $taxRadioOption = new ilRadioOption($label, $taxId);
             $taxRadio->addOption($taxRadioOption);
             $taxSelect = new ilTaxSelectInputGUI($taxId, "filter_tax_{$taxId}", false);
             $taxSelect->setRequired(true);
             $taxRadioOption->addSubItem($taxSelect);
             if ($taxId == $sourcePool->getOriginalFilterTaxId()) {
                 $taxRadio->setValue($sourcePool->getOriginalFilterTaxId());
                 $taxSelect->setValue($sourcePool->getOriginalFilterTaxNodeId());
             }
         }
         $this->addItem($taxRadio);
     } else {
         $hiddenNoTax = new ilHiddenInputGUI('filter_tax');
         $hiddenNoTax->setValue(0);
         $this->addItem($hiddenNoTax);
         $nonEditableNoTax = new ilNonEditableValueGUI($this->lng->txt('tst_inp_source_pool_filter_tax'), 'no_tax_label');
         $nonEditableNoTax->setValue($this->lng->txt('tst_inp_no_available_tax_hint'));
         $this->addItem($nonEditableNoTax);
     }
     if ($this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
         $questionAmountPerSourcePool = new ilNumberInputGUI($this->lng->txt('tst_inp_quest_amount_per_source_pool'), 'question_amount_per_pool');
         $questionAmountPerSourcePool->setRequired(true);
         $questionAmountPerSourcePool->allowDecimals(false);
         $questionAmountPerSourcePool->setMinValue(0);
         $questionAmountPerSourcePool->setMinvalueShouldBeGreater(true);
         $questionAmountPerSourcePool->setSize(4);
         if ($sourcePool->getQuestionAmount()) {
             $questionAmountPerSourcePool->setValue($sourcePool->getQuestionAmount());
         }
         $this->addItem($questionAmountPerSourcePool);
     }
 }
 private function buildSettingsForm()
 {
     /**
      * @var $ilAccess ilAccessHandler
      */
     global $ilAccess;
     include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("settings");
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt('settings'));
     $form->addItem($header);
     // question process locking behaviour (e.g. on saving users working data)
     $chb = new ilCheckboxInputGUI($this->lng->txt('ass_process_lock'), 'ass_process_lock');
     $chb->setChecked($this->object->getAssessmentProcessLockMode() != ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE);
     $chb->setInfo($this->lng->txt('ass_process_lock_desc'));
     $form->addItem($chb);
     $rg = new ilRadioGroupInputGUI($this->lng->txt('ass_process_lock_mode'), 'ass_process_lock_mode');
     $rg->setRequired(true);
     $opt = new ilRadioOption($this->lng->txt('ass_process_lock_mode_file'), ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_FILE);
     $opt->setInfo($this->lng->txt('ass_process_lock_mode_file_desc'));
     $rg->addOption($opt);
     $opt = new ilRadioOption($this->lng->txt('ass_process_lock_mode_db'), ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_DB);
     $opt->setInfo($this->lng->txt('ass_process_lock_mode_db_desc'));
     $rg->addOption($opt);
     if ($this->object->getAssessmentProcessLockMode() != ilObjAssessmentFolder::ASS_PROC_LOCK_MODE_NONE) {
         $rg->setValue($this->object->getAssessmentProcessLockMode());
     }
     $chb->addSubItem($rg);
     $assessmentSetting = new ilSetting('assessment');
     $imap_line_color = array_key_exists('imap_line_color', $_GET) ? $_GET['imap_line_color'] : $assessmentSetting->get('imap_line_color');
     if (strlen($imap_line_color) == 0) {
         $imap_line_color = 'FF0000';
     }
     $linepicker = new ilColorPickerInputGUI($this->lng->txt('assessment_imap_line_color'), 'imap_line_color');
     $linepicker->setValue($imap_line_color);
     $form->addItem($linepicker);
     $user_criteria = array_key_exists('user_criteria', $_GET) ? $_GET['user_criteria'] : $assessmentSetting->get('user_criteria');
     $userCriteria = new ilSelectInputGUI($this->lng->txt('user_criteria'), 'user_criteria');
     $userCriteria->setInfo($this->lng->txt('user_criteria_desc'));
     $userCriteria->setRequired(true);
     $fields = array('usr_id', 'login', 'email', 'matriculation', 'ext_account');
     $usr_fields = array();
     foreach ($fields as $field) {
         $usr_fields[$field] = $field;
     }
     $userCriteria->setOptions($usr_fields);
     $userCriteria->setValue($user_criteria);
     $form->addItem($userCriteria);
     $numRequiredAnswers = new ilNumberInputGUI($this->lng->txt('tst_skill_triggerings_num_req_answers'), 'num_req_answers');
     $numRequiredAnswers->setInfo($this->lng->txt('tst_skill_triggerings_num_req_answers_desc'));
     $numRequiredAnswers->setSize(4);
     $numRequiredAnswers->allowDecimals(false);
     $numRequiredAnswers->setMinValue(1);
     $numRequiredAnswers->setMinvalueShouldBeGreater(false);
     $numRequiredAnswers->setValue($this->object->getSkillTriggeringNumAnswersBarrier());
     $form->addItem($numRequiredAnswers);
     // question settings
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("assf_questiontypes"));
     $form->addItem($header);
     // available question types
     $allowed = new ilCheckboxGroupInputGUI($this->lng->txt('assf_allowed_questiontypes'), "chb_allowed_questiontypes");
     $questiontypes =& ilObjQuestionPool::_getQuestionTypes(TRUE);
     $forbidden_types = $this->object->_getForbiddenQuestionTypes();
     $allowedtypes = array();
     foreach ($questiontypes as $qt) {
         if (!in_array($qt['question_type_id'], $forbidden_types)) {
             array_push($allowedtypes, $qt['question_type_id']);
         }
     }
     $allowed->setValue($allowedtypes);
     foreach ($questiontypes as $type_name => $qtype) {
         $allowed->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
     }
     $allowed->setInfo($this->lng->txt('assf_allowed_questiontypes_desc'));
     $form->addItem($allowed);
     // manual scoring
     $manual = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_manual_scoring_activate'), "chb_manual_scoring");
     $manscoring = $this->object->_getManualScoring();
     $manual->setValue($manscoring);
     foreach ($questiontypes as $type_name => $qtype) {
         $manual->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
     }
     $manual->setInfo($this->lng->txt('assessment_log_manual_scoring_desc'));
     $form->addItem($manual);
     // scoring adjustment active
     $scoring_activation = new ilCheckboxInputGUI($this->lng->txt('assessment_scoring_adjust'), 'chb_scoring_adjust');
     $scoring_activation->setChecked($this->object->getScoringAdjustmentEnabled());
     $scoring_activation->setInfo($this->lng->txt('assessment_scoring_adjust_desc'));
     $form->addItem($scoring_activation);
     // scoring adjustment
     $scoring = new ilCheckboxGroupInputGUI($this->lng->txt('assessment_log_scoring_adjustment_activate'), "chb_scoring_adjustment");
     $scoring_active = $this->object->getScoringAdjustableQuestions();
     $scoring->setValue($scoring_active);
     foreach ($questiontypes as $type_name => $qtype) {
         $scoring->addOption(new ilCheckboxOption($type_name, $qtype["question_type_id"]));
     }
     $scoring->setInfo($this->lng->txt('assessment_log_scoring_adjustment_desc'));
     $form->addItem($scoring);
     if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
         $form->addCommandButton("saveSettings", $this->lng->txt("save"));
     }
     return $form;
 }
 private function buildResultSkillPointsInputField()
 {
     $questResultSkillPoints = new ilNumberInputGUI($this->lng->txt('tst_comp_points'), 'q_res_skill_points');
     $questResultSkillPoints->setRequired(true);
     $questResultSkillPoints->setSize(4);
     $questResultSkillPoints->setMinvalueShouldBeGreater(false);
     $questResultSkillPoints->setMinValue(1);
     $questResultSkillPoints->allowDecimals(false);
     $questResultSkillPoints->setValue($this->assignment->getSkillPoints());
     if (!$this->isManipulationEnabled()) {
         $questResultSkillPoints->setDisabled(true);
     }
     return $questResultSkillPoints;
 }
 /**
  * @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;
 }
 /**
  * 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("asstextquestion");
     // title, author, description, question, working time (assessment mode)
     $this->addBasicQuestionFormProperties($form);
     // maxchars
     $maxchars = new ilNumberInputGUI($this->lng->txt("maxchars"), "maxchars");
     $maxchars->setSize(5);
     if ($this->object->getMaxNumOfChars() > 0) {
         $maxchars->setValue($this->object->getMaxNumOfChars());
     }
     $maxchars->setInfo($this->lng->txt("description_maxchars"));
     $form->addItem($maxchars);
     if (!$this->getSelfAssessmentEditingMode()) {
         if ($this->object->getAnswerCount() == 0) {
             $this->object->addAnswer("", 0, 0, 0);
         }
         $scoringMode = new ilRadioGroupInputGUI($this->lng->txt('essay_scoring_mode'), 'scoring_mode');
         $scoringOptionNone = new ilRadioOption($this->lng->txt('essay_scoring_mode_without_keywords'), 'non', $this->lng->txt('essay_scoring_mode_without_keywords_desc'));
         $scoringOptionAnyKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_any'), 'any', $this->lng->txt('essay_scoring_mode_keyword_relation_any_desc'));
         $scoringOptionAllKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_all'), 'all', $this->lng->txt('essay_scoring_mode_keyword_relation_all_desc'));
         $scoringOptionOneKeyword = new ilRadioOption($this->lng->txt('essay_scoring_mode_keyword_relation_one'), 'one', $this->lng->txt('essay_scoring_mode_keyword_relation_one_desc'));
         $scoringMode->addOption($scoringOptionNone);
         $scoringMode->addOption($scoringOptionAnyKeyword);
         $scoringMode->addOption($scoringOptionAllKeyword);
         $scoringMode->addOption($scoringOptionOneKeyword);
         $scoringMode->setRequired(true);
         $scoringMode->setValue(strlen($this->object->getKeywordRelation()) ? $this->object->getKeywordRelation() : 'non');
         require_once "./Modules/TestQuestionPool/classes/class.ilEssayKeywordWizardInputGUI.php";
         // Without Keywords
         $nonKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "non_keyword_points");
         $nonKeywordPoints->setValue($this->object->getPoints());
         $nonKeywordPoints->setRequired(TRUE);
         $nonKeywordPoints->setSize(3);
         $nonKeywordPoints->setMinValue(0.0);
         $nonKeywordPoints->setMinvalueShouldBeGreater(true);
         $scoringOptionNone->addSubItem($nonKeywordPoints);
         // Any Keyword
         $anyKeyword = new ilEssayKeywordWizardInputGUI($this->lng->txt("answers"), "any_keyword");
         $anyKeyword->setRequired(TRUE);
         $anyKeyword->setQuestionObject($this->object);
         $anyKeyword->setSingleline(TRUE);
         $anyKeyword->setValues($this->object->getAnswers());
         $scoringOptionAnyKeyword->addSubItem($anyKeyword);
         // All Keywords
         $allKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "all_keyword");
         $allKeyword->setRequired(TRUE);
         //$allKeyword->setQuestionObject($this->object);
         //$allKeyword->setSingleline(TRUE);
         $allKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
         $scoringOptionAllKeyword->addSubItem($allKeyword);
         $allKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "all_keyword_points");
         $allKeywordPoints->setValue($this->object->getPoints());
         $allKeywordPoints->setRequired(TRUE);
         $allKeywordPoints->setSize(3);
         $allKeywordPoints->setMinValue(0.0);
         $allKeywordPoints->setMinvalueShouldBeGreater(true);
         $scoringOptionAllKeyword->addSubItem($allKeywordPoints);
         // One Keywords
         $oneKeyword = new ilTextWizardInputGUI($this->lng->txt("answers"), "one_keyword");
         $oneKeyword->setRequired(TRUE);
         //$oneKeyword->setQuestionObject($this->object);
         //$oneKeyword->setSingleline(TRUE);
         $oneKeyword->setValues(self::buildAnswerTextOnlyArray($this->object->getAnswers()));
         $scoringOptionOneKeyword->addSubItem($oneKeyword);
         $oneKeywordPoints = new ilNumberInputGUI($this->lng->txt("points"), "one_keyword_points");
         $oneKeywordPoints->setValue($this->object->getPoints());
         $oneKeywordPoints->setRequired(TRUE);
         $oneKeywordPoints->setSize(3);
         $oneKeywordPoints->setMinValue(0.0);
         $oneKeywordPoints->setMinvalueShouldBeGreater(true);
         $scoringOptionOneKeyword->addSubItem($oneKeywordPoints);
         $form->addItem($scoringMode);
     }
     $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;
 }
示例#16
0
 public function populateQuestionSpecificFormPart(ilPropertyFormGUI $form)
 {
     // maxsize
     $maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize");
     $maxsize->setValue($this->object->getMaxSize());
     $maxsize->setInfo($this->lng->txt("maxsize_info"));
     $maxsize->setSize(10);
     $maxsize->setMinValue(0);
     $maxsize->setMaxValue($this->determineMaxFilesize());
     $maxsize->setRequired(FALSE);
     $form->addItem($maxsize);
     // allowedextensions
     $allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions");
     $allowedextensions->setInfo($this->lng->txt("allowedextensions_info"));
     $allowedextensions->setValue($this->object->getAllowedExtensions());
     $allowedextensions->setRequired(FALSE);
     $form->addItem($allowedextensions);
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->allowDecimals(true);
     $points->setValue(is_numeric($this->object->getPoints()) && $this->object->getPoints() >= 0 ? $this->object->getPoints() : '');
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0.0);
     $points->setMinvalueShouldBeGreater(false);
     $form->addItem($points);
     $subcompl = new ilCheckboxInputGUI($this->lng->txt('ass_completion_by_submission'), 'completion_by_submission');
     $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
     $subcompl->setValue(1);
     $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
     $form->addItem($subcompl);
     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(false);
     $form->setTableWidth("100%");
     $form->setId("assfileupload");
     $this->addBasicQuestionFormProperties($form);
     // maxsize
     $maxsize = new ilNumberInputGUI($this->lng->txt("maxsize"), "maxsize");
     $maxsize->setValue($this->object->getMaxSize());
     $maxsize->setInfo($this->lng->txt("maxsize_info"));
     $maxsize->setSize(10);
     $maxsize->setMinValue(0);
     //mbecker: Quick fix for mantis bug 8595: Change size file
     $umf = get_cfg_var("upload_max_filesize");
     // get the value for the maximal post data from the php.ini (if available)
     $pms = get_cfg_var("post_max_size");
     //convert from short-string representation to "real" bytes
     $multiplier_a = array("K" => 1024, "M" => 1024 * 1024, "G" => 1024 * 1024 * 1024);
     $umf_parts = preg_split("/(\\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
     $pms_parts = preg_split("/(\\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
     if (count($umf_parts) == 2) {
         $umf = $umf_parts[0] * $multiplier_a[$umf_parts[1]];
     }
     if (count($pms_parts) == 2) {
         $pms = $pms_parts[0] * $multiplier_a[$pms_parts[1]];
     }
     // use the smaller one as limit
     $max_filesize = min($umf, $pms);
     if (!$max_filesize) {
         $max_filesize = max($umf, $pms);
     }
     $maxsize->setMaxValue($max_filesize);
     // end quick fix
     $maxsize->setRequired(FALSE);
     $form->addItem($maxsize);
     // allowedextensions
     $allowedextensions = new ilTextInputGUI($this->lng->txt("allowedextensions"), "allowedextensions");
     $allowedextensions->setInfo($this->lng->txt("allowedextensions_info"));
     $allowedextensions->setValue($this->object->getAllowedExtensions());
     $allowedextensions->setRequired(FALSE);
     $form->addItem($allowedextensions);
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->setValue(is_numeric($this->object->getPoints()) && $this->object->getPoints() >= 0 ? $this->object->getPoints() : '');
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0.0);
     $points->setMinvalueShouldBeGreater(false);
     $form->addItem($points);
     $subcompl = new ilCheckboxInputGUI($this->lng->txt('ass_completion_by_submission'), 'completion_by_submission');
     $subcompl->setInfo($this->lng->txt('ass_completion_by_submission_info'));
     $subcompl->setValue(1);
     $subcompl->setChecked($this->object->isCompletionBySubmissionEnabled());
     $form->addItem($subcompl);
     $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;
 }
示例#18
0
 public function populateAnswerSpecificFormPart(\ilPropertyFormGUI $form)
 {
     // points
     $points = new ilNumberInputGUI($this->lng->txt("points"), "points");
     $points->allowDecimals(true);
     $points->setValue($this->object->getPoints() > 0 ? $this->object->getPoints() : '');
     $points->setRequired(TRUE);
     $points->setSize(3);
     $points->setMinValue(0.0);
     $points->setMinvalueShouldBeGreater(true);
     $form->addItem($points);
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("range"));
     $form->addItem($header);
     // lower bound
     $lower_limit = new ilFormulaInputGUI($this->lng->txt("range_lower_limit"), "lowerlimit");
     $lower_limit->setSize(25);
     $lower_limit->setMaxLength(20);
     $lower_limit->setRequired(true);
     $lower_limit->setValue($this->object->getLowerLimit());
     $form->addItem($lower_limit);
     // upper bound
     $upper_limit = new ilFormulaInputGUI($this->lng->txt("range_upper_limit"), "upperlimit");
     $upper_limit->setSize(25);
     $upper_limit->setMaxLength(20);
     $upper_limit->setRequired(true);
     $upper_limit->setValue($this->object->getUpperLimit());
     $form->addItem($upper_limit);
     // reset input length, if max chars are set
     if ($this->object->getMaxChars() > 0) {
         $lower_limit->setSize($this->object->getMaxChars());
         $lower_limit->setMaxLength($this->object->getMaxChars());
         $upper_limit->setSize($this->object->getMaxChars());
         $upper_limit->setMaxLength($this->object->getMaxChars());
     }
 }
示例#19
0
 public function populateQuestionSpecificFormPart(\ilPropertyFormGUI $form)
 {
     // number of requested answers
     $correctanswers = new ilNumberInputGUI($this->lng->txt("nr_of_correct_answers"), "correctanswers");
     $correctanswers->setMinValue(1);
     $correctanswers->setDecimals(0);
     $correctanswers->setSize(3);
     $correctanswers->setValue($this->object->getCorrectAnswers());
     $correctanswers->setRequired(true);
     $form->addItem($correctanswers);
     // maximum available points
     $points = new ilNumberInputGUI($this->lng->txt("maximum_points"), "points");
     $points->setMinValue(0.0);
     $points->setMinvalueShouldBeGreater(true);
     $points->setSize(6);
     $points->setDisabled(true);
     $points->setValue($this->object->getMaximumPoints());
     $points->setRequired(false);
     $form->addItem($points);
     // text rating
     $textrating = new ilSelectInputGUI($this->lng->txt("text_rating"), "text_rating");
     $text_options = array("ci" => $this->lng->txt("cloze_textgap_case_insensitive"), "cs" => $this->lng->txt("cloze_textgap_case_sensitive"));
     if (!$this->object->getSelfAssessmentEditingMode()) {
         $text_options["l1"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1");
         $text_options["l2"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2");
         $text_options["l3"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3");
         $text_options["l4"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4");
         $text_options["l5"] = sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5");
     }
     $textrating->setOptions($text_options);
     $textrating->setValue($this->object->getTextRating());
     $form->addItem($textrating);
     return $form;
 }