24 include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
   25 include_once 
'Modules/Test/classes/class.ilTestService.php';
 
   79                 $this->
object =& $a_object;
 
   81                 $this->ref_id = $a_object->ref_id;
 
   91                 $cmd = $this->ctrl->getCmd();
 
   92                 $next_class = $this->ctrl->getNextClass($this);
 
  122         function getPassOverview($active_id, $targetclass = 
"", $targetcommand = 
"", $short = FALSE, $hide_details = FALSE)
 
  128                         $template = 
new ilTemplate(
"tpl.il_as_tst_pass_overview_short.html", TRUE, TRUE, 
"Modules/Test");
 
  132                         $template = 
new ilTemplate(
"tpl.il_as_tst_pass_overview.html", TRUE, TRUE, 
"Modules/Test");
 
  134                 $color_class = array(
"tblrow1", 
"tblrow2");
 
  137                 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
  138                 $counted_pass = $this->
object->_getResultPass($active_id);
 
  139                 $reached_pass = $this->
object->_getPass($active_id);
 
  141                 $result_percentage = 0;
 
  142                 $result_total_reached = 0;
 
  143                 $result_total_max = 0;
 
  146                         $finishdate = $this->
object->getPassFinishDate($active_id, 
$pass);
 
  151                                         $result_array =& $this->
object->getTestResult($active_id, 
$pass);
 
  152                                         if (!$result_array[
"pass"][
"total_max_points"])
 
  158                                                 $percentage = ($result_array[
"pass"][
"total_reached_points"]/$result_array[
"pass"][
"total_max_points"])*100;
 
  160                                         $total_max = $result_array[
"pass"][
"total_max_points"];
 
  161                                         $total_reached = $result_array[
"pass"][
"total_reached_points"];
 
  162                                         $total_requested_hints = $result_array[
"pass"][
"total_requested_hints"];
 
  166                                         if (strlen($targetclass) && strlen($targetcommand))
 
  168                                                 $this->ctrl->setParameterByClass($targetclass, 
"active_id", $active_id);
 
  169                                                 $this->ctrl->setParameterByClass($targetclass, 
"pass", 
$pass);
 
  170                                                 $template->setCurrentBlock(
"pass_details");
 
  172                                                 require_once 
'./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
 
  174                                                 $aslgui->setListTitle($this->lng->txt(
"actions"));
 
  175                                                 $aslgui->setId(
$pass);
 
  177                                                         $this->lng->txt(
"tst_pass_details"), 
 
  179                                                         $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand)
 
  181                                                 if($this->object->isPassDeletionAllowed() && 
$pass != $counted_pass)
 
  184                                                                 $this->lng->txt(
"delete"), 
 
  186                                                                 $this->ctrl->getLinkTargetByClass($targetclass, 
'confirmDeletePass')
 
  191                                                 if (!(
$_GET[
'pdf'] == 1))
 
  193                                                         $template->setVariable(
"TEXT_PASS_DETAILS", $aslgui->getHTML());
 
  195                                                 $template->parseCurrentBlock();
 
  199                                 $template->setCurrentBlock(
"result_row");
 
  201                                 if ((
$pass == $counted_pass) && (!$short))
 
  203                                         $template->setVariable(
"COLOR_CLASS", 
"tblrowmarked");
 
  204                                         $template->setVariable(
"VALUE_SCORED", 
"⊗");
 
  205                                         if (!$result_array[
"test"][
"total_max_points"])
 
  207                                                 $result_percentage = 0;
 
  211                                                 $result_percentage = ($result_array[
"test"][
"total_reached_points"]/$result_array[
"test"][
"total_max_points"])*100;
 
  213                                         $result_total_max = $result_array[
"test"][
"total_max_points"];
 
  214                                         $result_total_reached = $result_array[
"test"][
"total_reached_points"];
 
  218                                         $template->setVariable(
"COLOR_CLASS", $color_class[
$pass % 2]);
 
  220                                 $template->setVariable(
"VALUE_PASS", 
$pass + 1);
 
  225                                         $answered = $result_array[
'pass'][
'num_workedthrough'] . 
' ' . strtolower($this->lng->txt(
'of')) . 
' ' . (count($result_array) - 2);
 
  226                                         $template->setVariable(
"VALUE_ANSWERED", $answered);
 
  227                                         if( $this->object->isOfferingQuestionHintsEnabled() )
 
  229                                                 $template->setVariable(
"VALUE_HINTS", $total_requested_hints);
 
  231                                         $template->setVariable(
"VALUE_REACHED", $total_reached . 
" " . strtolower($this->lng->txt(
"of")) . 
" " . $total_max);
 
  232                                         $template->setVariable(
"VALUE_PERCENTAGE", sprintf(
"%.2f", $percentage) . 
"%");
 
  234                                 $template->parseCurrentBlock();
 
  238                 $template->setVariable(
"PASS_COUNTER", $this->lng->txt(
"pass"));
 
  239                 $template->setVariable(
"DATE", $this->lng->txt(
"date"));
 
  242                         $template->setVariable(
"PASS_SCORED", $this->lng->txt(
"scored_pass"));
 
  243                         $template->setVariable(
"ANSWERED_QUESTIONS", $this->lng->txt(
"tst_answered_questions"));
 
  244                         if( $this->object->isOfferingQuestionHintsEnabled() )
 
  246                                 $template->setVariable(
"REQUESTED_HINTS", $this->lng->txt(
"tst_question_hints_requested_hint_count_header"));
 
  248                         $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
 
  249                         $template->setVariable(
"PERCENTAGE_CORRECT", $this->lng->txt(
"tst_percent_solved"));
 
  251                 $template->parseCurrentBlock();
 
  253                 return $template->get();
 
  265                 $test_data_array = $this->
