public function getAnswerFeedbackOutput($active_id, $pass)
 {
     include_once "./Modules/Test/classes/class.ilObjTest.php";
     $manual_feedback = ilObjTest::getManualFeedback($active_id, $this->object->getId(), $pass);
     if (strlen($manual_feedback)) {
         return $manual_feedback;
     }
     $correct_feedback = $this->object->getFeedbackGeneric(1);
     $incorrect_feedback = $this->object->getFeedbackGeneric(0);
     if (strlen($correct_feedback . $incorrect_feedback)) {
         $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
         $max_points = $this->object->getMaximumPoints();
         if ($reached_points == $max_points) {
             $output .= $correct_feedback;
         } else {
             $output .= $incorrect_feedback;
         }
     }
     $test = new ilObjTest($this->object->active_id);
     return $this->object->prepareTextareaOutput($output, TRUE);
 }
예제 #2
0
 /**
  * Returns the answer specific feedback for the question
  *
  * @param integer $active_id Active ID of the user
  * @param integer $pass Active pass
  * @return string HTML Code with the answer specific feedback
  * @access public
  */
 function getGenericFeedbackOutput($active_id, $pass)
 {
     $output = "";
     include_once "./Modules/Test/classes/class.ilObjTest.php";
     $manual_feedback = ilObjTest::getManualFeedback($active_id, $this->object->getId(), $pass);
     if (strlen($manual_feedback)) {
         return $manual_feedback;
     }
     $correct_feedback = $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), true);
     $incorrect_feedback = $this->object->feedbackOBJ->getGenericFeedbackTestPresentation($this->object->getId(), false);
     if (strlen($correct_feedback . $incorrect_feedback)) {
         $reached_points = $this->object->calculateReachedPoints($active_id, $pass);
         $max_points = $this->object->getMaximumPoints();
         if ($reached_points == $max_points) {
             $output = $correct_feedback;
         } else {
             $output = $incorrect_feedback;
         }
     }
     return $this->object->prepareTextareaOutput($output, TRUE);
 }
 /**
  * Returns the list of answers of a users test pass and offers a scoring option
  *
  * @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 boolean $show_solutions TRUE, if the solution output should be shown in the answers, FALSE otherwise
  * @return string HTML code of the list of answers
  * @access public
  * 
  * @deprecated
  */
 function getPassListOfAnswersWithScoring(&$result_array, $active_id, $pass, $show_solutions = FALSE)
 {
     include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
     $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", TRUE, TRUE, "Modules/Test");
     include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
     $scoring = ilObjAssessmentFolder::_getManualScoring();
     $counter = 1;
     // output of questions with solutions
     foreach ($result_array as $question_data) {
         $question = $question_data["qid"];
         if (is_numeric($question)) {
             $question_gui = $this->object->createQuestionGUI("", $question);
             if (in_array($question_gui->object->getQuestionTypeID(), $scoring)) {
                 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", TRUE, TRUE, "Modules/TestQuestionPool");
                 $scoretemplate = new ilTemplate("tpl.il_as_tst_manual_scoring_points.html", TRUE, TRUE, "Modules/Test");
                 #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
                 $template->setVariable("COUNTER_QUESTION", $counter . ". ");
                 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
                 $points = $question_gui->object->getMaximumPoints();
                 if ($points == 1) {
                     $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("point"));
                 } else {
                     $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("points"));
                 }
                 $show_question_only = $this->object->getShowSolutionAnswersOnly() ? TRUE : FALSE;
                 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, TRUE);
                 $solout = $question_gui->object->getSuggestedSolutionOutput();
                 if (strlen($solout)) {
                     $scoretemplate->setCurrentBlock("suggested_solution");
                     $scoretemplate->setVariable("TEXT_SUGGESTED_SOLUTION", $this->lng->txt("solution_hint"));
                     $scoretemplate->setVariable("VALUE_SUGGESTED_SOLUTION", $solout);
                     $scoretemplate->parseCurrentBlock();
                 }
                 $scoretemplate->setCurrentBlock("feedback");
                 $scoretemplate->setVariable("FEEDBACK_NAME_INPUT", $question);
                 $feedback = $this->object->getManualFeedback($active_id, $question, $pass);
                 $scoretemplate->setVariable("VALUE_FEEDBACK", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, TRUE)));
                 $scoretemplate->setVariable("TEXT_MANUAL_FEEDBACK", $this->lng->txt("set_manual_feedback"));
                 $scoretemplate->parseCurrentBlock();
                 $scoretemplate->setVariable("NAME_INPUT", $question);
                 $this->ctrl->setParameter($this, "active_id", $active_id);
                 $this->ctrl->setParameter($this, "pass", $pass);
                 $scoretemplate->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "manscoring"));
                 $scoretemplate->setVariable("LABEL_INPUT", $this->lng->txt("tst_change_points_for_question"));
                 $scoretemplate->setVariable("VALUE_INPUT", " value=\"" . assQuestion::_getReachedPoints($active_id, $question_data["qid"], $pass) . "\"");
                 $scoretemplate->setVariable("VALUE_SAVE", $this->lng->txt("save"));
                 $template->setVariable("SOLUTION_OUTPUT", $result_output);
                 $maintemplate->setCurrentBlock("printview_question");
                 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
                 $maintemplate->setVariable("QUESTION_SCORING", $scoretemplate->get());
                 $maintemplate->parseCurrentBlock();
             }
             $counter++;
         }
     }
     if ($counter == 1) {
         // no scorable questions found
         $maintemplate->setVariable("NO_QUESTIONS_FOUND", $this->lng->txt("manscoring_questions_not_found"));
     }
     $maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("manscoring_results_pass"), $pass + 1));
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initDomEvent();
     return $maintemplate->get();
 }