24 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
65 $this->
object =& $a_object;
67 $this->ref_id = $a_object->ref_id;
75 $cmd = $this->ctrl->getCmd();
76 $next_class = $this->ctrl->getNextClass($this);
108 function getPassOverview($active_id, $targetclass =
"", $targetcommand =
"", $short = FALSE, $hide_details = FALSE)
114 $template =
new ilTemplate(
"tpl.il_as_tst_pass_overview_short.html", TRUE, TRUE,
"Modules/Test");
118 $template =
new ilTemplate(
"tpl.il_as_tst_pass_overview.html", TRUE, TRUE,
"Modules/Test");
120 $color_class = array(
"tblrow1",
"tblrow2");
123 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
124 $counted_pass = $this->
object->_getResultPass($active_id);
125 $reached_pass = $this->
object->_getPass($active_id);
127 $result_percentage = 0;
128 $result_total_reached = 0;
129 $result_total_max = 0;
132 $finishdate = $this->
object->getPassFinishDate($active_id,
$pass);
137 $result_array =& $this->
object->getTestResult($active_id,
$pass);
138 if (!$result_array[
"test"][
"total_max_points"])
144 $percentage = ($result_array[
"test"][
"total_reached_points"]/$result_array[
"test"][
"total_max_points"])*100;
146 $total_max = $result_array[
"test"][
"total_max_points"];
147 $total_reached = $result_array[
"test"][
"total_reached_points"];
151 if (strlen($targetclass) && strlen($targetcommand))
153 $this->ctrl->setParameterByClass($targetclass,
"active_id", $active_id);
154 $this->ctrl->setParameterByClass($targetclass,
"pass",
$pass);
155 $template->setCurrentBlock(
"pass_details");
156 $template->setVariable(
"HREF_PASS_DETAILS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand));
157 $template->setVariable(
"TEXT_PASS_DETAILS", $this->lng->txt(
"tst_pass_details"));
158 $template->parseCurrentBlock();
162 $template->setCurrentBlock(
"result_row");
164 if ((
$pass == $counted_pass) && (!$short))
166 $template->setVariable(
"COLOR_CLASS",
"tblrowmarked");
167 $template->setVariable(
"VALUE_SCORED",
"⊗");
168 $result_percentage = $percentage;
169 $result_total_reached = $total_reached;
170 $result_total_max = $total_max;
174 $template->setVariable(
"COLOR_CLASS", $color_class[
$pass % 2]);
176 $template->setVariable(
"VALUE_PASS",
$pass + 1);
181 $template->setVariable(
"VALUE_ANSWERED", $this->object->getAnsweredQuestionCount($active_id,
$pass) .
" " . strtolower($this->lng->txt(
"of")) .
" " . (count($result_array)-1));
182 $template->setVariable(
"VALUE_REACHED", $total_reached .
" " . strtolower($this->lng->txt(
"of")) .
" " . $total_max);
183 $template->setVariable(
"VALUE_PERCENTAGE", sprintf(
"%.2f", $percentage) .
"%");
185 $template->parseCurrentBlock();
189 $template->setVariable(
"PASS_COUNTER", $this->lng->txt(
"pass"));
190 $template->setVariable(
"DATE", $this->lng->txt(
"date"));
193 $template->setVariable(
"PASS_SCORED", $this->lng->txt(
"scored_pass"));
194 $template->setVariable(
"ANSWERED_QUESTIONS", $this->lng->txt(
"tst_answered_questions"));
195 $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
196 $template->setVariable(
"PERCENTAGE_CORRECT", $this->lng->txt(
"tst_percent_solved"));
198 $template->parseCurrentBlock();
200 return $template->get();
214 if (!$test_data_array[
"total_max_points"])
220 $percentage = ($test_data_array[
"total_reached_points"]/$test_data_array[
"total_max_points"])*100;
222 $total_max = $test_data_array[
"total_max_points"];
223 $total_reached = $test_data_array[
"total_reached_points"];
224 $result_percentage = $percentage;
225 $result_total_reached = $total_reached;
226 $result_total_max = $total_max;
230 $mark_obj = $this->
object->mark_schema->getMatchingMark($result_percentage);
233 if ($mark_obj->getPassed())
235 $mark = $this->lng->txt(
"mark_tst_passed");
239 $mark = $this->lng->txt(
"mark_tst_failed");
241 $mark = str_replace(
"[mark]", $mark_obj->getOfficialName(), $mark);
242 $mark = str_replace(
"[markshort]", $mark_obj->getShortName(), $mark);
243 $mark = str_replace(
"[percentage]", sprintf(
"%.2f", $result_percentage), $mark);
244 $mark = str_replace(
"[reached]", $result_total_reached, $mark);
245 $mark = str_replace(
"[max]", $result_total_max, $mark);
247 if ($this->object->ects_output)
249 $passed_array =& $this->
object->getTotalPointsPassedArray();
250 $ects_mark = $this->
object->getECTSGrade($passed_array, $result_total_reached, $result_total_max);
251 $markects = $this->lng->txt(
"mark_tst_ects");
252 $markects = str_replace(
"[markects]", $this->lng->txt(
"ects_grade_". strtolower($ects_mark)), $markects);
254 return array(
"mark" => $mark,
"markects" => $markects);
269 function getPassListOfAnswers(&$result_array, $active_id,
$pass, $show_solutions = FALSE, $only_answered_questions = FALSE, $show_question_only = FALSE, $show_reached_points = FALSE)
271 $maintemplate =
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", TRUE, TRUE,
"Modules/Test");
275 foreach ($result_array as $question_data)
277 if (($question_data[
"workedthrough"] == 1) || ($only_answered_questions == FALSE))
279 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
280 $question = $question_data[
"qid"];
281 if (is_numeric($question))
283 $maintemplate->setCurrentBlock(
"printview_question");
284 $question_gui = $this->
object->createQuestionGUI(
"", $question);
286 if ($show_reached_points)
288 $template->setCurrentBlock(
"result_points");
289 $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());
290 $template->parseCurrentBlock();
292 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
293 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
295 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
296 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
298 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
299 $maintemplate->setCurrentBlock(
"printview_question");
300 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
301 $maintemplate->parseCurrentBlock();
306 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"tst_eval_results_by_pass"),
$pass+1));
307 return $maintemplate->get();
324 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
326 $maintemplate =
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", TRUE, TRUE,
"Modules/Test");
328 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
333 foreach ($result_array as $question_data)
335 $question = $question_data[
"qid"];
336 if (is_numeric($question))
338 $question_gui = $this->
object->createQuestionGUI(
"", $question);
339 if (in_array($question_gui->object->getQuestionTypeID(), $scoring))
341 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
342 $scoretemplate =
new ilTemplate(
"tpl.il_as_tst_manual_scoring_points.html", TRUE, TRUE,
"Modules/Test");
343 $this->tpl->setCurrentBlock(
"printview_question");
344 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
345 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
346 $points = $question_gui->object->getMaximumPoints();
349 $template->setVariable(
"QUESTION_POINTS", $points .
" " . $this->lng->txt(
"point"));
353 $template->setVariable(
"QUESTION_POINTS", $points .
" " . $this->lng->txt(
"points"));
356 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
357 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
360 $scoretemplate->setCurrentBlock(
"feedback");
361 $scoretemplate->setVariable(
"FEEDBACK_NAME_INPUT", $question);
362 $feedback = $this->
object->getManualFeedback($active_id, $question,
$pass);
363 $scoretemplate->setVariable(
"VALUE_FEEDBACK",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, TRUE)));
364 $scoretemplate->setVariable(
"VALUE_SAVE", $this->lng->txt(
"save"));
365 $scoretemplate->setVariable(
"TEXT_MANUAL_FEEDBACK", $this->lng->txt(
"set_manual_feedback"));
366 $scoretemplate->parseCurrentBlock();
368 $scoretemplate->setVariable(
"NAME_INPUT", $question);
369 $this->ctrl->setParameter($this,
"active_id", $active_id);
370 $this->ctrl->setParameter($this,
"pass",
$pass);
371 $scoretemplate->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"manscoring"));
372 $scoretemplate->setVariable(
"LABEL_INPUT", $this->lng->txt(
"tst_change_points_for_question"));
373 $scoretemplate->setVariable(
"BUTTON_POINTS", $this->lng->txt(
"change"));
376 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
377 $maintemplate->setCurrentBlock(
"printview_question");
378 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
379 $maintemplate->setVariable(
"QUESTION_SCORING", $scoretemplate->get());
380 $maintemplate->parseCurrentBlock();
388 $maintemplate->setVariable(
"NO_QUESTIONS_FOUND", $this->lng->txt(
"manscoring_questions_not_found"));
390 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"manscoring_results_pass"),
$pass+1));
392 return $maintemplate->get();
411 function getPassDetailsOverview($result_array, $active_id,
$pass, $targetclass =
"", $targetcommandsort =
"", $targetcommanddetails =
"", $standard_header = TRUE)
415 $testresults = $result_array[
"test"];
416 unset($result_array[
"test"]);
417 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
419 $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) :
"nr";
420 $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) :
"asc";
422 if (!$standard_header)
425 usort($result_array,
"sortResults");
427 $color_class = array(
"tblrow1",
"tblrow2");
429 $template =
new ilTemplate(
"tpl.il_as_tst_pass_details_overview.html", TRUE, TRUE,
"Modules/Test");
430 $this->ctrl->setParameterByClass($targetclass,
"pass",
"$pass");
432 if (!$testresults[
"total_max_points"])
438 $percentage = ($testresults[
"total_reached_points"]/$testresults[
"total_max_points"])*100;
440 $total_max = $testresults[
"total_max_points"];
441 $total_reached = $testresults[
"total_reached_points"];
443 $img_title_percent =
"";
445 $hasSuggestedSolutions = FALSE;
447 foreach ($result_array as $key => $value)
449 if (strlen($value[
"solution"]))
451 $hasSuggestedSolutions = TRUE;
454 foreach ($result_array as $key => $value)
456 if (preg_match(
"/\d+/", $key))
458 if (strlen($targetclass) && strlen($targetcommanddetails))
460 $template->setCurrentBlock(
"linked_title");
461 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
462 $template->setVariable(
"VALUE_QUESTION_TITLE", $value[
"title"]);
463 $this->ctrl->setParameterByClass($targetclass,
"evaluation", $value[
"qid"]);
464 $this->ctrl->setParameterByClass($targetclass,
"active_id", $active_id);
465 $template->setVariable(
"URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommanddetails));
466 $template->parseCurrentBlock();
470 $template->setCurrentBlock(
"plain_title");
471 $template->setVariable(
"VALUE_QUESTION_TITLE", $value[
"title"]);
472 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
473 $template->parseCurrentBlock();
475 if ($hasSuggestedSolutions)
477 $template->setCurrentBlock(
"question_suggested_solution");
478 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
479 if ((preg_match(
"/http/", $value[
"solution"])) || (preg_match(
"/goto/", $value[
"solution"])))
481 $template->setVariable(
"SOLUTION_HINT",
"<a href=\"".$value[
"solution"].
"\" target=\"content\">" . $this->lng->txt(
"solution_hint").
"</a>");
485 if ($value[
"solution"])
487 $template->setVariable(
"SOLUTION_HINT", $this->lng->txt($value[
"solution"]));
491 $template->setVariable(
"SOLUTION_HINT",
"");
494 $template->parseCurrentBlock();
496 $template->setCurrentBlock(
"question");
497 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
498 $template->setVariable(
"VALUE_QUESTION_COUNTER", $value[
"nr"]);
499 $template->setVariable(
"VALUE_MAX_POINTS", $value[
"max"]);
500 $template->setVariable(
"VALUE_REACHED_POINTS", $value[
"reached"]);
501 $template->setVariable(
"VALUE_PERCENT_SOLVED", $value[
"percent"]);
502 $template->parseCurrentBlock();
507 if ($hasSuggestedSolutions)
509 $template->touchBlock(
"footer_suggested_solution");
511 $template->setCurrentBlock(
"footer");
512 $template->setVariable(
"VALUE_QUESTION_COUNTER",
"<strong>" . $this->lng->txt(
"total") .
"</strong>");
513 $template->setVariable(
"VALUE_QUESTION_TITLE",
"");
514 $template->setVariable(
"VALUE_MAX_POINTS",
"<strong>$total_max</strong>");
515 $template->setVariable(
"VALUE_REACHED_POINTS",
"<strong>$total_reached</strong>");
516 $template->setVariable(
"VALUE_PERCENT_SOLVED",
"<strong>" . sprintf(
"%2.2f", $percentage) .
" %" .
"</strong>");
517 $template->parseCurrentBlock();
519 if ($standard_header)
521 if ($hasSuggestedSolutions)
523 $template->setCurrentBlock(
"standard_header_suggested_solution");
524 $template->setVariable(
"SOLUTION_HINT_HEADER", $this->lng->txt(
"solution_hint"));
525 $template->parseCurrentBlock();
527 $template->setCurrentBlock(
"standard_header");
528 $template->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_question_no"));
529 $template->setVariable(
"PERCENT_SOLVED", $this->lng->txt(
"tst_percent_solved"));
530 $template->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
531 $template->setVariable(
"MAX_POINTS", $this->lng->txt(
"tst_maximum_points"));
532 $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
533 $template->parseCurrentBlock();
537 if ($hasSuggestedSolutions)
539 $template->setCurrentBlock(
"linked_header_suggested_solution");
540 if (strcmp($sort,
"solution") == 0)
542 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
546 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
548 $this->ctrl->setParameterByClass($targetclass,
"sort",
"solution");
549 $template->setVariable(
"URL_SOLUTION_HINT_HEADER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
550 $template->setVariable(
"SOLUTION_HINT_HEADER", $this->lng->txt(
"solution_hint"));
551 if (strcmp($sort,
"solution") == 0)
553 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
555 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
556 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
557 $template->setVariable(
"IMAGE_SOLUTION_HINT_HEADER", $image->get());
559 $template->parseCurrentBlock();
561 $template->setCurrentBlock(
"linked_header");
562 $this->ctrl->setParameterByClass($targetclass,
"sort",
"nr");
563 if (strcmp($sort,
"nr") == 0)
565 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
569 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
571 $template->setVariable(
"URL_QUESTION_COUNTER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
572 $template->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_question_no"));
573 if (strcmp($sort,
"nr") == 0)
575 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
577 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
578 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
579 $template->setVariable(
"IMAGE_QUESTION_COUNTER", $image->get());
581 $this->ctrl->setParameterByClass($targetclass,
"sort",
"percent");
582 if (strcmp($sort,
"percent") == 0)
584 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
588 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
590 $template->setVariable(
"URL_PERCENT_SOLVED", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
591 $template->setVariable(
"PERCENT_SOLVED", $this->lng->txt(
"tst_percent_solved"));
592 if (strcmp($sort,
"percent") == 0)
594 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
596 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
597 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
598 $template->setVariable(
"IMAGE_PERCENT_SOLVED", $image->get());
600 $this->ctrl->setParameterByClass($targetclass,
"sort",
"title");
601 if (strcmp($sort,
"title") == 0)
603 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
607 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
609 $template->setVariable(
"URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
610 $template->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
611 if (strcmp($sort,
"title") == 0)
613 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
615 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
616 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
617 $template->setVariable(
"IMAGE_QUESTION_TITLE", $image->get());
619 $this->ctrl->setParameterByClass($targetclass,
"sort",
"max");
620 if (strcmp($sort,
"max") == 0)
622 $this->ctrl->setParameterByClass($targetclass,
"sortorder", strcmp($sortorder,
"asc") ?
"desc" :
"asc");
626 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
628 $template->setVariable(
"URL_MAX_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
629 $template->setVariable(
"MAX_POINTS", $this->lng->txt(
"tst_maximum_points"));
630 if (strcmp($sort,
"max") == 0)
632 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
634 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
635 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
636 $template->setVariable(
"IMAGE_MAX_POINTS", $image->get());
638 $this->ctrl->setParameterByClass($targetclass,
"sort",
"reached");
639 if (strcmp($sort,
"reached") == 0)
641 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
645 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
647 $template->setVariable(
"URL_REACHED_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
648 $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
649 if (strcmp($sort,
"reached") == 0)
651 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
653 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
654 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
655 $template->setVariable(
"IMAGE_REACHED_POINTS", $image->get());
657 $template->parseCurrentBlock();
660 return $template->get();
673 if ($this->object->getShowSolutionSignature() && !$this->
object->getAnonymity())
676 $template =
new ilTemplate(
"tpl.il_as_tst_results_userdata_signature.html", TRUE, TRUE,
"Modules/Test");
677 $template->setVariable(
"TXT_DATE", $this->lng->txt(
"date"));
678 $template->setVariable(
"VALUE_DATE", strftime(
"%Y-%m-%d %H:%M:%S", time()));
679 $template->setVariable(
"TXT_SIGNATURE", $this->lng->txt(
"tst_signature"));
681 return $template->get();
701 $template =
new ilTemplate(
"tpl.il_as_tst_results_userdata.html", TRUE, TRUE,
"Modules/Test");
702 include_once
'./Services/User/classes/class.ilObjUser.php';
703 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
711 $user->setLastname($this->lng->txt(
"deleted_user"));
713 $t = $this->
object->getTestSession($active_id)->getSubmittedTimestamp();
716 $t = $this->
object->_getLastAccess($this->object->getTestSession()->getActiveId());
718 $print_date = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m") , date(
"d"), date(
"Y"));
721 if (strlen(
$user->getMatriculation()) && (($this->object->getAnonymity() == FALSE) || ($overwrite_anonymity)))
723 $template->setCurrentBlock(
"user_matric");
724 $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
725 $template->parseCurrentBlock();
726 $template->setCurrentBlock(
"user_matric_value");
727 $template->setVariable(
"VALUE_USR_MATRIC",
$user->getMatriculation());
728 $template->parseCurrentBlock();
729 $template->touchBlock(
"user_matric_separator");
730 $title_matric =
" - " . $this->lng->txt(
"matriculation") .
": " .
$user->getMatriculation();
733 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
734 if (strlen($invited_user->clientip))
736 $template->setCurrentBlock(
"user_clientip");
737 $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
738 $template->parseCurrentBlock();
739 $template->setCurrentBlock(
"user_clientip_value");
740 $template->setVariable(
"VALUE_CLIENT_IP", $invited_user->clientip);
741 $template->parseCurrentBlock();
742 $template->touchBlock(
"user_clientip_separator");
743 $title_client =
" - " . $this->lng->txt(
"clientip") .
": " . $invited_user->clientip;
746 $template->setVariable(
"TXT_TEST_TITLE", $this->lng->txt(
"title"));
747 $template->setVariable(
"VALUE_TEST_TITLE", $this->object->getTitle());
748 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
749 $uname = $this->
object->userLookupFullName($user_id, $overwrite_anonymity);
750 $template->setVariable(
"VALUE_USR_NAME", $uname);
751 $template->setVariable(
"TXT_TEST_DATE", $this->lng->txt(
"tst_tst_date"));
753 $template->setVariable(
"TXT_PRINT_DATE", $this->lng->txt(
"tst_print_date"));
754 $template->setVariable(
"VALUE_PRINT_DATE", strftime(
"%Y-%m-%d %H:%M:%S",$print_date));
757 $pagetitle =
": " . $this->
object->getTitle() . $title_matric . $title_client;
758 $this->tpl->setHeaderPageTitle($pagetitle);
760 return $template->get();
778 $test_id = $this->
object->getTestId();
779 $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
781 $template =
new ilTemplate(
"tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE,
"Modules/Test");
782 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
783 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, TRUE, TRUE, $show_question_only, $this->object->getShowSolutionFeedback());
784 $best_output = $question_gui->getSolutionOutput($active_id,
$pass, FALSE, FALSE, $show_question_only, FALSE, TRUE);
785 if (strlen($best_output))
787 $template->setCurrentBlock(
"best_solution");
788 $template->setVariable(
"TEXT_BEST_SOLUTION", $this->lng->txt(
"tst_best_solution_is"));
789 $template->setVariable(
"BEST_OUTPUT", $best_output);
790 $template->parseCurrentBlock();
792 $template->setVariable(
"TEXT_YOUR_SOLUTION", $this->lng->txt(
"tst_your_answer_was"));
793 $maxpoints = $question_gui->object->getMaximumPoints();
796 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) .
" (" . $maxpoints .
" " . $this->lng->txt(
"point") .
")");
800 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) .
" (" . $maxpoints .
" " . $this->lng->txt(
"points") .
")");
802 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
803 $template->setVariable(
"RECEIVED_POINTS", sprintf($this->lng->txt(
"you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id,
$pass), $maxpoints));
804 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
805 $template->setVariable(
"BACKLINK_TEXT",
"<< " . $this->lng->txt(
"back"));
806 return $template->get();
816 function getResultsOfUserOutput($active_id,
$pass, $show_pass_details = TRUE, $show_answers = TRUE, $show_question_only = FALSE, $show_reached_points = FALSE)
820 include_once(
"./classes/class.ilTemplate.php");
821 $template =
new ilTemplate(
"tpl.il_as_tst_results_participant.html", TRUE, TRUE,
"Modules/Test");
823 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
824 $uname = $this->
object->userLookupFullName($user_id, TRUE);
826 if (((array_key_exists(
"pass",
$_GET)) && (strlen(
$_GET[
"pass"]) > 0)) || (!is_null(
$pass)))
831 $result_pass = $this->
object->_getResultPass($active_id);
832 $result_array =& $this->
object->getTestResult($active_id, $result_pass);
838 $result_array =& $this->
object->getTestResult($active_id,
$pass);
839 $command_solution_details =
"";
840 if ($show_pass_details)
842 $detailsoverview = $this->
getPassDetailsOverview($result_array, $active_id,
$pass,
"iltestservicegui",
"getResultsOfUserOutput", $command_solution_details);
845 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
846 $showAllAnswers = TRUE;
847 if ($this->object->isExecutable($user_id))
849 $showAllAnswers = FALSE;
853 $list_of_answers = $this->
getPassListOfAnswers($result_array, $active_id,
$pass, FALSE, $showAllAnswers, $show_question_only, $show_reached_points);
856 $template->setVariable(
"LIST_OF_ANSWERS", $list_of_answers);
858 $template->setVariable(
"PASS_DETAILS", $detailsoverview);
861 $template->setVariable(
"SIGNATURE", $signature);
863 $template->setVariable(
"TEXT_HEADING", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
864 $template->setVariable(
"USER_DATA", $user_data);
865 $template->setVariable(
"USER_MARK", $statement[
"mark"]);
866 if (strlen($statement[
"markects"]))
868 $template->setVariable(
"USER_MARK_ECTS", $statement[
"markects"]);
870 $template->parseCurrentBlock();
872 return $template->get();
884 $template =
new ilTemplate(
"tpl.il_as_tst_results_head_user_pass.html", TRUE, TRUE,
"Modules/Test");
885 include_once
'./Services/User/classes/class.ilObjUser.php';
886 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
894 $user->setLastname($this->lng->txt(
"deleted_user"));
897 if (strlen(
$user->getMatriculation()) && (($this->object->getAnonymity() == FALSE)))
899 $template->setCurrentBlock(
"user_matric");
900 $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
901 $template->parseCurrentBlock();
902 $template->setCurrentBlock(
"user_matric_value");
903 $template->setVariable(
"VALUE_USR_MATRIC",
$user->getMatriculation());
904 $template->parseCurrentBlock();
905 $template->touchBlock(
"user_matric_separator");
906 $title_matric =
" - " . $this->lng->txt(
"matriculation") .
": " .
$user->getMatriculation();
909 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
910 if (strlen($invited_user->clientip))
912 $template->setCurrentBlock(
"user_clientip");
913 $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
914 $template->parseCurrentBlock();
915 $template->setCurrentBlock(
"user_clientip_value");
916 $template->setVariable(
"VALUE_CLIENT_IP", $invited_user->clientip);
917 $template->parseCurrentBlock();
918 $template->touchBlock(
"user_clientip_separator");
919 $title_client =
" - " . $this->lng->txt(
"clientip") .
": " . $invited_user->clientip;
922 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
923 $uname = $this->
object->userLookupFullName($user_id, FALSE);
924 $template->setVariable(
"VALUE_USR_NAME", $uname);
925 $template->setVariable(
"TXT_PASS", $this->lng->txt(
"scored_pass"));
926 $template->setVariable(
"VALUE_PASS",
$pass);
927 return $template->get();
940 $foundusers = $this->
object->getParticipantsForTestAndQuestion($test_id, $question_id);
942 foreach ($foundusers as $active_id => $passes)
944 $resultpass = $this->
object->_getResultPass($active_id);
945 for ($i = 0; $i < count($passes); $i++)
947 if (($resultpass != null) && ($resultpass == $passes[$i][
"pass"]))
949 $question_gui =& $this->
object->createQuestionGUI(
"", $passes[$i][
"qid"]);
951 $output .= $question_gui->getSolutionOutput($active_id, $resultpass, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = FALSE, $show_feedback = FALSE);
952 $output .=
"<br /><br /><br />";
956 $printbody =
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE,
"Modules/Test");
957 $printbody->setVariable(
"TITLE", $this->lng->txt(
"tst_results"));
958 $printbody->setVariable(
"ADM_CONTENT", $output);
959 $printoutput = $printbody->get();
960 $printoutput = preg_replace(
"/href=\".*?\"/",
"", $printoutput);
961 $fo = $this->
object->processPrintoutput2FO($printoutput);
962 $this->
object->deliverPDFfromFO($fo, $question_gui->object->getTitle());
969 $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) :
"nr";
970 $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) :
"asc";
971 if (strcmp($sortorder,
"asc"))
981 if ($a[$sort] == $b[$sort])
return 0;
982 return ($a[$sort] < $b[$sort]) ? $smaller : $greater;