object->getResultsForActiveId($active_id);
 
  267                 $obligationsAnswered = $test_data_array[
'obligations_answered'];
 
  269                 if (!$test_data_array[
"max_points"])
 
  275                         $percentage = ($test_data_array[
"reached_points"]/$test_data_array[
"max_points"])*100;
 
  277                 $total_max = $test_data_array[
"max_points"];
 
  278                 $total_reached = $test_data_array[
"reached_points"];
 
  279                 $result_percentage = $percentage;
 
  280                 $result_total_reached = $total_reached;
 
  281                 $result_total_max = $total_max;
 
  285                 $mark_obj = $this->
object->mark_schema->getMatchingMark($result_percentage);
 
  288                         require_once 
'./Modules/Test/classes/class.ilTestFinalMarkLangVarBuilder.php';
 
  290                                         $mark_obj->getPassed(), $obligationsAnswered, $this->
object->areObligationsEnabled()
 
  293                         $mark = $this->lng->txt( $langVarBuilder->build() );
 
  295                         $mark = str_replace(
"[mark]", $mark_obj->getOfficialName(), $mark);
 
  296                         $mark = str_replace(
"[markshort]", $mark_obj->getShortName(), $mark);
 
  297                         $mark = str_replace(
"[percentage]", sprintf(
"%.2f", $result_percentage), $mark);
 
  298                         $mark = str_replace(
"[reached]", $result_total_reached, $mark);
 
  299                         $mark = str_replace(
"[max]", $result_total_max, $mark);
 
  301                 if ($this->object->ects_output)
 
  303                         $passed_array =& $this->
object->getTotalPointsPassedArray();
 
  304                         $ects_mark = $this->
object->getECTSGrade($passed_array, $result_total_reached, $result_total_max);
 
  305                         $markects = $this->lng->txt(
"mark_tst_ects");
 
  306                         $markects = str_replace(
"[markects]", $this->lng->txt(
"ects_grade_". strtolower($ects_mark)), $markects);
 
  308                 return array(
"mark" => $mark, 
"markects" => $markects);
 
  321         function getPassListOfAnswers(&$result_array, $active_id, 
$pass, $show_solutions = FALSE, $only_answered_questions = FALSE, $show_question_only = FALSE, $show_reached_points = FALSE)
 
  323                 $maintemplate = 
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", TRUE, TRUE, 
"Modules/Test");
 
  327                 foreach ($result_array as $question_data)
 
  329                         if (($question_data[
"workedthrough"] == 1) || ($only_answered_questions == FALSE))
 
  331                                 $template = 
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  332                                 $question = $question_data[
"qid"];
 
  333                                 if (is_numeric($question))
 
  335                                         $maintemplate->setCurrentBlock(
"printview_question");
 
  336                                         $question_gui = $this->
