4 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
5 include_once
'Modules/Test/classes/class.ilTestService.php';
73 $this->
object =& $a_object;
75 $this->ref_id = $a_object->ref_id;
79 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
82 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
83 $this->testSequenceFactory =
new ilTestSequenceFactory($ilDB, $this->lng, $ilPluginAdmin, $this->
object);
91 $cmd = $this->ctrl->getCmd();
92 $next_class = $this->ctrl->getNextClass($this);
122 public function getPassOverview($active_id, $targetclass =
"", $targetcommand =
"", $short = FALSE, $hide_details = FALSE)
124 require_once
'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
125 require_once
'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
135 $counted_pass = $this->
object->_getResultPass($active_id);
136 $reached_pass = $this->
object->_getPass($active_id);
138 require_once
'Modules/Test/classes/class.ilTestPassesSelector.php';
140 $testPassesSelector->setActiveId($active_id);
141 $lastFinishedPass = $this->testSessionFactory->getSession($active_id)->getLastFinishedPass();
142 $testPassesSelector->setLastFinishedPass($lastFinishedPass);
144 foreach($testPassesSelector->getReportablePasses() as
$pass)
150 $result_array =& $this->
object->getTestResult($active_id,
$pass);
151 if(!$result_array[
'pass'][
'total_max_points'])
157 $percentage = ($result_array[
'pass'][
'total_reached_points'] / $result_array[
'pass'][
'total_max_points']) * 100;
159 $total_max = $result_array[
'pass'][
'total_max_points'];
160 $total_reached = $result_array[
'pass'][
'total_reached_points'];
161 $total_requested_hints = $result_array[
'pass'][
'total_requested_hints'];
165 if(strlen($targetclass) && strlen($targetcommand))
167 $this->ctrl->setParameterByClass($targetclass,
'active_id', $active_id);
168 $this->ctrl->setParameterByClass($targetclass,
'pass',
$pass);
171 $aslgui->setListTitle($this->lng->txt(
'actions'));
172 $aslgui->setId(
$pass);
174 $this->lng->txt(
'tst_pass_details'),
176 $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand)
178 if($this->object->isPassDeletionAllowed() &&
$pass != $counted_pass)
181 $this->lng->txt(
'delete'),
183 $this->ctrl->getLinkTargetByClass($targetclass,
'confirmDeletePass')
186 $row[
'pass_details'] = $aslgui->getHTML();
192 if((
$pass == $counted_pass))
194 $row[
'scored'] =
'⊗';
203 $row[
'date'] = $this->
object->getPassFinishDate($active_id,
$pass);
206 $row[
'answered'] = $result_array[
'pass'][
'num_workedthrough'] .
' ' . strtolower($this->lng->txt(
'of')) .
' ' . (count($result_array) - 2);
207 if($this->object->isOfferingQuestionHintsEnabled())
209 $row[
'hints'] = $total_requested_hints;
211 $row[
'reached'] = $total_reached .
' ' . strtolower($this->lng->txt(
'of')) .
' ' . $total_max;
212 $row[
'percentage'] = $percentage;
218 $table->setData($data);
219 return $table->getHTML();
231 $test_data_array = $this->
object->getResultsForActiveId($active_id);
233 $obligationsAnswered = $test_data_array[
'obligations_answered'];
235 if (!$test_data_array[
"max_points"])
241 $percentage = ($test_data_array[
"reached_points"]/$test_data_array[
"max_points"])*100;
243 $total_max = $test_data_array[
"max_points"];
244 $total_reached = $test_data_array[
"reached_points"];
245 $result_percentage = $percentage;
246 $result_total_reached = $total_reached;
247 $result_total_max = $total_max;
251 $mark_obj = $this->
object->mark_schema->getMatchingMark($result_percentage);
254 require_once
'./Modules/Test/classes/class.ilTestFinalMarkLangVarBuilder.php';
256 $mark_obj->getPassed(), $obligationsAnswered, $this->
object->areObligationsEnabled()
259 $mark = $this->lng->txt( $langVarBuilder->build() );
261 $mark = str_replace(
"[mark]", $mark_obj->getOfficialName(), $mark);
262 $mark = str_replace(
"[markshort]", $mark_obj->getShortName(), $mark);
263 $mark = str_replace(
"[percentage]", sprintf(
"%.2f", $result_percentage), $mark);
264 $mark = str_replace(
"[reached]", $result_total_reached, $mark);
265 $mark = str_replace(
"[max]", $result_total_max, $mark);
267 if ($this->object->ects_output)
269 $passed_array =& $this->
object->getTotalPointsPassedArray();
270 $ects_mark = $this->
object->getECTSGrade($passed_array, $result_total_reached, $result_total_max);
271 $markects = $this->lng->txt(
"mark_tst_ects");
272 $markects = str_replace(
"[markects]", $this->lng->txt(
"ects_grade_". strtolower($ects_mark)), $markects);
274 return array(
"mark" => $mark,
"markects" => $markects);
287 function getPassListOfAnswers(&$result_array, $active_id,
$pass, $show_solutions = FALSE, $only_answered_questions = FALSE, $show_question_only = FALSE, $show_reached_points = FALSE)
289 $maintemplate =
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", TRUE, TRUE,
"Modules/Test");
293 foreach ($result_array as $question_data)
295 if (($question_data[
"workedthrough"] == 1) || ($only_answered_questions == FALSE))
297 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
298 $question = $question_data[
"qid"];
299 if (is_numeric($question))
301 $maintemplate->setCurrentBlock(
"printview_question");
302 $question_gui = $this->
object->createQuestionGUI(
"", $question);
303 if (is_object($question_gui))
305 if ($show_reached_points)
307 $template->setCurrentBlock(
"result_points");
308 $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());
309 $template->parseCurrentBlock();
311 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
312 $template->setVariable(
"TXT_QUESTION_ID", $this->lng->txt(
'question_id_short'));
313 $template->setVariable(
"QUESTION_ID", $question_gui->object->getId());
314 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
316 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
320 $compare_template =
new ilTemplate(
'tpl.il_as_tst_answers_compare.html', TRUE, TRUE,
'Modules/Test');
321 $compare_template->setVariable(
"HEADER_PARTICIPANT", $this->lng->txt(
'tst_header_participant'));
322 $compare_template->setVariable(
"HEADER_SOLUTION", $this->lng->txt(
'tst_header_solution'));
323 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
324 $best_output = $question_gui->getSolutionOutput($active_id,
$pass, FALSE, FALSE, $show_question_only, FALSE, TRUE);
326 $compare_template->setVariable(
'PARTICIPANT', $result_output);
327 $compare_template->setVariable(
'SOLUTION', $best_output);
328 $template->setVariable(
'SOLUTION_OUTPUT', $compare_template->get());
332 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
333 $template->setVariable(
'SOLUTION_OUTPUT', $result_output);
336 $maintemplate->setCurrentBlock(
"printview_question");
337 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
338 $maintemplate->parseCurrentBlock();
344 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"tst_eval_results_by_pass"),
$pass + 1));
345 return $maintemplate->get();
362 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
364 $maintemplate =
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", TRUE, TRUE,
"Modules/Test");
366 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
371 foreach ($result_array as $question_data)
373 $question = $question_data[
"qid"];
374 if (is_numeric($question))
376 $question_gui = $this->
object->createQuestionGUI(
"", $question);
377 if (in_array($question_gui->object->getQuestionTypeID(), $scoring))
379 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
380 $scoretemplate =
new ilTemplate(
"tpl.il_as_tst_manual_scoring_points.html", TRUE, TRUE,
"Modules/Test");
381 #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
382 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
383 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
384 $points = $question_gui->object->getMaximumPoints();
387 $template->setVariable(
"QUESTION_POINTS", $points .
" " . $this->lng->txt(
"point"));
391 $template->setVariable(
"QUESTION_POINTS", $points .
" " . $this->lng->txt(
"points"));
394 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
395 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, TRUE);
397 $solout = $question_gui->object->getSuggestedSolutionOutput();
400 $scoretemplate->setCurrentBlock(
"suggested_solution");
401 $scoretemplate->setVariable(
"TEXT_SUGGESTED_SOLUTION", $this->lng->txt(
"solution_hint"));
402 $scoretemplate->setVariable(
"VALUE_SUGGESTED_SOLUTION", $solout);
403 $scoretemplate->parseCurrentBlock();
406 $scoretemplate->setCurrentBlock(
"feedback");
407 $scoretemplate->setVariable(
"FEEDBACK_NAME_INPUT", $question);
408 $feedback = $this->
object->getManualFeedback($active_id, $question,
$pass);
409 $scoretemplate->setVariable(
"VALUE_FEEDBACK",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, TRUE)));
410 $scoretemplate->setVariable(
"TEXT_MANUAL_FEEDBACK", $this->lng->txt(
"set_manual_feedback"));
411 $scoretemplate->parseCurrentBlock();
413 $scoretemplate->setVariable(
"NAME_INPUT", $question);
414 $this->ctrl->setParameter($this,
"active_id", $active_id);
415 $this->ctrl->setParameter($this,
"pass",
$pass);
416 $scoretemplate->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"manscoring"));
417 $scoretemplate->setVariable(
"LABEL_INPUT", $this->lng->txt(
"tst_change_points_for_question"));
419 $scoretemplate->setVariable(
"VALUE_SAVE", $this->lng->txt(
"save"));
421 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
422 $maintemplate->setCurrentBlock(
"printview_question");
423 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
424 $maintemplate->setVariable(
"QUESTION_SCORING", $scoretemplate->get());
425 $maintemplate->parseCurrentBlock();
433 $maintemplate->setVariable(
"NO_QUESTIONS_FOUND", $this->lng->txt(
"manscoring_questions_not_found"));
435 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"manscoring_results_pass"),
$pass+1));
437 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
440 return $maintemplate->get();
459 function getPassDetailsOverview($result_array, $active_id,
$pass, $targetclass =
"", $targetcommandsort =
"", $targetcommanddetails =
"", $standard_header = TRUE)
463 $testresults = $result_array[
"pass"];
464 unset($result_array[
"test"]);
465 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
467 $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) :
"nr";
468 $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) :
"asc";
470 if (!$standard_header)
473 usort($result_array,
"sortResults");
475 $color_class = array(
"tblrow1top",
"tblrow2top");
477 $template =
new ilTemplate(
"tpl.il_as_tst_pass_details_overview.html", TRUE, TRUE,
"Modules/Test");
478 $this->ctrl->setParameterByClass($targetclass,
"pass",
"$pass");
480 if (!$testresults[
"total_max_points"])
486 $percentage = ($testresults[
"total_reached_points"]/$testresults[
"total_max_points"])*100;
488 $total_max = $testresults[
"total_max_points"];
489 $total_reached = $testresults[
"total_reached_points"];
490 $totalRequestedHints = $testresults[
"total_requested_hints"];
492 $img_title_percent =
"";
494 $hasSuggestedSolutions = FALSE;
495 if ($this->object->getShowSolutionSuggested())
497 foreach ($result_array as $key => $value)
499 if (strlen($value[
"solution"]))
501 $hasSuggestedSolutions = TRUE;
505 foreach ($result_array as $key => $value)
507 if (preg_match(
"/\d+/", $key))
509 if (strlen($targetclass) && strlen($targetcommanddetails))
511 $template->setCurrentBlock(
"linked_title");
512 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
513 $template->setVariable(
"VALUE_QUESTION_TITLE", $value[
"title"]);
514 $this->ctrl->setParameterByClass($targetclass,
"evaluation", $value[
"qid"]);
515 $this->ctrl->setParameterByClass($targetclass,
"active_id", $active_id);
516 $template->setVariable(
"URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommanddetails));
517 $template->parseCurrentBlock();
521 $template->setCurrentBlock(
"plain_title");
522 $template->setVariable(
"VALUE_QUESTION_TITLE", $value[
"title"]);
523 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
524 $template->parseCurrentBlock();
526 if ($hasSuggestedSolutions)
528 $template->setCurrentBlock(
"question_suggested_solution");
529 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
530 $template->setVariable(
"SOLUTION_HINT", $this->object->prepareTextareaOutput($value[
"solution"],
true));
531 $template->parseCurrentBlock();
533 $template->setCurrentBlock(
"question");
534 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
535 $template->setVariable(
"VALUE_QUESTION_ID", $value[
"qid"]);
536 $template->setVariable(
"VALUE_QUESTION_COUNTER", $value[
"nr"]);
537 $template->setVariable(
"VALUE_MAX_POINTS", $value[
"max"]);
538 $template->setVariable(
"VALUE_REACHED_POINTS", $value[
"reached"]);
539 if( $this->object->isOfferingQuestionHintsEnabled() )
541 $template->setVariable(
"VALUE_HINT_COUNT", $value[
"requested_hints"]);
543 $template->setVariable(
"VALUE_PERCENT_SOLVED", $value[
"percent"]);
544 $template->parseCurrentBlock();
549 if ($hasSuggestedSolutions)
551 $template->touchBlock(
"footer_suggested_solution");
553 $template->setCurrentBlock(
"footer");
554 $template->setVariable(
"VALUE_QUESTION_COUNTER",
"<strong>" . $this->lng->txt(
"total") .
"</strong>");
555 $template->setVariable(
"VALUE_QUESTION_ID",
"");
556 $template->setVariable(
"VALUE_QUESTION_TITLE",
"");
557 $template->setVariable(
"VALUE_MAX_POINTS",
"<strong>$total_max</strong>");
558 $template->setVariable(
"VALUE_REACHED_POINTS",
"<strong>$total_reached</strong>");
559 if( $this->object->isOfferingQuestionHintsEnabled() )
561 $template->setVariable(
"VALUE_TOTAL_HINT_COUNT",
"<strong>$totalRequestedHints</strong>");
563 $template->setVariable(
"VALUE_PERCENT_SOLVED",
"<strong>" . sprintf(
"%2.2f", $percentage) .
" %" .
"</strong>");
564 $template->parseCurrentBlock();
566 if ($standard_header)
568 if ($hasSuggestedSolutions)
570 $template->setCurrentBlock(
"standard_header_suggested_solution");
571 $template->setVariable(
"SOLUTION_HINT_HEADER", $this->lng->txt(
"solution_hint"));
572 $template->parseCurrentBlock();
574 $template->setCurrentBlock(
"standard_header");
575 $template->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_question_no"));
576 $template->setVariable(
"PERCENT_SOLVED", $this->lng->txt(
"tst_percent_solved"));
577 $template->setVariable(
"QUESTION_ID", $this->lng->txt(
"question_id"));
578 $template->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
579 $template->setVariable(
"MAX_POINTS", $this->lng->txt(
"tst_maximum_points"));
580 $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
581 if( $this->object->isOfferingQuestionHintsEnabled() )
583 $template->setVariable(
"HINT_COUNT", $this->lng->txt(
"tst_question_hints_requested_hint_count_header"));
585 $template->parseCurrentBlock();
589 if ($hasSuggestedSolutions)
591 $template->setCurrentBlock(
"linked_header_suggested_solution");
592 if (strcmp($sort,
"solution") == 0)
594 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
598 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
600 $this->ctrl->setParameterByClass($targetclass,
"sort",
"solution");
601 $template->setVariable(
"URL_SOLUTION_HINT_HEADER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
602 $template->setVariable(
"SOLUTION_HINT_HEADER", $this->lng->txt(
"solution_hint"));
603 if (strcmp($sort,
"solution") == 0)
605 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE,
"Modules/Test");
607 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
608 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
609 $template->setVariable(
"IMAGE_SOLUTION_HINT_HEADER", $image->get());
611 $template->parseCurrentBlock();
613 $template->setCurrentBlock(
"linked_header");
614 $this->ctrl->setParameterByClass($targetclass,
"sort",
"nr");
615 if (strcmp($sort,
"nr") == 0)
617 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
621 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
623 $template->setVariable(
"URL_QUESTION_COUNTER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
624 $template->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_question_no"));
625 if (strcmp($sort,
"nr") == 0)
627 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE,
"Modules/Test");
629 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
630 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
631 $template->setVariable(
"IMAGE_QUESTION_COUNTER", $image->get());
633 $this->ctrl->setParameterByClass($targetclass,
"sort",
"percent");
634 if (strcmp($sort,
"percent") == 0)
636 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
640 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
642 $template->setVariable(
"URL_PERCENT_SOLVED", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
643 $template->setVariable(
"PERCENT_SOLVED", $this->lng->txt(
"tst_percent_solved"));
644 if (strcmp($sort,
"percent") == 0)
646 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE,
"Modules/Test");
648 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
649 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
650 $template->setVariable(
"IMAGE_PERCENT_SOLVED", $image->get());
652 $this->ctrl->setParameterByClass($targetclass,
"sort",
"title");
653 if (strcmp($sort,
"title") == 0)
655 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
659 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
661 $template->setVariable(
"URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
662 $template->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
663 if (strcmp($sort,
"title") == 0)
665 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE,
"Modules/Test");
667 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
668 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
669 $template->setVariable(
"IMAGE_QUESTION_TITLE", $image->get());
671 $this->ctrl->setParameterByClass($targetclass,
"sort",
"max");
672 if (strcmp($sort,
"max") == 0)
674 $this->ctrl->setParameterByClass($targetclass,
"sortorder", strcmp($sortorder,
"asc") ?
"desc" :
"asc");
678 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
680 $template->setVariable(
"URL_MAX_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
681 $template->setVariable(
"MAX_POINTS", $this->lng->txt(
"tst_maximum_points"));
682 if (strcmp($sort,
"max") == 0)
684 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE,
"Modules/Test");
686 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
687 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
688 $template->setVariable(
"IMAGE_MAX_POINTS", $image->get());
690 $this->ctrl->setParameterByClass($targetclass,
"sort",
"reached");
691 if (strcmp($sort,
"reached") == 0)
693 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
697 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
699 $template->setVariable(
"URL_REACHED_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
700 $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
701 if (strcmp($sort,
"reached") == 0)
703 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE,
"Modules/Test");
705 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
706 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
707 $template->setVariable(
"IMAGE_REACHED_POINTS", $image->get());
709 $template->parseCurrentBlock();
712 return $template->get();
723 if ($this->object->getShowSolutionSignature() && !$this->
object->getAnonymity())
725 $template =
new ilTemplate(
"tpl.il_as_tst_results_userdata_signature.html", TRUE, TRUE,
"Modules/Test");
726 $template->setVariable(
"TXT_DATE", $this->lng->txt(
"date"));
731 $template->setVariable(
"TXT_SIGNATURE", $this->lng->txt(
"tst_signature"));
733 return $template->get();
752 if(!is_object($testSession))
throw new TestException();
753 $template =
new ilTemplate(
"tpl.il_as_tst_results_userdata.html", TRUE, TRUE,
"Modules/Test");
754 include_once
'./Services/User/classes/class.ilObjUser.php';
755 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
763 $user->setLastname($this->lng->txt(
"deleted_user"));
765 $t = $testSession->getSubmittedTimestamp();
768 $t = $this->
object->_getLastAccess($testSession->getActiveId());
770 $print_date = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m") , date(
"d"), date(
"Y"));
773 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE) || ($overwrite_anonymity)))
775 $template->setCurrentBlock(
"user_matric");
776 $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
777 $template->parseCurrentBlock();
778 $template->setCurrentBlock(
"user_matric_value");
779 $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
780 $template->parseCurrentBlock();
781 $template->touchBlock(
"user_matric_separator");
782 $title_matric =
" - " . $this->lng->txt(
"matriculation") .
": " . $user->getMatriculation();
785 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
786 if (strlen($invited_user[
"clientip"]))
788 $template->setCurrentBlock(
"user_clientip");
789 $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
790 $template->parseCurrentBlock();
791 $template->setCurrentBlock(
"user_clientip_value");
792 $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
793 $template->parseCurrentBlock();
794 $template->touchBlock(
"user_clientip_separator");
795 $title_client =
" - " . $this->lng->txt(
"clientip") .
": " . $invited_user[
"clientip"];
798 $template->setVariable(
"TXT_TEST_TITLE", $this->lng->txt(
"title"));
799 $template->setVariable(
"VALUE_TEST_TITLE", $this->object->getTitle());
800 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
801 $uname = $this->
object->userLookupFullName($user_id, $overwrite_anonymity);
802 $template->setVariable(
"VALUE_USR_NAME", $uname);
803 $template->setVariable(
"TXT_TEST_DATE", $this->lng->txt(
"tst_tst_date"));
804 $template->setVariable(
"TXT_PRINT_DATE", $this->lng->txt(
"tst_print_date"));
812 $pagetitle =
": " . $this->
object->getTitle() . $title_matric . $title_client;
813 $this->tpl->setHeaderPageTitle($pagetitle);
815 return $template->get();
831 $test_id = $this->
object->getTestId();
832 $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
834 $template =
new ilTemplate(
"tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE,
"Modules/Test");
835 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
836 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, TRUE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, FALSE, TRUE);
837 $best_output = $question_gui->getSolutionOutput($active_id,
$pass, FALSE, FALSE, $show_question_only, FALSE, TRUE, FALSE, FALSE);
838 if( $this->object->getShowSolutionFeedback() &&
$_GET[
'cmd'] !=
'outCorrectSolution' )
840 $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput($active_id,
$pass);
841 if( strlen($specificAnswerFeedback) )
843 $template->setCurrentBlock(
"outline_specific_feedback");
844 $template->setVariable(
"OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
845 $template->parseCurrentBlock();
848 if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output))
850 $template->setCurrentBlock(
"best_solution");
851 $template->setVariable(
"TEXT_BEST_SOLUTION", $this->lng->txt(
"tst_best_solution_is"));
852 $template->setVariable(
"BEST_OUTPUT", $best_output);
853 $template->parseCurrentBlock();
855 $template->setVariable(
"TEXT_YOUR_SOLUTION", $this->lng->txt(
"tst_your_answer_was"));
856 $maxpoints = $question_gui->object->getMaximumPoints();
859 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) .
" (" . $maxpoints .
" " . $this->lng->txt(
"point") .
")");
863 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) .
" (" . $maxpoints .
" " . $this->lng->txt(
"points") .
")");
865 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
866 $template->setVariable(
"RECEIVED_POINTS", sprintf($this->lng->txt(
"you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id,
$pass), $maxpoints));
867 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
868 $template->setVariable(
"BACKLINK_TEXT",
"<< " . $this->lng->txt(
"back"));
869 return $template->get();
884 function getResultsOfUserOutput($testSession, $active_id,
$pass, $show_pass_details = TRUE, $show_answers = TRUE, $show_question_only = FALSE, $show_reached_points = FALSE)
888 include_once(
"./Services/UICore/classes/class.ilTemplate.php");
889 $template =
new ilTemplate(
"tpl.il_as_tst_results_participant.html", TRUE, TRUE,
"Modules/Test");
891 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
892 $uname = $this->
object->userLookupFullName($user_id, TRUE);
894 if (((array_key_exists(
"pass",
$_GET)) && (strlen(
$_GET[
"pass"]) > 0)) || (!is_null(
$pass)))
905 $result_array =& $this->
object->getTestResult($active_id,
$pass);
906 $command_solution_details =
"";
907 if ($show_pass_details)
909 $detailsoverview = $this->
getPassDetailsOverview($result_array, $active_id,
$pass,
"iltestservicegui",
"getResultsOfUserOutput", $command_solution_details);
912 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
913 $showAllAnswers = TRUE;
914 if ($this->object->isExecutable($testSession, $user_id))
916 $showAllAnswers = FALSE;
920 $list_of_answers = $this->
getPassListOfAnswers($result_array, $active_id,
$pass, FALSE, $showAllAnswers, $show_question_only, $show_reached_points);
923 $template->setVariable(
"LIST_OF_ANSWERS", $list_of_answers);
925 $template->setVariable(
"PASS_DETAILS", $detailsoverview);
928 $template->setVariable(
"SIGNATURE", $signature);
930 if ($this->object->isShowExamIdInTestResultsEnabled())
932 $template->setCurrentBlock(
'exam_id_footer');
933 $template->setVariable(
'EXAM_ID_VAL', $this->object->lookupExamId(
934 $testSession->getActiveId(),
$pass
936 $template->setVariable(
'EXAM_ID_TXT', $this->lng->txt(
'exam_id'));
937 $template->parseCurrentBlock();
940 $template->setVariable(
"TEXT_HEADING", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
941 $template->setVariable(
"USER_DATA", $user_data);
942 $template->setVariable(
"USER_MARK", $statement[
"mark"]);
943 if (strlen($statement[
"markects"]))
945 $template->setVariable(
"USER_MARK_ECTS", $statement[
"markects"]);
947 $template->parseCurrentBlock();
949 return $template->get();
961 $template =
new ilTemplate(
"tpl.il_as_tst_results_head_user_pass.html", TRUE, TRUE,
"Modules/Test");
962 include_once
'./Services/User/classes/class.ilObjUser.php';
963 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
971 $user->setLastname($this->lng->txt(
"deleted_user"));
974 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE)))
976 $template->setCurrentBlock(
"user_matric");
977 $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
978 $template->parseCurrentBlock();
979 $template->setCurrentBlock(
"user_matric_value");
980 $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
981 $template->parseCurrentBlock();
982 $template->touchBlock(
"user_matric_separator");
983 $title_matric =
" - " . $this->lng->txt(
"matriculation") .
": " . $user->getMatriculation();
986 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
987 if (strlen($invited_user[
"clientip"]))
989 $template->setCurrentBlock(
"user_clientip");
990 $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
991 $template->parseCurrentBlock();
992 $template->setCurrentBlock(
"user_clientip_value");
993 $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
994 $template->parseCurrentBlock();
995 $template->touchBlock(
"user_clientip_separator");
996 $title_client =
" - " . $this->lng->txt(
"clientip") .
": " . $invited_user[
"clientip"];
999 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
1000 $uname = $this->
object->userLookupFullName($user_id, FALSE);
1001 $template->setVariable(
"VALUE_USR_NAME", $uname);
1002 $template->setVariable(
"TXT_PASS", $this->lng->txt(
"scored_pass"));
1003 $template->setVariable(
"VALUE_PASS",
$pass);
1004 return $template->get();
1017 $question_gui =& $this->
object->createQuestionGUI(
"", $question_id);
1019 $foundusers = $this->
object->getParticipantsForTestAndQuestion($test_id, $question_id);
1021 foreach ($foundusers as $active_id => $passes)
1023 $resultpass = $this->
object->_getResultPass($active_id);
1024 for ($i = 0; $i < count($passes); $i++)
1026 if (($resultpass !== null) && ($resultpass == $passes[$i][
"pass"]))
1029 $question_gui =& $this->
object->createQuestionGUI(
"", $passes[$i][
"qid"]);
1032 $output .= $question_gui->getSolutionOutput(
1035 $graphicalOutput = FALSE,
1036 $result_output = FALSE,
1037 $show_question_only = FALSE,
1038 $show_feedback = FALSE
1040 $output .=
"<br /><br /><br />";
1045 require_once
'./Modules/Test/classes/class.ilTestPDFGenerator.php';
1053 $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) :
"nr";
1054 $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) :
"asc";
1055 if (strcmp($sortorder,
"asc"))
1065 if ($a[$sort] == $b[$sort])
return 0;
1066 return ($a[$sort] < $b[$sort]) ? $smaller : $greater;