Esempio n. 1
0
 /**
  * Shows the pass overview of the scored pass for one ore more users
  *
  * @access    public
  */
 function showUserResults($show_pass_details, $show_answers, $show_reached_points = FALSE)
 {
     $show_user_results = $_SESSION["show_user_results"];
     if (count($show_user_results) == 0) {
         ilUtil::sendInfo($this->lng->txt("select_one_user"), TRUE);
         $this->ctrl->redirect($this, "participants");
     }
     $template = $this->createUserResults($show_pass_details, $show_answers, $show_reached_points, $show_user_results);
     $this->tpl->setVariable("ADM_CONTENT", $template->get());
     $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
     if ($this->object->getShowSolutionAnswersOnly()) {
         $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
     }
 }
Esempio n. 2
0
 /**
  * Creates an output of the solution of an answer compared to the correct solution
  *
  * @access public
  */
 protected function outCorrectSolution()
 {
     if (!$this->object->getShowSolutionDetails()) {
         ilUtil::sendInfo($this->lng->txt("no_permission"), true);
         $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
     }
     $testSession = $this->testSessionFactory->getSession();
     $activeId = $testSession->getActiveId();
     if (!($activeId > 0)) {
         $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
     }
     $this->ctrl->saveParameter($this, "pass");
     $pass = (int) $_GET['pass'];
     $questionId = (int) $_GET['evaluation'];
     if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
         $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
         $testSequence->loadFromDb();
         $testSequence->loadQuestions();
         require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
         $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
         $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
         $objectivesList->loadObjectivesTitles();
     } else {
         $objectivesList = null;
     }
     global $ilTabs;
     if ($this instanceof ilTestEvalObjectiveOrientedGUI) {
         $ilTabs->setBackTarget($this->lng->txt("tst_back_to_virtual_pass"), $this->ctrl->getLinkTarget($this, 'showVirtualPass'));
     } else {
         $ilTabs->setBackTarget($this->lng->txt("tst_back_to_pass_details"), $this->ctrl->getLinkTarget($this, 'outUserPassDetails'));
     }
     include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
     $this->tpl->setCurrentBlock("ContentStyle");
     $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setCurrentBlock("SyntaxStyle");
     $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
     $this->tpl->parseCurrentBlock();
     $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
     if ($this->object->getShowSolutionAnswersOnly()) {
         $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
     }
     $solution = $this->getCorrectSolutionOutput($questionId, $activeId, $pass, $objectivesList);
     $this->tpl->setContent($solution);
 }
 /**
  * Returns an output of the solution to an answer compared to the correct solution
  *
  * @param integer $question_id Database ID of the question
  * @param integer $active_id Active ID of the active user
  * @param integer $pass Test pass
  * @return string HTML code of the correct solution comparison
  * @access public
  */
 function getCorrectSolutionOutput($question_id, $active_id, $pass)
 {
     global $ilUser;
     $test_id = $this->object->getTestId();
     $question_gui = $this->object->createQuestionGUI("", $question_id);
     $template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE, "Modules/Test");
     $show_question_only = $this->object->getShowSolutionAnswersOnly() ? TRUE : FALSE;
     $result_output = $question_gui->getSolutionOutput($active_id, $pass, TRUE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, FALSE, TRUE);
     $best_output = $question_gui->getSolutionOutput($active_id, $pass, FALSE, FALSE, $show_question_only, FALSE, TRUE, FALSE, FALSE);
     if ($this->object->getShowSolutionFeedback() && $_GET['cmd'] != 'outCorrectSolution') {
         $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput($active_id, $pass);
         if (strlen($specificAnswerFeedback)) {
             $template->setCurrentBlock("outline_specific_feedback");
             $template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
             $template->parseCurrentBlock();
         }
     }
     if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output)) {
         $template->setCurrentBlock("best_solution");
         $template->setVariable("TEXT_BEST_SOLUTION", $this->lng->txt("tst_best_solution_is"));
         $template->setVariable("BEST_OUTPUT", $best_output);
         $template->parseCurrentBlock();
     }
     $template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
     $maxpoints = $question_gui->object->getMaximumPoints();
     if ($maxpoints == 1) {
         $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
     } else {
         $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
     }
     $template->setVariable("SOLUTION_OUTPUT", $result_output);
     $template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
     $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $template->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back"));
     return $template->get();
 }
 /**
  * Shows the pass overview of the scored pass for one ore more users
  *
  * @access	public
  */
 function showUserResults($show_pass_details, $show_answers, $show_reached_points = FALSE)
 {
     $template = new ilTemplate("tpl.il_as_tst_participants_result_output.html", TRUE, TRUE, "Modules/Test");
     if (count($_SESSION["show_user_results"]) == 0) {
         ilUtil::sendInfo($this->lng->txt("select_one_user"), TRUE);
         $this->ctrl->redirect($this, "participants");
     }
     include_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
     $serviceGUI =& new ilTestServiceGUI($this->object);
     $count = 0;
     foreach ($_SESSION["show_user_results"] as $key => $active_id) {
         $count++;
         $results = "";
         if ($this->object->getFixedParticipants()) {
             $active_id = $this->object->getActiveIdOfUser($active_id);
         }
         if ($active_id > 0) {
             $results = $serviceGUI->getResultsOfUserOutput($active_id, $this->object->_getResultPass($active_id), $show_pass_details, $show_answers, FALSE, $show_reached_points);
         }
         if ($count < count($_SESSION["show_user_results"])) {
             $template->touchBlock("break");
         }
         $template->setCurrentBlock("user_result");
         $template->setVariable("USER_RESULT", $results);
         $template->parseCurrentBlock();
     }
     $template->setVariable("BACK_TEXT", $this->lng->txt("back"));
     $template->setVariable("BACK_URL", $this->ctrl->getLinkTargetByClass("ilobjtestgui", "participants"));
     $template->setVariable("PRINT_TEXT", $this->lng->txt("print"));
     $template->setVariable("PRINT_URL", "javascript:window.print();");
     $this->tpl->setVariable("ADM_CONTENT", $template->get());
     $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
     if ($this->object->getShowSolutionAnswersOnly()) {
         $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
     }
 }
 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);
 }