object->createQuestionGUI(
"", $question);
 
  337                                         if (is_object($question_gui))
 
  339                                                 if ($show_reached_points)
 
  341                                                         $template->setCurrentBlock(
"result_points");
 
  342                                                         $template->setVariable(
"RESULT_POINTS", $this->lng->txt(
"tst_reached_points") . 
": " . $question_gui->object->getReachedPoints($active_id, 
$pass) . 
" " . $this->lng->txt(
"of") . 
" " . $question_gui->object->getMaximumPoints());
 
  343                                                         $template->parseCurrentBlock();
 
  345                                                 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
 
  346                                                 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
 
  348                                                 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
 
  349                                                 $result_output = $question_gui->getSolutionOutput($active_id, 
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
 
  351                                                 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
 
  352                                                 $maintemplate->setCurrentBlock(
"printview_question");
 
  353                                                 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
 
  354                                                 $maintemplate->parseCurrentBlock();
 
  360                 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"tst_eval_results_by_pass"), 
$pass+1));
 
  361                 return $maintemplate->get();
 
  378                 include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  380                 $maintemplate = 
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", TRUE, TRUE, 
"Modules/Test");
 
  382                 include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
  387                 foreach ($result_array as $question_data)
 
  389                         $question = $question_data[
"qid"];
 
  390                         if (is_numeric($question))
 
  392                                 $question_gui = $this->
object->createQuestionGUI(
"", $question);
 
  393                                 if (in_array($question_gui->object->getQuestionTypeID(), $scoring))
 
  395                                         $template = 
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE, 
"Modules/TestQuestionPool");
 
  396                                         $scoretemplate = 
new ilTemplate(
"tpl.il_as_tst_manual_scoring_points.html", TRUE, TRUE, 
"Modules/Test");
 
  397                                         #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question"); 
  398                                         $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
 
  399                                         $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
 
  400                                         $points = $question_gui->object->getMaximumPoints();
 
  403                                                 $template->setVariable(
"QUESTION_POINTS", $points . 
" " . $this->lng->txt(
"point"));
 
  407                                                 $template->setVariable(
"QUESTION_POINTS", $points . 
" " . $this->lng->txt(
"points"));
 
  410                                         $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
 
  411                                         $result_output = $question_gui->getSolutionOutput($active_id, 
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, TRUE);
 
  413                                         $solout = $question_gui->object->getSuggestedSolutionOutput();
 
  416                                                 $scoretemplate->setCurrentBlock(
"suggested_solution");
 
  417                                                 $scoretemplate->setVariable(
"TEXT_SUGGESTED_SOLUTION", $this->lng->txt(
"solution_hint"));
 
  418                                                 $scoretemplate->setVariable(
"VALUE_SUGGESTED_SOLUTION", $solout);
 
  419                                                 $scoretemplate->parseCurrentBlock();
 
  422                                         $scoretemplate->setCurrentBlock(
"feedback");
 
  423                                         $scoretemplate->setVariable(
"FEEDBACK_NAME_INPUT", $question);
 
  424                                         $feedback = $this->
object->getManualFeedback($active_id, $question, 
$pass);
 
  425                                         $scoretemplate->setVariable(
"VALUE_FEEDBACK", 
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, TRUE)));
 
  426                                         $scoretemplate->setVariable(
"TEXT_MANUAL_FEEDBACK", $this->lng->txt(
"set_manual_feedback"));
 
  427                                         $scoretemplate->parseCurrentBlock();
 
  429                                         $scoretemplate->setVariable(
"NAME_INPUT", $question);
 
  430                                         $this->ctrl->setParameter($this, 
"active_id", $active_id);
 
  431                                         $this->ctrl->setParameter($this, 
"pass", 
$pass);
 
  432                                         $scoretemplate->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this, 
"manscoring"));
 
  433                                         $scoretemplate->setVariable(
"LABEL_INPUT", $this->lng->txt(
"tst_change_points_for_question"));
 
  435                                         $scoretemplate->setVariable(
"VALUE_SAVE", $this->lng->txt(
"save"));
 
  437                                         $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
 
  438                                         $maintemplate->setCurrentBlock(
"printview_question");
 
  439                                         $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
 
  440                                         $maintemplate->setVariable(
"QUESTION_SCORING", $scoretemplate->get());
 
  441                                         $maintemplate->parseCurrentBlock();
 
  449                         $maintemplate->setVariable(
"NO_QUESTIONS_FOUND", $this->lng->txt(
"manscoring_questions_not_found"));
 
  451                 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"manscoring_results_pass"), 
$pass+1));
 
  453                 include_once 
"./Services/YUI/classes/class.ilYuiUtil.php";
 
  456                 return $maintemplate->get();
 
  473         function getPassDetailsOverview($result_array, $active_id, 
$pass, $targetclass = 
"", $targetcommandsort = 
"", $targetcommanddetails = 
"", $standard_header = TRUE)
 
  477                 $testresults = $result_array[
"pass"];
 
  478                 unset($result_array[
"test"]);
 
  479                 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
  481                 $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) : 
