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[
"pass"][
"total_max_points"])
144 $percentage = ($result_array[
"pass"][
"total_reached_points"]/$result_array[
"pass"][
"total_max_points"])*100;
146 $total_max = $result_array[
"pass"][
"total_max_points"];
147 $total_reached = $result_array[
"pass"][
"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 if (!$result_array[
"test"][
"total_max_points"])
170 $result_percentage = 0;
174 $result_percentage = ($result_array[
"test"][
"total_reached_points"]/$result_array[
"test"][
"total_max_points"])*100;
176 $result_total_max = $result_array[
"test"][
"total_max_points"];
177 $result_total_reached = $result_array[
"test"][
"total_reached_points"];
181 $template->setVariable(
"COLOR_CLASS", $color_class[
$pass % 2]);
183 $template->setVariable(
"VALUE_PASS",
$pass + 1);
188 $template->setVariable(
"VALUE_ANSWERED", $this->object->getAnsweredQuestionCount($active_id,
$pass) .
" " . strtolower($this->lng->txt(
"of")) .
" " . (count($result_array)-2));
189 $template->setVariable(
"VALUE_REACHED", $total_reached .
" " . strtolower($this->lng->txt(
"of")) .
" " . $total_max);
190 $template->setVariable(
"VALUE_PERCENTAGE", sprintf(
"%.2f", $percentage) .
"%");
192 $template->parseCurrentBlock();
196 $template->setVariable(
"PASS_COUNTER", $this->lng->txt(
"pass"));
197 $template->setVariable(
"DATE", $this->lng->txt(
"date"));
200 $template->setVariable(
"PASS_SCORED", $this->lng->txt(
"scored_pass"));
201 $template->setVariable(
"ANSWERED_QUESTIONS", $this->lng->txt(
"tst_answered_questions"));
202 $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
203 $template->setVariable(
"PERCENTAGE_CORRECT", $this->lng->txt(
"tst_percent_solved"));
205 $template->parseCurrentBlock();
207 return $template->get();
221 $test_data_array = $this->
object->getResultsForActiveId($active_id);
222 if (!$test_data_array[
"max_points"])
228 $percentage = ($test_data_array[
"reached_points"]/$test_data_array[
"max_points"])*100;
230 $total_max = $test_data_array[
"max_points"];
231 $total_reached = $test_data_array[
"reached_points"];
232 $result_percentage = $percentage;
233 $result_total_reached = $total_reached;
234 $result_total_max = $total_max;
238 $mark_obj = $this->
object->mark_schema->getMatchingMark($result_percentage);
241 if ($mark_obj->getPassed())
243 $mark = $this->lng->txt(
"mark_tst_passed");
247 $mark = $this->lng->txt(
"mark_tst_failed");
249 $mark = str_replace(
"[mark]", $mark_obj->getOfficialName(), $mark);
250 $mark = str_replace(
"[markshort]", $mark_obj->getShortName(), $mark);
251 $mark = str_replace(
"[percentage]", sprintf(
"%.2f", $result_percentage), $mark);
252 $mark = str_replace(
"[reached]", $result_total_reached, $mark);
253 $mark = str_replace(
"[max]", $result_total_max, $mark);
255 if ($this->object->ects_output)
257 $passed_array =& $this->
object->getTotalPointsPassedArray();
258 $ects_mark = $this->
object->getECTSGrade($passed_array, $result_total_reached, $result_total_max);
259 $markects = $this->lng->txt(
"mark_tst_ects");
260 $markects = str_replace(
"[markects]", $this->lng->txt(
"ects_grade_". strtolower($ects_mark)), $markects);
262 return array(
"mark" => $mark,
"markects" => $markects);
275 function getPassListOfAnswers(&$result_array, $active_id,
$pass, $show_solutions = FALSE, $only_answered_questions = FALSE, $show_question_only = FALSE, $show_reached_points = FALSE)
277 $maintemplate =
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", TRUE, TRUE,
"Modules/Test");
281 foreach ($result_array as $question_data)
283 if (($question_data[
"workedthrough"] == 1) || ($only_answered_questions == FALSE))
285 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
286 $question = $question_data[
"qid"];
287 if (is_numeric($question))
289 $maintemplate->setCurrentBlock(
"printview_question");
290 $question_gui = $this->
object->createQuestionGUI(
"", $question);
291 if (is_object($question_gui))
293 if ($show_reached_points)
295 $template->setCurrentBlock(
"result_points");
296 $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());
297 $template->parseCurrentBlock();
299 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
300 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
302 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
303 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
305 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
306 $maintemplate->setCurrentBlock(
"printview_question");
307 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
308 $maintemplate->parseCurrentBlock();
314 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"tst_eval_results_by_pass"),
$pass+1));
315 return $maintemplate->get();
330 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
332 $maintemplate =
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", TRUE, TRUE,
"Modules/Test");
334 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
339 foreach ($result_array as $question_data)
341 $question = $question_data[
"qid"];
342 if (is_numeric($question))
344 $question_gui = $this->
object->createQuestionGUI(
"", $question);
345 if (in_array($question_gui->object->getQuestionTypeID(), $scoring))
347 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
348 $scoretemplate =
new ilTemplate(
"tpl.il_as_tst_manual_scoring_points.html", TRUE, TRUE,
"Modules/Test");
349 #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
350 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
351 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
352 $points = $question_gui->object->getMaximumPoints();
355 $template->setVariable(
"QUESTION_POINTS", $points .
" " . $this->lng->txt(
"point"));
359 $template->setVariable(
"QUESTION_POINTS", $points .
" " . $this->lng->txt(
"points"));
362 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
363 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, TRUE);
365 $solout = $question_gui->object->getSuggestedSolutionOutput();
368 $scoretemplate->setCurrentBlock(
"suggested_solution");
369 $scoretemplate->setVariable(
"TEXT_SUGGESTED_SOLUTION", $this->lng->txt(
"solution_hint"));
370 $scoretemplate->setVariable(
"VALUE_SUGGESTED_SOLUTION", $solout);
371 $scoretemplate->parseCurrentBlock();
374 $scoretemplate->setCurrentBlock(
"feedback");
375 $scoretemplate->setVariable(
"FEEDBACK_NAME_INPUT", $question);
376 $feedback = $this->
object->getManualFeedback($active_id, $question,
$pass);
377 $scoretemplate->setVariable(
"VALUE_FEEDBACK",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, TRUE)));
378 $scoretemplate->setVariable(
"TEXT_MANUAL_FEEDBACK", $this->lng->txt(
"set_manual_feedback"));
379 $scoretemplate->parseCurrentBlock();
381 $scoretemplate->setVariable(
"NAME_INPUT", $question);
382 $this->ctrl->setParameter($this,
"active_id", $active_id);
383 $this->ctrl->setParameter($this,
"pass",
$pass);
384 $scoretemplate->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"manscoring"));
385 $scoretemplate->setVariable(
"LABEL_INPUT", $this->lng->txt(
"tst_change_points_for_question"));
387 $scoretemplate->setVariable(
"VALUE_SAVE", $this->lng->txt(
"save"));
389 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
390 $maintemplate->setCurrentBlock(
"printview_question");
391 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
392 $maintemplate->setVariable(
"QUESTION_SCORING", $scoretemplate->get());
393 $maintemplate->parseCurrentBlock();
401 $maintemplate->setVariable(
"NO_QUESTIONS_FOUND", $this->lng->txt(
"manscoring_questions_not_found"));
403 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"manscoring_results_pass"),
$pass+1));
405 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
408 return $maintemplate->get();
427 function getPassDetailsOverview($result_array, $active_id,
$pass, $targetclass =
"", $targetcommandsort =
"", $targetcommanddetails =
"", $standard_header = TRUE)
431 $testresults = $result_array[
"pass"];
432 unset($result_array[
"test"]);
433 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
435 $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) :
"nr";
436 $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) :
"asc";
438 if (!$standard_header)
441 usort($result_array,
"sortResults");
443 $color_class = array(
"tblrow1top",
"tblrow2top");
445 $template =
new ilTemplate(
"tpl.il_as_tst_pass_details_overview.html", TRUE, TRUE,
"Modules/Test");
446 $this->ctrl->setParameterByClass($targetclass,
"pass",
"$pass");
448 if (!$testresults[
"total_max_points"])
454 $percentage = ($testresults[
"total_reached_points"]/$testresults[
"total_max_points"])*100;
456 $total_max = $testresults[
"total_max_points"];
457 $total_reached = $testresults[
"total_reached_points"];
459 $img_title_percent =
"";
461 $hasSuggestedSolutions = FALSE;
462 if ($this->object->getShowSolutionSuggested())
464 foreach ($result_array as $key => $value)
466 if (strlen($value[
"solution"]))
468 $hasSuggestedSolutions = TRUE;
472 foreach ($result_array as $key => $value)
474 if (preg_match(
"/\d+/", $key))
476 if (strlen($targetclass) && strlen($targetcommanddetails))
478 $template->setCurrentBlock(
"linked_title");
479 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
480 $template->setVariable(
"VALUE_QUESTION_TITLE", $value[
"title"]);
481 $this->ctrl->setParameterByClass($targetclass,
"evaluation", $value[
"qid"]);
482 $this->ctrl->setParameterByClass($targetclass,
"active_id", $active_id);
483 $template->setVariable(
"URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommanddetails));
484 $template->parseCurrentBlock();
488 $template->setCurrentBlock(
"plain_title");
489 $template->setVariable(
"VALUE_QUESTION_TITLE", $value[
"title"]);
490 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
491 $template->parseCurrentBlock();
493 if ($hasSuggestedSolutions)
495 $template->setCurrentBlock(
"question_suggested_solution");
496 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
497 $template->setVariable(
"SOLUTION_HINT", $this->object->prepareTextareaOutput($value[
"solution"],
true));
498 $template->parseCurrentBlock();
500 $template->setCurrentBlock(
"question");
501 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
502 $template->setVariable(
"VALUE_QUESTION_COUNTER", $value[
"nr"]);
503 $template->setVariable(
"VALUE_MAX_POINTS", $value[
"max"]);
504 $template->setVariable(
"VALUE_REACHED_POINTS", $value[
"reached"]);
505 $template->setVariable(
"VALUE_PERCENT_SOLVED", $value[
"percent"]);
506 $template->parseCurrentBlock();
511 if ($hasSuggestedSolutions)
513 $template->touchBlock(
"footer_suggested_solution");
515 $template->setCurrentBlock(
"footer");
516 $template->setVariable(
"VALUE_QUESTION_COUNTER",
"<strong>" . $this->lng->txt(
"total") .
"</strong>");
517 $template->setVariable(
"VALUE_QUESTION_TITLE",
"");
518 $template->setVariable(
"VALUE_MAX_POINTS",
"<strong>$total_max</strong>");
519 $template->setVariable(
"VALUE_REACHED_POINTS",
"<strong>$total_reached</strong>");
520 $template->setVariable(
"VALUE_PERCENT_SOLVED",
"<strong>" . sprintf(
"%2.2f", $percentage) .
" %" .
"</strong>");
521 $template->parseCurrentBlock();
523 if ($standard_header)
525 if ($hasSuggestedSolutions)
527 $template->setCurrentBlock(
"standard_header_suggested_solution");
528 $template->setVariable(
"SOLUTION_HINT_HEADER", $this->lng->txt(
"solution_hint"));
529 $template->parseCurrentBlock();
531 $template->setCurrentBlock(
"standard_header");
532 $template->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_question_no"));
533 $template->setVariable(
"PERCENT_SOLVED", $this->lng->txt(
"tst_percent_solved"));
534 $template->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
535 $template->setVariable(
"MAX_POINTS", $this->lng->txt(
"tst_maximum_points"));
536 $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
537 $template->parseCurrentBlock();
541 if ($hasSuggestedSolutions)
543 $template->setCurrentBlock(
"linked_header_suggested_solution");
544 if (strcmp($sort,
"solution") == 0)
546 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
550 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
552 $this->ctrl->setParameterByClass($targetclass,
"sort",
"solution");
553 $template->setVariable(
"URL_SOLUTION_HINT_HEADER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
554 $template->setVariable(
"SOLUTION_HINT_HEADER", $this->lng->txt(
"solution_hint"));
555 if (strcmp($sort,
"solution") == 0)
557 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
559 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
560 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
561 $template->setVariable(
"IMAGE_SOLUTION_HINT_HEADER", $image->get());
563 $template->parseCurrentBlock();
565 $template->setCurrentBlock(
"linked_header");
566 $this->ctrl->setParameterByClass($targetclass,
"sort",
"nr");
567 if (strcmp($sort,
"nr") == 0)
569 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
573 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
575 $template->setVariable(
"URL_QUESTION_COUNTER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
576 $template->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_question_no"));
577 if (strcmp($sort,
"nr") == 0)
579 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
581 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
582 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
583 $template->setVariable(
"IMAGE_QUESTION_COUNTER", $image->get());
585 $this->ctrl->setParameterByClass($targetclass,
"sort",
"percent");
586 if (strcmp($sort,
"percent") == 0)
588 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
592 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
594 $template->setVariable(
"URL_PERCENT_SOLVED", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
595 $template->setVariable(
"PERCENT_SOLVED", $this->lng->txt(
"tst_percent_solved"));
596 if (strcmp($sort,
"percent") == 0)
598 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
600 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
601 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
602 $template->setVariable(
"IMAGE_PERCENT_SOLVED", $image->get());
604 $this->ctrl->setParameterByClass($targetclass,
"sort",
"title");
605 if (strcmp($sort,
"title") == 0)
607 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
611 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
613 $template->setVariable(
"URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
614 $template->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
615 if (strcmp($sort,
"title") == 0)
617 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
619 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
620 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
621 $template->setVariable(
"IMAGE_QUESTION_TITLE", $image->get());
623 $this->ctrl->setParameterByClass($targetclass,
"sort",
"max");
624 if (strcmp($sort,
"max") == 0)
626 $this->ctrl->setParameterByClass($targetclass,
"sortorder", strcmp($sortorder,
"asc") ?
"desc" :
"asc");
630 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
632 $template->setVariable(
"URL_MAX_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
633 $template->setVariable(
"MAX_POINTS", $this->lng->txt(
"tst_maximum_points"));
634 if (strcmp($sort,
"max") == 0)
636 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
638 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
639 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
640 $template->setVariable(
"IMAGE_MAX_POINTS", $image->get());
642 $this->ctrl->setParameterByClass($targetclass,
"sort",
"reached");
643 if (strcmp($sort,
"reached") == 0)
645 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
649 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
651 $template->setVariable(
"URL_REACHED_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
652 $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
653 if (strcmp($sort,
"reached") == 0)
655 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
657 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
658 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
659 $template->setVariable(
"IMAGE_REACHED_POINTS", $image->get());
661 $template->parseCurrentBlock();
664 return $template->get();
677 if ($this->object->getShowSolutionSignature() && !$this->
object->getAnonymity())
680 $template =
new ilTemplate(
"tpl.il_as_tst_results_userdata_signature.html", TRUE, TRUE,
"Modules/Test");
681 $template->setVariable(
"TXT_DATE", $this->lng->txt(
"date"));
682 $template->setVariable(
"VALUE_DATE", strftime(
"%Y-%m-%d %H:%M:%S", time()));
683 $template->setVariable(
"TXT_SIGNATURE", $this->lng->txt(
"tst_signature"));
685 return $template->get();
705 $template =
new ilTemplate(
"tpl.il_as_tst_results_userdata.html", TRUE, TRUE,
"Modules/Test");
706 include_once
'./Services/User/classes/class.ilObjUser.php';
707 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
715 $user->setLastname($this->lng->txt(
"deleted_user"));
717 $t = $this->
object->getTestSession($active_id)->getSubmittedTimestamp();
720 $t = $this->
object->_getLastAccess($this->object->getTestSession()->getActiveId());
722 $print_date = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m") , date(
"d"), date(
"Y"));
725 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE) || ($overwrite_anonymity)))
727 $template->setCurrentBlock(
"user_matric");
728 $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
729 $template->parseCurrentBlock();
730 $template->setCurrentBlock(
"user_matric_value");
731 $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
732 $template->parseCurrentBlock();
733 $template->touchBlock(
"user_matric_separator");
734 $title_matric =
" - " . $this->lng->txt(
"matriculation") .
": " . $user->getMatriculation();
737 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
738 if (strlen($invited_user[
"clientip"]))
740 $template->setCurrentBlock(
"user_clientip");
741 $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
742 $template->parseCurrentBlock();
743 $template->setCurrentBlock(
"user_clientip_value");
744 $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
745 $template->parseCurrentBlock();
746 $template->touchBlock(
"user_clientip_separator");
747 $title_client =
" - " . $this->lng->txt(
"clientip") .
": " . $invited_user[
"clientip"];
750 $template->setVariable(
"TXT_TEST_TITLE", $this->lng->txt(
"title"));
751 $template->setVariable(
"VALUE_TEST_TITLE", $this->object->getTitle());
752 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
753 $uname = $this->
object->userLookupFullName($user_id, $overwrite_anonymity);
754 $template->setVariable(
"VALUE_USR_NAME", $uname);
755 $template->setVariable(
"TXT_TEST_DATE", $this->lng->txt(
"tst_tst_date"));
757 $template->setVariable(
"TXT_PRINT_DATE", $this->lng->txt(
"tst_print_date"));
758 $template->setVariable(
"VALUE_PRINT_DATE", strftime(
"%Y-%m-%d %H:%M:%S",$print_date));
761 $pagetitle =
": " . $this->
object->getTitle() . $title_matric . $title_client;
762 $this->tpl->setHeaderPageTitle($pagetitle);
764 return $template->get();
782 $test_id = $this->
object->getTestId();
783 $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
785 $template =
new ilTemplate(
"tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE,
"Modules/Test");
786 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
787 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, TRUE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
788 $best_output = $question_gui->getSolutionOutput($active_id,
$pass, FALSE, FALSE, $show_question_only, FALSE, TRUE);
789 if (strlen($best_output))
791 $template->setCurrentBlock(
"best_solution");
792 $template->setVariable(
"TEXT_BEST_SOLUTION", $this->lng->txt(
"tst_best_solution_is"));
793 $template->setVariable(
"BEST_OUTPUT", $best_output);
794 $template->parseCurrentBlock();
796 $template->setVariable(
"TEXT_YOUR_SOLUTION", $this->lng->txt(
"tst_your_answer_was"));
797 $maxpoints = $question_gui->object->getMaximumPoints();
800 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) .
" (" . $maxpoints .
" " . $this->lng->txt(
"point") .
")");
804 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) .
" (" . $maxpoints .
" " . $this->lng->txt(
"points") .
")");
806 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
807 $template->setVariable(
"RECEIVED_POINTS", sprintf($this->lng->txt(
"you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id,
$pass), $maxpoints));
808 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
809 $template->setVariable(
"BACKLINK_TEXT",
"<< " . $this->lng->txt(
"back"));
810 return $template->get();
820 function getResultsOfUserOutput($active_id,
$pass, $show_pass_details = TRUE, $show_answers = TRUE, $show_question_only = FALSE, $show_reached_points = FALSE)
824 include_once(
"./classes/class.ilTemplate.php");
825 $template =
new ilTemplate(
"tpl.il_as_tst_results_participant.html", TRUE, TRUE,
"Modules/Test");
827 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
828 $uname = $this->
object->userLookupFullName($user_id, TRUE);
830 if (((array_key_exists(
"pass",
$_GET)) && (strlen(
$_GET[
"pass"]) > 0)) || (!is_null(
$pass)))
840 $result_array =& $this->
object->getTestResult($active_id,
$pass);
841 $command_solution_details =
"";
842 if ($show_pass_details)
844 $detailsoverview = $this->
getPassDetailsOverview($result_array, $active_id,
$pass,
"iltestservicegui",
"getResultsOfUserOutput", $command_solution_details);
847 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
848 $showAllAnswers = TRUE;
849 if ($this->object->isExecutable($user_id))
851 $showAllAnswers = FALSE;
855 $list_of_answers = $this->
getPassListOfAnswers($result_array, $active_id,
$pass, FALSE, $showAllAnswers, $show_question_only, $show_reached_points);
858 $template->setVariable(
"LIST_OF_ANSWERS", $list_of_answers);
860 $template->setVariable(
"PASS_DETAILS", $detailsoverview);
863 $template->setVariable(
"SIGNATURE", $signature);
865 $template->setVariable(
"TEXT_HEADING", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
866 $template->setVariable(
"USER_DATA", $user_data);
867 $template->setVariable(
"USER_MARK", $statement[
"mark"]);
868 if (strlen($statement[
"markects"]))
870 $template->setVariable(
"USER_MARK_ECTS", $statement[
"markects"]);
872 $template->parseCurrentBlock();
874 return $template->get();
886 $template =
new ilTemplate(
"tpl.il_as_tst_results_head_user_pass.html", TRUE, TRUE,
"Modules/Test");
887 include_once
'./Services/User/classes/class.ilObjUser.php';
888 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
896 $user->setLastname($this->lng->txt(
"deleted_user"));
899 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE)))
901 $template->setCurrentBlock(
"user_matric");
902 $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
903 $template->parseCurrentBlock();
904 $template->setCurrentBlock(
"user_matric_value");
905 $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
906 $template->parseCurrentBlock();
907 $template->touchBlock(
"user_matric_separator");
908 $title_matric =
" - " . $this->lng->txt(
"matriculation") .
": " . $user->getMatriculation();
911 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
912 if (strlen($invited_user[
"clientip"]))
914 $template->setCurrentBlock(
"user_clientip");
915 $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
916 $template->parseCurrentBlock();
917 $template->setCurrentBlock(
"user_clientip_value");
918 $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
919 $template->parseCurrentBlock();
920 $template->touchBlock(
"user_clientip_separator");
921 $title_client =
" - " . $this->lng->txt(
"clientip") .
": " . $invited_user[
"clientip"];
924 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
925 $uname = $this->
object->userLookupFullName($user_id, FALSE);
926 $template->setVariable(
"VALUE_USR_NAME", $uname);
927 $template->setVariable(
"TXT_PASS", $this->lng->txt(
"scored_pass"));
928 $template->setVariable(
"VALUE_PASS",
$pass);
929 return $template->get();
942 $foundusers = $this->
object->getParticipantsForTestAndQuestion($test_id, $question_id);
944 foreach ($foundusers as $active_id => $passes)
946 $resultpass = $this->
object->_getResultPass($active_id);
947 for ($i = 0; $i < count($passes); $i++)
949 if (($resultpass !== null) && ($resultpass == $passes[$i][
"pass"]))
951 $question_gui =& $this->
object->createQuestionGUI(
"", $passes[$i][
"qid"]);
953 $output .= $question_gui->getSolutionOutput($active_id, $resultpass, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = FALSE, $show_feedback = FALSE);
954 $output .=
"<br /><br /><br />";
958 $this->
object->deliverPDFfromHTML($output, $question_gui->object->getTitle());
965 $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) :
"nr";
966 $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) :
"asc";
967 if (strcmp($sortorder,
"asc"))
977 if ($a[$sort] == $b[$sort])
return 0;
978 return ($a[$sort] < $b[$sort]) ? $smaller : $greater;