protected function getPassDetailsOverview($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList = null)
 {
     $this->ctrl->setParameter($targetGUI, 'active_id', $active_id);
     $this->ctrl->setParameter($targetGUI, 'pass', $pass);
     $tableGUI = $this->buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD);
     $tableGUI->setAnswerListAnchorEnabled($questionAnchorNav);
     $tableGUI->setSingleAnswerScreenCmd($questionDetailsCMD);
     $tableGUI->setShowHintCount($this->object->isOfferingQuestionHintsEnabled());
     if ($objectivesList !== null) {
         $tableGUI->setQuestionRelatedObjectivesList($objectivesList);
         $tableGUI->setObjectiveOrientedPresentationEnabled(true);
     }
     $tableGUI->setActiveId($active_id);
     $tableGUI->setPass($pass);
     $tableGUI->setShowSuggestedSolution(false);
     $usersQuestionSolutions = array();
     foreach ($result_array as $key => $val) {
         if ($key === 'test' || $key === 'pass') {
             continue;
         }
         if ($this->object->getShowSolutionSuggested() && strlen($val['solution'])) {
             $tableGUI->setShowSuggestedSolution(true);
         }
         if (isset($val['pass'])) {
             $tableGUI->setPassColumnEnabled(true);
         }
         $usersQuestionSolutions[$key] = $val;
     }
     $tableGUI->initColumns()->initFilter();
     $tableGUI->setFilterCommand($targetCMD . 'SetTableFilter');
     $tableGUI->setResetCommand($targetCMD . 'ResetTableFilter');
     $tableGUI->setData($usersQuestionSolutions);
     return $this->ctrl->getHTML($tableGUI);
 }
 /**
  * Returns the pass details overview for a given active ID and pass
  *
  * @param array $result_array An array containing the results of the users test pass (generated by ilObjTest::getTestResult)
  * @param integer $active_id Active ID of the active user
  * @param integer $pass Test pass
  * @param string $targetclass The name of the ILIAS class for the "pass details" URL (optional)
  * @param string $targetcommand The name of the ILIAS command for the "pass details" URL (optional)
  * @param string $targetcommanddetails The name of the ILIAS command which should be called for the details of an answer (optional)
  * @param boolean $standard_header TRUE if the table headers should be plain text, FALSE if the table headers should be URL's for sortable columns
  * @return string HTML code of the pass details overview
  * @access public
  */
 function getPassDetailsOverview($result_array, $active_id, $pass, $targetclass = "", $targetcommandsort = "", $targetcommanddetails = "", $standard_header = TRUE)
 {
     global $ilUser;
     $testresults = $result_array["pass"];
     unset($result_array["test"]);
     $user_id = $this->object->_getUserIdFromActiveId($active_id);
     $sort = $_GET["sort"] ? $_GET["sort"] : "nr";
     $sortorder = $_GET["sortorder"] ? $_GET["sortorder"] : "asc";
     if (!$standard_header) {
         // change sortorder of result array
         usort($result_array, "sortResults");
     }
     $color_class = array("tblrow1top", "tblrow2top");
     $counter = 0;
     $template = new ilTemplate("tpl.il_as_tst_pass_details_overview.html", TRUE, TRUE, "Modules/Test");
     $this->ctrl->setParameterByClass($targetclass, "pass", "{$pass}");
     if (!$testresults["total_max_points"]) {
         $percentage = 0;
     } else {
         $percentage = $testresults["total_reached_points"] / $testresults["total_max_points"] * 100;
     }
     $total_max = $testresults["total_max_points"];
     $total_reached = $testresults["total_reached_points"];
     $totalRequestedHints = $testresults["total_requested_hints"];
     $img_title_percent = "";
     $img_title_nr = "";
     $hasSuggestedSolutions = FALSE;
     if ($this->object->getShowSolutionSuggested()) {
         foreach ($result_array as $key => $value) {
             if (strlen($value["solution"])) {
                 $hasSuggestedSolutions = TRUE;
             }
         }
     }
     foreach ($result_array as $key => $value) {
         if (preg_match("/\\d+/", $key)) {
             if (strlen($targetclass) && strlen($targetcommanddetails)) {
                 $template->setCurrentBlock("linked_title");
                 $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                 $template->setVariable("VALUE_QUESTION_TITLE", $value["title"]);
                 $this->ctrl->setParameterByClass($targetclass, "evaluation", $value["qid"]);
                 $this->ctrl->setParameterByClass($targetclass, "active_id", $active_id);
                 $template->setVariable("URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommanddetails));
                 $template->parseCurrentBlock();
             } else {
                 $template->setCurrentBlock("plain_title");
                 $template->setVariable("VALUE_QUESTION_TITLE", $value["title"]);
                 $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                 $template->parseCurrentBlock();
             }
             if ($hasSuggestedSolutions) {
                 $template->setCurrentBlock("question_suggested_solution");
                 $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
                 $template->setVariable("SOLUTION_HINT", $this->object->prepareTextareaOutput($value["solution"], true));
                 $template->parseCurrentBlock();
             }
             $template->setCurrentBlock("question");
             $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
             $template->setVariable("VALUE_QUESTION_COUNTER", $value["nr"]);
             $template->setVariable("VALUE_MAX_POINTS", $value["max"]);
             $template->setVariable("VALUE_REACHED_POINTS", $value["reached"]);
             if ($this->object->isOfferingQuestionHintsEnabled()) {
                 $template->setVariable("VALUE_HINT_COUNT", $value["requested_hints"]);
             }
             $template->setVariable("VALUE_PERCENT_SOLVED", $value["percent"]);
             $template->parseCurrentBlock();
             $counter++;
         }
     }
     if ($hasSuggestedSolutions) {
         $template->touchBlock("footer_suggested_solution");
     }
     $template->setCurrentBlock("footer");
     $template->setVariable("VALUE_QUESTION_COUNTER", "<strong>" . $this->lng->txt("total") . "</strong>");
     $template->setVariable("VALUE_QUESTION_TITLE", "");
     $template->setVariable("VALUE_MAX_POINTS", "<strong>{$total_max}</strong>");
     $template->setVariable("VALUE_REACHED_POINTS", "<strong>{$total_reached}</strong>");
     if ($this->object->isOfferingQuestionHintsEnabled()) {
         $template->setVariable("VALUE_TOTAL_HINT_COUNT", "<strong>{$totalRequestedHints}</strong>");
     }
     $template->setVariable("VALUE_PERCENT_SOLVED", "<strong>" . sprintf("%2.2f", $percentage) . " %" . "</strong>");
     $template->parseCurrentBlock();
     if ($standard_header) {
         if ($hasSuggestedSolutions) {
             $template->setCurrentBlock("standard_header_suggested_solution");
             $template->setVariable("SOLUTION_HINT_HEADER", $this->lng->txt("solution_hint"));
             $template->parseCurrentBlock();
         }
         $template->setCurrentBlock("standard_header");
         $template->setVariable("QUESTION_COUNTER", $this->lng->txt("tst_question_no"));
         $template->setVariable("PERCENT_SOLVED", $this->lng->txt("tst_percent_solved"));
         $template->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title"));
         $template->setVariable("MAX_POINTS", $this->lng->txt("tst_maximum_points"));
         $template->setVariable("REACHED_POINTS", $this->lng->txt("tst_reached_points"));
         if ($this->object->isOfferingQuestionHintsEnabled()) {
             $template->setVariable("HINT_COUNT", $this->lng->txt("tst_question_hints_requested_hint_count_header"));
         }
         $template->parseCurrentBlock();
     } else {
         if ($hasSuggestedSolutions) {
             $template->setCurrentBlock("linked_header_suggested_solution");
             if (strcmp($sort, "solution") == 0) {
                 $this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc");
             } else {
                 $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
             }
             $this->ctrl->setParameterByClass($targetclass, "sort", "solution");
             $template->setVariable("URL_SOLUTION_HINT_HEADER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
             $template->setVariable("SOLUTION_HINT_HEADER", $this->lng->txt("solution_hint"));
             if (strcmp($sort, "solution") == 0) {
                 $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test");
                 $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png"));
                 $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
                 $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
                 $template->setVariable("IMAGE_SOLUTION_HINT_HEADER", $image->get());
             }
             $template->parseCurrentBlock();
         }
         $template->setCurrentBlock("linked_header");
         $this->ctrl->setParameterByClass($targetclass, "sort", "nr");
         if (strcmp($sort, "nr") == 0) {
             $this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc");
         } else {
             $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
         }
         $template->setVariable("URL_QUESTION_COUNTER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
         $template->setVariable("QUESTION_COUNTER", $this->lng->txt("tst_question_no"));
         if (strcmp($sort, "nr") == 0) {
             $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test");
             $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png"));
             $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
             $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
             $template->setVariable("IMAGE_QUESTION_COUNTER", $image->get());
         }
         $this->ctrl->setParameterByClass($targetclass, "sort", "percent");
         if (strcmp($sort, "percent") == 0) {
             $this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc");
         } else {
             $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
         }
         $template->setVariable("URL_PERCENT_SOLVED", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
         $template->setVariable("PERCENT_SOLVED", $this->lng->txt("tst_percent_solved"));
         if (strcmp($sort, "percent") == 0) {
             $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test");
             $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png"));
             $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
             $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
             $template->setVariable("IMAGE_PERCENT_SOLVED", $image->get());
         }
         $this->ctrl->setParameterByClass($targetclass, "sort", "title");
         if (strcmp($sort, "title") == 0) {
             $this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc");
         } else {
             $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
         }
         $template->setVariable("URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
         $template->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title"));
         if (strcmp($sort, "title") == 0) {
             $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test");
             $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png"));
             $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
             $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
             $template->setVariable("IMAGE_QUESTION_TITLE", $image->get());
         }
         $this->ctrl->setParameterByClass($targetclass, "sort", "max");
         if (strcmp($sort, "max") == 0) {
             $this->ctrl->setParameterByClass($targetclass, "sortorder", strcmp($sortorder, "asc") ? "desc" : "asc");
         } else {
             $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
         }
         $template->setVariable("URL_MAX_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
         $template->setVariable("MAX_POINTS", $this->lng->txt("tst_maximum_points"));
         if (strcmp($sort, "max") == 0) {
             $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test");
             $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png"));
             $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
             $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
             $template->setVariable("IMAGE_MAX_POINTS", $image->get());
         }
         $this->ctrl->setParameterByClass($targetclass, "sort", "reached");
         if (strcmp($sort, "reached") == 0) {
             $this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc");
         } else {
             $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
         }
         $template->setVariable("URL_REACHED_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
         $template->setVariable("REACHED_POINTS", $this->lng->txt("tst_reached_points"));
         if (strcmp($sort, "reached") == 0) {
             $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test");
             $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png"));
             $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
             $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
             $template->setVariable("IMAGE_REACHED_POINTS", $image->get());
         }
         $template->parseCurrentBlock();
     }
     return $template->get();
 }
 private function addResultDetailsSettingsFormSection(ilPropertyFormGUI $form)
 {
     // HEADER: result settings
     $header_tr = new ilFormSectionHeaderGUI();
     $header_tr->setTitle($this->lng->txt('tst_results_details_options'));
     $form->addItem($header_tr);
     // show solution details
     $showSolutionDetails = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_details'), 'solution_details');
     $showSolutionDetails->setInfo($this->lng->txt('tst_show_solution_details_desc'));
     $showSolutionDetails->setChecked($this->testOBJ->getShowSolutionDetails());
     $form->addItem($showSolutionDetails);
     // best solution in test results
     $results_print_best_solution = new ilCheckboxInputGUI($this->lng->txt('tst_results_print_best_solution'), 'print_bs_with_res');
     $results_print_best_solution->setInfo($this->lng->txt('tst_results_print_best_solution_info'));
     $results_print_best_solution->setChecked((bool) $this->testOBJ->isBestSolutionPrintedWithResult());
     $showSolutionDetails->addSubItem($results_print_best_solution);
     // show solution feedback ==> solution feedback in test results
     $showSolutionFeedbackOption = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_feedback'), 'solution_feedback');
     $showSolutionFeedbackOption->setInfo($this->lng->txt('tst_show_solution_feedback_desc'));
     $showSolutionFeedbackOption->setChecked($this->testOBJ->getShowSolutionFeedback());
     $form->addItem($showSolutionFeedbackOption);
     // show suggested solution
     $showSuggestedSolutionOption = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_suggested'), 'solution_suggested');
     $showSuggestedSolutionOption->setInfo($this->lng->txt('tst_show_solution_suggested_desc'));
     $showSuggestedSolutionOption->setChecked($this->testOBJ->getShowSolutionSuggested());
     $form->addItem($showSuggestedSolutionOption);
     // show solution printview ==> list of answers
     $showSolutionPrintview = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_printview'), 'solution_printview');
     $showSolutionPrintview->setInfo($this->lng->txt('tst_show_solution_printview_desc'));
     $showSolutionPrintview->setChecked($this->testOBJ->getShowSolutionPrintview());
     $form->addItem($showSolutionPrintview);
     // show best solution in list of answers
     $solutionCompareInput = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_compare'), 'solution_compare');
     $solutionCompareInput->setChecked($this->testOBJ->getShowSolutionListComparison());
     $showSolutionPrintview->addSubItem($solutionCompareInput);
     // solution answers only ==> printview of results (answers only)
     $solutionAnswersOnly = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_answers_only'), 'solution_answers_only');
     $solutionAnswersOnly->setInfo($this->lng->txt('tst_show_solution_answers_only_desc'));
     $solutionAnswersOnly->setChecked($this->testOBJ->getShowSolutionAnswersOnly());
     $showSolutionPrintview->addSubItem($solutionAnswersOnly);
     // high score
     $highscore = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_enabled"), "highscore_enabled");
     $highscore->setValue(1);
     $highscore->setChecked($this->testOBJ->getHighscoreEnabled());
     $highscore->setInfo($this->lng->txt("tst_highscore_description"));
     $form->addItem($highscore);
     $highscore_tables = new ilRadioGroupInputGUI($this->lng->txt('tst_highscore_mode'), 'highscore_mode');
     $highscore_tables->setRequired(true);
     $highscore_tables->setValue($this->testOBJ->getHighscoreMode());
     $highscore_table_own = new ilRadioOption($this->lng->txt('tst_highscore_own_table'), ilObjTest::HIGHSCORE_SHOW_OWN_TABLE);
     $highscore_table_own->setInfo($this->lng->txt('tst_highscore_own_table_description'));
     $highscore_tables->addOption($highscore_table_own);
     $highscore_table_other = new ilRadioOption($this->lng->txt('tst_highscore_top_table'), ilObjTest::HIGHSCORE_SHOW_TOP_TABLE);
     $highscore_table_other->setInfo($this->lng->txt('tst_highscore_top_table_description'));
     $highscore_tables->addOption($highscore_table_other);
     $highscore_table_other = new ilRadioOption($this->lng->txt('tst_highscore_all_tables'), ilObjTest::HIGHSCORE_SHOW_ALL_TABLES);
     $highscore_table_other->setInfo($this->lng->txt('tst_highscore_all_tables_description'));
     $highscore_tables->addOption($highscore_table_other);
     $highscore->addSubItem($highscore_tables);
     $highscore_top_num = new ilNumberInputGUI($this->lng->txt("tst_highscore_top_num"), "highscore_top_num");
     $highscore_top_num->setSize(4);
     $highscore_top_num->setRequired(true);
     $highscore_top_num->setMinValue(1);
     $highscore_top_num->setSuffix($this->lng->txt("tst_highscore_top_num_unit"));
     $highscore_top_num->setValue($this->testOBJ->getHighscoreTopNum(null));
     $highscore_top_num->setInfo($this->lng->txt("tst_highscore_top_num_description"));
     $highscore->addSubItem($highscore_top_num);
     $highscore_anon = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_anon"), "highscore_anon");
     $highscore_anon->setValue(1);
     $highscore_anon->setChecked($this->testOBJ->getHighscoreAnon());
     $highscore_anon->setInfo($this->lng->txt("tst_highscore_anon_description"));
     $highscore->addSubItem($highscore_anon);
     $highscore_achieved_ts = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_achieved_ts"), "highscore_achieved_ts");
     $highscore_achieved_ts->setValue(1);
     $highscore_achieved_ts->setChecked($this->testOBJ->getHighscoreAchievedTS());
     $highscore_achieved_ts->setInfo($this->lng->txt("tst_highscore_achieved_ts_description"));
     $highscore->addSubItem($highscore_achieved_ts);
     $highscore_score = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_score"), "highscore_score");
     $highscore_score->setValue(1);
     $highscore_score->setChecked($this->testOBJ->getHighscoreScore());
     $highscore_score->setInfo($this->lng->txt("tst_highscore_score_description"));
     $highscore->addSubItem($highscore_score);
     $highscore_percentage = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_percentage"), "highscore_percentage");
     $highscore_percentage->setValue(1);
     $highscore_percentage->setChecked($this->testOBJ->getHighscorePercentage());
     $highscore_percentage->setInfo($this->lng->txt("tst_highscore_percentage_description"));
     $highscore->addSubItem($highscore_percentage);
     $highscore_hints = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_hints"), "highscore_hints");
     $highscore_hints->setValue(1);
     $highscore_hints->setChecked($this->testOBJ->getHighscoreHints());
     $highscore_hints->setInfo($this->lng->txt("tst_highscore_hints_description"));
     $highscore->addSubItem($highscore_hints);
     $highscore_wtime = new ilCheckboxInputGUI($this->lng->txt("tst_highscore_wtime"), "highscore_wtime");
     $highscore_wtime->setValue(1);
     $highscore_wtime->setChecked($this->testOBJ->getHighscoreWTime());
     $highscore_wtime->setInfo($this->lng->txt("tst_highscore_wtime_description"));
     $highscore->addSubItem($highscore_wtime);
     // show signature placeholder
     $showSignaturePlaceholder = new ilCheckboxInputGUI($this->lng->txt('tst_show_solution_signature'), 'solution_signature');
     $showSignaturePlaceholder->setInfo($this->lng->txt('tst_show_solution_signature_desc'));
     $showSignaturePlaceholder->setChecked($this->testOBJ->getShowSolutionSignature());
     if ($this->testOBJ->getAnonymity()) {
         $showSignaturePlaceholder->setDisabled(true);
     }
     $form->addItem($showSignaturePlaceholder);
     // show signature placeholder
     $showExamId = new ilCheckboxInputGUI($this->lng->txt('examid_in_test_res'), 'examid_in_test_res');
     $showExamId->setInfo($this->lng->txt('examid_in_test_res_desc'));
     $showExamId->setChecked($this->testOBJ->isShowExamIdInTestResultsEnabled());
     $form->addItem($showExamId);
     // export settings
     $export_settings = new ilCheckboxInputGUI($this->lng->txt('tst_exp_sc_short'), 'exp_sc_short');
     $export_settings->setInfo($this->lng->txt('tst_exp_sc_short_desc'));
     $export_settings->setChecked($this->testOBJ->getExportSettingsSingleChoiceShort());
     $form->addItem($export_settings);
 }
 /**
  * Display and fill the scoring settings form of the test
  *
  * @access	public
  */
 function scoringObject($checkonly = FALSE)
 {
     global $ilAccess;
     if (!$ilAccess->checkAccess("write", "", $this->ref_id)) {
         // allow only write access
         ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
         $this->ctrl->redirect($this, "infoScreen");
     }
     // using template?
     $template_settings = null;
     $template = $this->object->getTemplate();
     if ($template) {
         include_once "Services/Administration/classes/class.ilSettingsTemplate.php";
         include_once "Modules/Test/classes/class.ilObjAssessmentFolderGUI.php";
         $template = new ilSettingsTemplate($template, ilObjAssessmentFolderGUI::getSettingsTemplateConfig());
         $template_settings = $template->getSettings();
     }
     $save = strcmp($this->ctrl->getCmd(), "saveScoring") == 0 ? TRUE : FALSE;
     $total = $this->object->evalTotalPersons();
     $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js");
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $form->setTableWidth("100%");
     $form->setId("test_properties_scoring");
     // scoring properties
     $header = new ilFormSectionHeaderGUI();
     $header->setTitle($this->lng->txt("scoring"));
     $form->addItem($header);
     // scoring system
     $count_system = new ilRadioGroupInputGUI($this->lng->txt("tst_text_count_system"), "count_system");
     $count_system->addOption(new ilRadioOption($this->lng->txt("tst_count_partial_solutions"), 0, ''));
     $count_system->addOption(new ilRadioOption($this->lng->txt("tst_count_correct_solutions"), 1, ''));
     $count_system->setValue($this->object->getCountSystem());
     $count_system->setInfo($this->lng->txt("tst_count_system_description"));
     if ($total) {
         $count_system->setDisabled(true);
     }
     $form->addItem($count_system);
     // mc questions
     $mc_scoring = new ilRadioGroupInputGUI($this->lng->txt("tst_score_mcmr_questions"), "mc_scoring");
     $mc_scoring->addOption(new ilRadioOption($this->lng->txt("tst_score_mcmr_zero_points_when_unanswered"), 0, ''));
     $mc_scoring->addOption(new ilRadioOption($this->lng->txt("tst_score_mcmr_use_scoring_system"), 1, ''));
     $mc_scoring->setValue($this->object->getMCScoring());
     $mc_scoring->setInfo($this->lng->txt("tst_score_mcmr_questions_description"));
     if ($total) {
         $mc_scoring->setDisabled(true);
     }
     $form->addItem($mc_scoring);
     // score cutting
     $score_cutting = new ilRadioGroupInputGUI($this->lng->txt("tst_score_cutting"), "score_cutting");
     $score_cutting->addOption(new ilRadioOption($this->lng->txt("tst_score_cut_question"), 0, ''));
     $score_cutting->addOption(new ilRadioOption($this->lng->txt("tst_score_cut_test"), 1, ''));
     $score_cutting->setValue($this->object->getScoreCutting());
     $score_cutting->setInfo($this->lng->txt("tst_score_cutting_description"));
     if ($total) {
         $score_cutting->setDisabled(true);
     }
     $form->addItem($score_cutting);
     // pass scoring
     $pass_scoring = new ilRadioGroupInputGUI($this->lng->txt("tst_pass_scoring"), "pass_scoring");
     $pass_scoring->addOption(new ilRadioOption($this->lng->txt("tst_pass_last_pass"), 0, ''));
     $pass_scoring->addOption(new ilRadioOption($this->lng->txt("tst_pass_best_pass"), 1, ''));
     $pass_scoring->setValue($this->object->getPassScoring());
     $pass_scoring->setInfo($this->lng->txt("tst_pass_scoring_description"));
     if ($total) {
         $pass_scoring->setDisabled(true);
     }
     $form->addItem($pass_scoring);
     // enable obligations
     $checkBoxEnableObligations = new ilCheckboxInputGUI($this->lng->txt("tst_setting_enable_obligations_label"), "obligations_enabled");
     $checkBoxEnableObligations->setChecked($this->object->areObligationsEnabled());
     $checkBoxEnableObligations->setInfo($this->lng->txt("tst_setting_enable_obligations_info"));
     if ($total) {
         $checkBoxEnableObligations->setDisabled(true);
     }
     $form->addItem($checkBoxEnableObligations);
     // offer hints
     $checkBoxOfferHints = new ilCheckboxInputGUI($this->lng->txt("tst_setting_offer_hints_label"), "offer_hints");
     $checkBoxOfferHints->setChecked($this->object->isOfferingQuestionHintsEnabled());
     $checkBoxOfferHints->setInfo($this->lng->txt("tst_setting_offer_hints_info"));
     if ($total) {
         $checkBoxOfferHints->setDisabled(true);
     }
     $form->addItem($checkBoxOfferHints);
     // instant feedback
     $instant_feedback = new ilCheckboxGroupInputGUI($this->lng->txt("tst_instant_feedback"), "instant_feedback");
     $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_answer_specific"), 'instant_feedback_specific', ''));
     $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_answer_generic"), 'instant_feedback_generic', ''));
     $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_results"), 'instant_feedback_points', ''));
     $instant_feedback->addOption(new ilCheckboxOption($this->lng->txt("tst_instant_feedback_solution"), 'instant_feedback_solution', ''));
     $values = array();
     if ($this->object->getSpecificAnswerFeedback()) {
         array_push($values, 'instant_feedback_specific');
     }
     if ($this->object->getGenericAnswerFeedback()) {
         array_push($values, 'instant_feedback_generic');
     }
     if ($this->object->getAnswerFeedbackPoints()) {
         array_push($values, 'instant_feedback_points');
     }
     if ($this->object->getInstantFeedbackSolution()) {
         array_push($values, 'instant_feedback_solution');
     }
     $instant_feedback->setValue($values);
     $instant_feedback->setInfo($this->lng->txt("tst_instant_feedback_description"));
     $form->addItem($instant_feedback);
     // access to test results
     $results_access = new ilRadioGroupInputGUI($this->lng->txt("tst_results_access"), "results_access");
     $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_always"), 2, ''));
     $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_finished"), 1, ''));
     $results_access_date_limitation = new ilRadioOption($this->lng->txt("tst_results_access_date"), 3, '');
     $results_access->addOption($results_access_date_limitation);
     $results_access->addOption(new ilRadioOption($this->lng->txt("tst_results_access_never"), 4, ''));
     $results_access->setValue($this->object->getScoreReporting());
     $results_access->setInfo($this->lng->txt("tst_results_access_description"));
     // access date
     $reporting_date = new ilDateTimeInputGUI('', 'reporting_date');
     $reporting_date->setShowDate(true);
     $reporting_date->setShowTime(true);
     if (strlen($this->object->getReportingDate())) {
         $reporting_date->setDate(new ilDateTime($this->object->getReportingDate(), IL_CAL_TIMESTAMP));
     } else {
         $reporting_date->setDate(new ilDateTime(time(), IL_CAL_UNIX));
     }
     $results_access_date_limitation->addSubItem($reporting_date);
     $form->addItem($results_access);
     $results_print_best_solution = new ilCheckboxInputGUI($this->lng->txt("tst_results_print_best_solution"), "print_bs_with_res");
     $results_print_best_solution->setInfo($this->lng->txt('tst_results_print_best_solution_info'));
     $results_print_best_solution->setValue(1);
     $results_print_best_solution->setChecked((bool) $this->object->isBestSolutionPrintedWithResult());
     $form->addItem($results_print_best_solution);
     // results presentation
     $results_presentation = new ilCheckboxGroupInputGUI($this->lng->txt("tst_results_presentation"), "results_presentation");
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_pass_details"), 'pass_details', ''));
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_details"), 'solution_details', ''));
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_printview"), 'solution_printview', ''));
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_feedback"), 'solution_feedback', ''));
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_answers_only"), 'solution_answers_only', ''));
     $signatureOption = new ilCheckboxOption($this->lng->txt("tst_show_solution_signature"), 'solution_signature', '');
     $results_presentation->addOption($signatureOption);
     $results_presentation->addOption(new ilCheckboxOption($this->lng->txt("tst_show_solution_suggested"), 'solution_suggested', ''));
     $values = array();
     if ($this->object->getShowPassDetails()) {
         array_push($values, 'pass_details');
     }
     if ($this->object->getShowSolutionDetails()) {
         array_push($values, 'solution_details');
     }
     if ($this->object->getShowSolutionPrintview()) {
         array_push($values, 'solution_printview');
     }
     if ($this->object->getShowSolutionFeedback()) {
         array_push($values, 'solution_feedback');
     }
     if ($this->object->getShowSolutionAnswersOnly()) {
         array_push($values, 'solution_answers_only');
     }
     if ($this->object->getShowSolutionSignature()) {
         array_push($values, 'solution_signature');
     }
     if ($this->object->getShowSolutionSuggested()) {
         array_push($values, 'solution_suggested');
     }
     $results_presentation->setValue($values);
     $results_presentation->setInfo($this->lng->txt("tst_results_presentation_description"));
     if ($this->object->getAnonymity()) {
         $signatureOption->setDisabled(true);
     }
     $form->addItem($results_presentation);
     // deletion of test results
     $passDeletion = new ilRadioGroupInputGUI($this->lng->txt("tst_pass_deletion"), "pass_deletion_allowed");
     $passDeletion->addOption(new ilRadioOption($this->lng->txt("tst_pass_deletion_not_allowed"), 0, ''));
     $passDeletion->addOption(new ilRadioOption($this->lng->txt("tst_pass_deletion_allowed"), 1, ''));
     $passDeletion->setValue($this->object->isPassDeletionAllowed());
     $form->addItem($passDeletion);
     // export settings
     $export_settings = new ilCheckboxGroupInputGUI($this->lng->txt("tst_export_settings"), "export_settings");
     $export_settings->addOption(new ilCheckboxOption($this->lng->txt("tst_exp_sc_short"), 'exp_sc_short', ''));
     $values = array();
     if ($this->object->getExportSettingsSingleChoiceShort()) {
         array_push($values, 'exp_sc_short');
     }
     $export_settings->setValue($values);
     $form->addItem($export_settings);
     if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
         $form->addCommandButton("saveScoring", $this->lng->txt("save"));
     }
     // remove items when using template
     if ($template_settings) {
         foreach ($template_settings as $id => $item) {
             if ($item["hide"]) {
                 $form->removeItemByPostVar($id);
             }
         }
     }
     $errors = false;
     if ($save) {
         $errors = !$form->checkInput();
         $form->setValuesByPost();
         if ($errors) {
             $checkonly = false;
         }
     }
     if (!$checkonly) {
         $this->tpl->setVariable("ADM_CONTENT", $form->getHTML());
     }
     return $errors;
 }