"nr";
 
  482                 $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) : 
"asc";
 
  484                 if (!$standard_header)
 
  487                         usort($result_array, 
"sortResults");
 
  489                 $color_class = array(
"tblrow1top", 
"tblrow2top");
 
  491                 $template = 
new ilTemplate(
"tpl.il_as_tst_pass_details_overview.html", TRUE, TRUE, 
"Modules/Test");
 
  492                 $this->ctrl->setParameterByClass($targetclass, 
"pass", 
"$pass");
 
  494                 if (!$testresults[
"total_max_points"])
 
  500                         $percentage = ($testresults[
"total_reached_points"]/$testresults[
"total_max_points"])*100;
 
  502                 $total_max = $testresults[
"total_max_points"];
 
  503                 $total_reached = $testresults[
"total_reached_points"];
 
  504                 $totalRequestedHints = $testresults[
"total_requested_hints"];
 
  506                 $img_title_percent = 
"";
 
  508                 $hasSuggestedSolutions = FALSE;
 
  509                 if ($this->object->getShowSolutionSuggested())
 
  511                         foreach ($result_array as $key => $value)
 
  513                                 if (strlen($value[
"solution"]))
 
  515                                         $hasSuggestedSolutions = TRUE;
 
  519                 foreach ($result_array as $key => $value) 
 
  521                         if (preg_match(
"/\d+/", $key)) 
 
  523                                 if (strlen($targetclass) && strlen($targetcommanddetails))
 
  525                                         $template->setCurrentBlock(
"linked_title");
 
  526                                         $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
 
  527                                         $template->setVariable(
"VALUE_QUESTION_TITLE", $value[
"title"]);
 
  528                                         $this->ctrl->setParameterByClass($targetclass, 
"evaluation", $value[
"qid"]);
 
  529                                         $this->ctrl->setParameterByClass($targetclass, 
"active_id", $active_id);
 
  530                                         $template->setVariable(
"URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommanddetails));
 
  531                                         $template->parseCurrentBlock();
 
  535                                         $template->setCurrentBlock(
"plain_title");
 
  536                                         $template->setVariable(
"VALUE_QUESTION_TITLE", $value[
"title"]);
 
  537                                         $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
 
  538                                         $template->parseCurrentBlock();
 
  540                                 if ($hasSuggestedSolutions)
 
  542                                         $template->setCurrentBlock(
"question_suggested_solution");
 
  543                                         $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
 
  544                                         $template->setVariable(
"SOLUTION_HINT", $this->object->prepareTextareaOutput($value[
"solution"], 
true));
 
  545                                         $template->parseCurrentBlock();
 
  547                                 $template->setCurrentBlock(
"question");
 
  548                                 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
 
  549                                 $template->setVariable(
"VALUE_QUESTION_COUNTER", $value[
"nr"]);
 
  550                                 $template->setVariable(
"VALUE_MAX_POINTS", $value[
"max"]);
 
  551                                 $template->setVariable(
"VALUE_REACHED_POINTS", $value[
"reached"]);
 
  552                                 if( $this->object->isOfferingQuestionHintsEnabled() )
 
  554                                         $template->setVariable(
"VALUE_HINT_COUNT", $value[
"requested_hints"]);  
 
  556                                 $template->setVariable(
"VALUE_PERCENT_SOLVED", $value[
"percent"]);
 
  557                                 $template->parseCurrentBlock();
 
  562                 if ($hasSuggestedSolutions)
 
  564                         $template->touchBlock(
"footer_suggested_solution");
 
  566                 $template->setCurrentBlock(
"footer");
 
  567                 $template->setVariable(
"VALUE_QUESTION_COUNTER", 
"<strong>" . $this->lng->txt(
"total") . 
"</strong>");
 
  568                 $template->setVariable(
"VALUE_QUESTION_TITLE", 
"");
 
  569                 $template->setVariable(
"VALUE_MAX_POINTS", 
"<strong>$total_max</strong>");
 
  570                 $template->setVariable(
"VALUE_REACHED_POINTS", 
"<strong>$total_reached</strong>");
 
  571                 if( $this->object->isOfferingQuestionHintsEnabled() )
 
  573                         $template->setVariable(
"VALUE_TOTAL_HINT_COUNT", 
"<strong>$totalRequestedHints</strong>");
 
  575                 $template->setVariable(
"VALUE_PERCENT_SOLVED", 
"<strong>" . sprintf(
"%2.2f", $percentage) . 
" %" . 
"</strong>");
 
  576                 $template->parseCurrentBlock();
 
  578                 if ($standard_header)
 
  580                         if ($hasSuggestedSolutions)
 
  582                                 $template->setCurrentBlock(
"standard_header_suggested_solution");
 
  583                                 $template->setVariable(
"SOLUTION_HINT_HEADER", $this->lng->txt(
"solution_hint"));
 
  584                                 $template->parseCurrentBlock();
 
  586                         $template->setCurrentBlock(
"standard_header");
 
  587                         $template->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_question_no"));
 
  588                         $template->setVariable(
"PERCENT_SOLVED", $this->lng->txt(
"tst_percent_solved"));
 
  589                         $template->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
 
  590                         $template->setVariable(
"MAX_POINTS", $this->lng->txt(
"tst_maximum_points"));
 
  591                         $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
 
  592                         if( $this->object->isOfferingQuestionHintsEnabled() )
 
  594                                 $template->setVariable(
"HINT_COUNT", $this->lng->txt(
"tst_question_hints_requested_hint_count_header"));
 
  596                         $template->parseCurrentBlock();
 
  600                         if ($hasSuggestedSolutions)
 
  602                                 $template->setCurrentBlock(
"linked_header_suggested_solution");
 
  603                                 if (strcmp($sort, 
"solution") == 0)
 
  605                                         $this->ctrl->setParameterByClass($targetclass, 
"sortorder", !strcmp($sortorder, 
"asc") ? 
"desc" : 
"asc");
 
  609                                         $this->ctrl->setParameterByClass($targetclass, 
"sortorder", 
"asc");
 
  611                                 $this->ctrl->setParameterByClass($targetclass, 
"sort", 
"solution");
 
  612                                 $template->setVariable(
"URL_SOLUTION_HINT_HEADER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
 
  613                                 $template->setVariable(
"SOLUTION_HINT_HEADER", $this->lng->txt(
"solution_hint"));
 
  614                                 if (strcmp($sort, 
"solution") == 0)
 
  616                                         $image = 
new ilTemplate(
"tpl.image.html", TRUE, TRUE, 
"Modules/Test");
 
  618                                         $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
 
  619                                         $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
 
  620                                         $template->setVariable(
"IMAGE_SOLUTION_HINT_HEADER", $image->get());
 
  622                                 $template->parseCurrentBlock();
 
  624                         $template->setCurrentBlock(
"linked_header");
 
  625                         $this->ctrl->setParameterByClass($targetclass, 
"sort", 
"nr");
 
  626                         if (strcmp($sort, 
"nr") == 0)
 
  628                                 $this->ctrl->setParameterByClass($targetclass, 
"sortorder", !strcmp($sortorder, 
"asc") ? 
"desc" : 
"asc");
 
  632                                 $this->ctrl->setParameterByClass($targetclass, 
"sortorder", 
"asc");
 
  634                         $template->setVariable(
"URL_QUESTION_COUNTER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
 
  635                         $template->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_question_no"));
 
  636                         if (strcmp($sort, 
"nr") == 0)
 
  638                                 $image = 
new ilTemplate(
"tpl.image.html", TRUE, TRUE, 
"Modules/Test");
 
  640                                 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
 
  641                                 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
 
  642                                 $template->setVariable(
"IMAGE_QUESTION_COUNTER", $image->get());
 
  644                         $this->ctrl->setParameterByClass($targetclass, 
"sort", 
"percent");
 
  645                         if (strcmp($sort, 
"percent") == 0)
 
  647                                 $this->ctrl->setParameterByClass($targetclass, 
"sortorder", !strcmp($sortorder, 
"asc") ? 
"desc" : 
"asc");
 
  651                                 $this->ctrl->setParameterByClass($targetclass, 
"sortorder", 
"asc");
 
  653                         $template->setVariable(
"URL_PERCENT_SOLVED", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
 
  654                         $template->setVariable(
"PERCENT_SOLVED", $this->lng->txt(
"tst_percent_solved"));
 
  655                         if (strcmp($sort, 
"percent") == 0)
 
  657                                 $image = 
new ilTemplate(
"tpl.image.html", TRUE, TRUE, 
"Modules/Test");
 
  659                                 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
 
  660                                 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
 
  661                                 $template->setVariable(
"IMAGE_PERCENT_SOLVED", $image->get());
 
  663                         $this->ctrl->setParameterByClass($targetclass, 
"sort", 
"title");
 
  664                         if (strcmp($sort, 
"title") == 0)
 
  666                                 $this->ctrl->setParameterByClass($targetclass, 
"sortorder", !strcmp($sortorder, 
"asc") ? 
"desc" : 
"asc");
 
  670                                 $this->ctrl->setParameterByClass($targetclass, 
"sortorder", 
"asc");
 
  672                         $template->setVariable(
"URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
 
  673                         $template->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
 
  674                         if (strcmp($sort, 
"title") == 0)
 
  676                                 $image = 
new ilTemplate(
"tpl.image.html", TRUE, TRUE, 
"Modules/Test");
 
  678                                 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
 
  679                                 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
 
  680                                 $template->setVariable(
"IMAGE_QUESTION_TITLE", $image->get());
 
  682                         $this->ctrl->setParameterByClass($targetclass, 
"sort", 
"max");
 
  683                         if (strcmp($sort, 
"max") == 0)
 
  685                                 $this->ctrl->setParameterByClass($targetclass, 
"sortorder", strcmp($sortorder, 
"asc") ? 
"desc" : 
"asc");
 
  689                                 $this->ctrl->setParameterByClass($targetclass, 
"sortorder", 
"asc");
 
  691                         $template->setVariable(
"URL_MAX_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
 
  692                         $template->setVariable(
"MAX_POINTS", $this->lng->txt(
"tst_maximum_points"));
 
  693                         if (strcmp($sort, 
"max") == 0)
 
  695                                 $image = 
new ilTemplate(
"tpl.image.html", TRUE, TRUE, 
"Modules/Test");
 
  697                                 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
 
  698                                 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
 
  699                                 $template->setVariable(
"IMAGE_MAX_POINTS", $image->get());
 
  701                         $this->ctrl->setParameterByClass($targetclass, 
"sort", 
"reached");
 
  702                         if (strcmp($sort, 
"reached") == 0)
 
  704                                 $this->ctrl->setParameterByClass($targetclass, 
"sortorder", !strcmp($sortorder, 
"asc") ? 
"desc" : 
"asc");
 
  708                                 $this->ctrl->setParameterByClass($targetclass, 
"sortorder", 
"asc");
 
  710                         $template->setVariable(
"URL_REACHED_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
 
  711                         $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
 
  712                         if (strcmp($sort, 
"reached") == 0)
 
  714                                 $image = 
new ilTemplate(
"tpl.image.html", TRUE, TRUE, 
"Modules/Test");
 
  716                                 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
 
  717                                 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
 
  718                                 $template->setVariable(
"IMAGE_REACHED_POINTS", $image->get());
 
  720                         $template->parseCurrentBlock();
 
  723                 return $template->get();
 
  734                 if ($this->object->getShowSolutionSignature() && !$this->
object->getAnonymity())
 
  737                         $template = 
new ilTemplate(
"tpl.il_as_tst_results_userdata_signature.html", TRUE, TRUE, 
"Modules/Test");
 
  738                         $template->setVariable(
"TXT_DATE", $this->lng->txt(
"date"));
 
  739                         $template->setVariable(
"VALUE_DATE", strftime(
"%Y-%m-%d %H:%M:%S", time()));
 
  740                         $template->setVariable(
"TXT_SIGNATURE", $this->lng->txt(
"tst_signature"));
 
  742                         return $template->get();
 
  760                 $template = 
new ilTemplate(
"tpl.il_as_tst_results_userdata.html", TRUE, TRUE, 
"Modules/Test");
 
  761                 include_once 
'./Services/User/classes/class.ilObjUser.php';
 
  762                 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
  770                         $user->setLastname($this->lng->txt(
"deleted_user"));
 
  772                 $t = $this->
object->getTestSession($active_id)->getSubmittedTimestamp();
 
  775                         $t = $this->
object->_getLastAccess($this->object->getTestSession()->getActiveId());
 
  777                 $print_date = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m")  , date(
"d"), date(
"Y"));
 
  780                 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE) || ($overwrite_anonymity)))
 
  782                         $template->setCurrentBlock(
"user_matric");
 
  783                         $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
 
  784                         $template->parseCurrentBlock();
 
  785                         $template->setCurrentBlock(
"user_matric_value");
 
  786                         $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
 
  787                         $template->parseCurrentBlock();
 
  788                         $template->touchBlock(
"user_matric_separator");
 
  789                         $title_matric = 
" - " . $this->lng->txt(
"matriculation") . 
": " . $user->getMatriculation();
 
  792                 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
 
  793                 if (strlen($invited_user[
"clientip"]))
 
  795                         $template->setCurrentBlock(
"user_clientip");
 
  796                         $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
 
  797                         $template->parseCurrentBlock();
 
  798                         $template->setCurrentBlock(
"user_clientip_value");
 
  799                         $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
 
  800                         $template->parseCurrentBlock();
 
  801                         $template->touchBlock(
"user_clientip_separator");
 
  802                         $title_client = 
" - " . $this->lng->txt(
"clientip") . 
": " . $invited_user[
"clientip"];
 
  805                 $template->setVariable(
"TXT_TEST_TITLE", $this->lng->txt(
"title"));
 
  806                 $template->setVariable(
"VALUE_TEST_TITLE", $this->object->getTitle());
 
  807                 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
 
  808                 $uname = $this->
object->userLookupFullName($user_id, $overwrite_anonymity);
 
  809                 $template->setVariable(
"VALUE_USR_NAME", $uname);
 
  810                 $template->setVariable(
"TXT_TEST_DATE", $this->lng->txt(
"tst_tst_date"));
 
  812                 $template->setVariable(
"TXT_PRINT_DATE", $this->lng->txt(
"tst_print_date"));
 
  813                 $template->setVariable(
"VALUE_PRINT_DATE", strftime(
"%Y-%m-%d %H:%M:%S",$print_date));
 
  816                 $pagetitle = 
": " . $this->
object->getTitle() . $title_matric . $title_client;
 
  817                 $this->tpl->setHeaderPageTitle($pagetitle);
 
  819                 return $template->get();
 
  835                 $test_id = $this->
object->getTestId();
 
  836                 $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
 
  838                 $template = 
new ilTemplate(
"tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE, 
"Modules/Test");
 
  839                 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
 
  840                 $result_output = $question_gui->getSolutionOutput($active_id, 
$pass, TRUE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, FALSE, TRUE);
 
  841                 $best_output = $question_gui->getSolutionOutput($active_id, 
$pass, FALSE, FALSE, $show_question_only, FALSE, TRUE, FALSE, FALSE);
 
  842                 if( $this->object->getShowSolutionFeedback() && 
$_GET[
'cmd'] != 
'outCorrectSolution' )
 
  844                         $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput($active_id, 
$pass);
 
  845                         if( strlen($specificAnswerFeedback) )
 
  847                                 $template->setCurrentBlock(
"outline_specific_feedback");
 
  848                                 $template->setVariable(
"OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
 
  849                                 $template->parseCurrentBlock();
 
  852                 if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output))
 
  854                         $template->setCurrentBlock(
"best_solution");
 
  855                         $template->setVariable(
"TEXT_BEST_SOLUTION", $this->lng->txt(
"tst_best_solution_is"));
 
  856                         $template->setVariable(
"BEST_OUTPUT", $best_output);
 
  857                         $template->parseCurrentBlock();
 
  859                 $template->setVariable(
"TEXT_YOUR_SOLUTION", $this->lng->txt(
"tst_your_answer_was"));
 
  860                 $maxpoints = $question_gui->object->getMaximumPoints();
 
  863                         $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . 
" (" . $maxpoints . 
" " . $this->lng->txt(
"point") . 
")");
 
  867                         $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . 
" (" . $maxpoints . 
" " . $this->lng->txt(
"points") . 
")");
 
  869                 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
 
  870                 $template->setVariable(
"RECEIVED_POINTS", sprintf($this->lng->txt(
"you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, 
$pass), $maxpoints));
 
  871                 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
 
  872                 $template->setVariable(
"BACKLINK_TEXT", 
"<< " . $this->lng->txt(
"back"));
 
  873                 return $template->get();
 
  881         function getResultsOfUserOutput($active_id, 
$pass, $show_pass_details = TRUE, $show_answers = TRUE, $show_question_only = FALSE, $show_reached_points = FALSE)
 
  885                 include_once(
"./Services/UICore/classes/class.ilTemplate.php");
 
  886                 $template = 
new ilTemplate(
"tpl.il_as_tst_results_participant.html", TRUE, TRUE, 
"Modules/Test");
 
  888                 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
  889                 $uname = $this->
object->userLookupFullName($user_id, TRUE);
 
  891                 if (((array_key_exists(
"pass", 
$_GET)) && (strlen(
$_GET[
"pass"]) > 0)) || (!is_null(
$pass)))
 
  901                         $result_array =& $this->
object->getTestResult($active_id, 
$pass);
 
  902                         $command_solution_details = 
"";
 
  903                         if ($show_pass_details)
 
  905                                 $detailsoverview = $this->
getPassDetailsOverview($result_array, $active_id, 
$pass, 
"iltestservicegui", 
"getResultsOfUserOutput", $command_solution_details);
 
  908                         $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
  909                         $showAllAnswers = TRUE;
 
  910                         if ($this->object->isExecutable($user_id))
 
  912                                 $showAllAnswers = FALSE;
 
  916                                 $list_of_answers = $this->
getPassListOfAnswers($result_array, $active_id, 
$pass, FALSE, $showAllAnswers, $show_question_only, $show_reached_points);
 
  919                         $template->setVariable(
"LIST_OF_ANSWERS", $list_of_answers);
 
  921                         $template->setVariable(
"PASS_DETAILS", $detailsoverview);
 
  924                         $template->setVariable(
"SIGNATURE", $signature);
 
  926                 $template->setVariable(
"TEXT_HEADING", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
 
  927                 $template->setVariable(
"USER_DATA", $user_data);
 
  928                 $template->setVariable(
"USER_MARK", $statement[
"mark"]);
 
  929                 if (strlen($statement[
"markects"]))
 
  931                         $template->setVariable(
"USER_MARK_ECTS", $statement[
"markects"]);
 
  933                 $template->parseCurrentBlock();
 
  935                 return $template->get();
 
  947                 $template = 
new ilTemplate(
"tpl.il_as_tst_results_head_user_pass.html", TRUE, TRUE, 
"Modules/Test");
 
  948                 include_once 
'./Services/User/classes/class.ilObjUser.php';
 
  949                 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
  957                         $user->setLastname($this->lng->txt(
"deleted_user"));
 
  960                 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE)))
 
  962                         $template->setCurrentBlock(
"user_matric");
 
  963                         $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
 
  964                         $template->parseCurrentBlock();
 
  965                         $template->setCurrentBlock(
"user_matric_value");
 
  966                         $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
 
  967                         $template->parseCurrentBlock();
 
  968                         $template->touchBlock(
"user_matric_separator");
 
  969                         $title_matric = 
" - " . $this->lng->txt(
"matriculation") . 
": " . $user->getMatriculation();
 
  972                 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
 
  973                 if (strlen($invited_user[
"clientip"]))
 
  975                         $template->setCurrentBlock(
"user_clientip");
 
  976                         $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
 
  977                         $template->parseCurrentBlock();
 
  978                         $template->setCurrentBlock(
"user_clientip_value");
 
  979                         $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
 
  980                         $template->parseCurrentBlock();
 
  981                         $template->touchBlock(
"user_clientip_separator");
 
  982                         $title_client = 
" - " . $this->lng->txt(
"clientip") . 
": " . $invited_user[
"clientip"];
 
  985                 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
 
  986                 $uname = $this->
object->userLookupFullName($user_id, FALSE);
 
  987                 $template->setVariable(
"VALUE_USR_NAME", $uname);
 
  988                 $template->setVariable(
"TXT_PASS", $this->lng->txt(
"scored_pass"));
 
  989                 $template->setVariable(
"VALUE_PASS", 
$pass);
 
  990                 return $template->get();
 
 1004                 $question_gui =& $this->
object->createQuestionGUI(
"", $question_id);
 
 1006                 $foundusers = $this->
object->getParticipantsForTestAndQuestion($test_id, $question_id);
 
 1008                 foreach ($foundusers as $active_id => $passes)
 
 1010                         $resultpass = $this->
object->_getResultPass($active_id);
 
 1011                         for ($i = 0; $i < count($passes); $i++)
 
 1013                                 if (($resultpass !== null) && ($resultpass == $passes[$i][
"pass"]))
 
 1016                                         $question_gui =& $this->
object->createQuestionGUI(
"", $passes[$i][
"qid"]);
 
 1019                                         $output .= $question_gui->getSolutionOutput($active_id, $resultpass, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = FALSE, $show_feedback = FALSE);
 
 1020                                         $output .= 
"<br /><br /><br />";
 
 1024                 $this->
object->deliverPDFfromHTML($output, $question_gui->object->getTitle());
 
 1031         $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) : 
"nr";
 
 1032         $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) : 
"asc";
 
 1033         if (strcmp($sortorder, 
"asc")) 
 
 1043         if ($a[$sort] == $b[$sort]) 
return 0;
 
 1044         return ($a[$sort] < $b[$sort]) ? $smaller : $greater;