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, $compare_solutions = FALSE)
277 $maintemplate =
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", TRUE, TRUE,
"Modules/Test");
280 foreach ($result_array as $question_data)
282 if (($question_data[
"workedthrough"] == 1) || ($only_answered_questions == FALSE))
284 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
285 $question = $question_data[
"qid"];
286 if (is_numeric($question))
288 $maintemplate->setCurrentBlock(
"printview_question");
289 $question_gui = $this->
object->createQuestionGUI(
"", $question);
290 if (is_object($question_gui))
292 if ($show_reached_points)
294 $template->setCurrentBlock(
"result_points");
295 $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());
296 $template->parseCurrentBlock();
298 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
299 $template->setVariable(
"QUESTION_ID", $question_gui->object->getId());
300 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
302 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
303 if ($compare_solutions)
305 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions = TRUE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
306 $best_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(),
true);
307 $compare_template =
new ilTemplate(
"tpl.il_as_tst_answers_compare.html", TRUE, TRUE,
"Modules/Test");
308 if (strlen(trim($this->lng->txt(
'tst_header_participant'))))
310 $compare_template->setCurrentBlock(
'header_participant');
311 $compare_template->setVariable(
"HEADER_PARTICIPANT", $this->lng->txt(
'tst_header_participant'));
312 $compare_template->parseCurrentBlock();
314 if (strlen(trim($this->lng->txt(
'tst_header_solution'))))
316 $compare_template->setCurrentBlock(
'header_solution');
317 $compare_template->setVariable(
"HEADER_SOLUTION", $this->lng->txt(
'tst_header_solution'));
318 $compare_template->parseCurrentBlock();
320 $compare_template->setVariable(
"PARTICIPANT", $result_output);
321 $compare_template->setVariable(
"SOLUTION", $best_output);
322 $template->setVariable(
"SOLUTION_OUTPUT", $compare_template->get());
326 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
327 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
329 $maintemplate->setCurrentBlock(
"printview_question");
330 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
331 $maintemplate->parseCurrentBlock();
337 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"tst_eval_results_by_pass"),
$pass+1));
338 return $maintemplate->get();
353 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
355 $maintemplate =
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", TRUE, TRUE,
"Modules/Test");
357 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
362 foreach ($result_array as $question_data)
364 $question = $question_data[
"qid"];
365 if (is_numeric($question))
367 $question_gui = $this->
object->createQuestionGUI(
"", $question);
368 if (in_array($question_gui->object->getQuestionTypeID(), $scoring))
370 $template =
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", TRUE, TRUE,
"Modules/TestQuestionPool");
371 $scoretemplate =
new ilTemplate(
"tpl.il_as_tst_manual_scoring_points.html", TRUE, TRUE,
"Modules/Test");
372 $this->tpl->setCurrentBlock(
"printview_question");
373 $template->setVariable(
"COUNTER_QUESTION", $counter.
". ");
374 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
375 $points = $question_gui->object->getMaximumPoints();
378 $template->setVariable(
"QUESTION_POINTS",
$points .
" " . $this->lng->txt(
"point"));
382 $template->setVariable(
"QUESTION_POINTS",
$points .
" " . $this->lng->txt(
"points"));
385 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
386 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, TRUE);
388 $solout = $question_gui->object->getSuggestedSolutionOutput();
391 $scoretemplate->setCurrentBlock(
"suggested_solution");
392 $scoretemplate->setVariable(
"TEXT_SUGGESTED_SOLUTION", $this->lng->txt(
"solution_hint"));
393 $scoretemplate->setVariable(
"VALUE_SUGGESTED_SOLUTION", $solout);
394 $scoretemplate->parseCurrentBlock();
397 $scoretemplate->setCurrentBlock(
"feedback");
398 $scoretemplate->setVariable(
"FEEDBACK_NAME_INPUT", $question);
399 $feedback = $this->
object->getManualFeedback($active_id, $question,
$pass);
400 $scoretemplate->setVariable(
"VALUE_FEEDBACK",
ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, TRUE)));
401 $scoretemplate->setVariable(
"TEXT_MANUAL_FEEDBACK", $this->lng->txt(
"set_manual_feedback"));
402 $scoretemplate->parseCurrentBlock();
404 $scoretemplate->setVariable(
"NAME_INPUT", $question);
405 $this->ctrl->setParameter($this,
"active_id", $active_id);
406 $this->ctrl->setParameter($this,
"pass",
$pass);
407 $scoretemplate->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"manscoring"));
408 $scoretemplate->setVariable(
"LABEL_INPUT", $this->lng->txt(
"tst_change_points_for_question"));
410 $scoretemplate->setVariable(
"VALUE_SAVE", $this->lng->txt(
"save"));
412 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
413 $maintemplate->setCurrentBlock(
"printview_question");
414 $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
415 $maintemplate->setVariable(
"QUESTION_SCORING", $scoretemplate->get());
416 $maintemplate->parseCurrentBlock();
424 $maintemplate->setVariable(
"NO_QUESTIONS_FOUND", $this->lng->txt(
"manscoring_questions_not_found"));
426 $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->lng->txt(
"manscoring_results_pass"),
$pass+1));
428 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
431 return $maintemplate->get();
450 function getPassDetailsOverview($result_array, $active_id,
$pass, $targetclass =
"", $targetcommandsort =
"", $targetcommanddetails =
"", $standard_header = TRUE)
454 $testresults = $result_array[
"pass"];
455 unset($result_array[
"test"]);
456 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
458 $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) :
"nr";
459 $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) :
"asc";
461 if (!$standard_header)
464 usort($result_array,
"sortResults");
466 $color_class = array(
"tblrow1top",
"tblrow2top");
468 $template =
new ilTemplate(
"tpl.il_as_tst_pass_details_overview.html", TRUE, TRUE,
"Modules/Test");
469 $this->ctrl->setParameterByClass($targetclass,
"pass",
"$pass");
471 if (!$testresults[
"total_max_points"])
477 $percentage = ($testresults[
"total_reached_points"]/$testresults[
"total_max_points"])*100;
479 $total_max = $testresults[
"total_max_points"];
480 $total_reached = $testresults[
"total_reached_points"];
482 $img_title_percent =
"";
484 $hasSuggestedSolutions = FALSE;
485 if ($this->object->getShowSolutionSuggested())
487 foreach ($result_array as $key => $value)
489 if (strlen($value[
"solution"]))
491 $hasSuggestedSolutions = TRUE;
495 foreach ($result_array as $key => $value)
497 if (preg_match(
"/\d+/", $key))
499 if (strlen($targetclass) && strlen($targetcommanddetails))
501 $template->setCurrentBlock(
"linked_title");
502 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
503 $template->setVariable(
"VALUE_QUESTION_TITLE", $value[
"title"]);
504 $template->setVariable(
"VALUE_QUESTION_ID", $value[
"qid"]);
505 $this->ctrl->setParameterByClass($targetclass,
"evaluation", $value[
"qid"]);
506 $this->ctrl->setParameterByClass($targetclass,
"active_id", $active_id);
507 $template->setVariable(
"URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommanddetails));
508 $template->parseCurrentBlock();
512 $template->setCurrentBlock(
"plain_title");
513 $template->setVariable(
"VALUE_QUESTION_TITLE", $value[
"title"]);
514 $template->setVariable(
"VALUE_QUESTION_ID", $value[
"qid"]);
515 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
516 $template->parseCurrentBlock();
518 if ($hasSuggestedSolutions)
520 $template->setCurrentBlock(
"question_suggested_solution");
521 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
522 $template->setVariable(
"SOLUTION_HINT", $value[
"solution"]);
523 $template->parseCurrentBlock();
525 $template->setCurrentBlock(
"question");
526 $template->setVariable(
"COLOR_CLASS", $color_class[$counter % 2]);
527 $template->setVariable(
"VALUE_QUESTION_COUNTER", $value[
"nr"]);
528 $template->setVariable(
"VALUE_MAX_POINTS", $value[
"max"]);
529 $template->setVariable(
"VALUE_REACHED_POINTS", $value[
"reached"]);
530 $template->setVariable(
"VALUE_PERCENT_SOLVED", $value[
"percent"]);
531 $template->parseCurrentBlock();
536 if ($hasSuggestedSolutions)
538 $template->touchBlock(
"footer_suggested_solution");
540 $template->setCurrentBlock(
"footer");
541 $template->setVariable(
"VALUE_QUESTION_COUNTER",
"<strong>" . $this->lng->txt(
"total") .
"</strong>");
542 $template->setVariable(
"VALUE_QUESTION_TITLE",
"");
543 $template->setVariable(
"VALUE_QUESTION_ID",
"");
544 $template->setVariable(
"VALUE_MAX_POINTS",
"<strong>$total_max</strong>");
545 $template->setVariable(
"VALUE_REACHED_POINTS",
"<strong>$total_reached</strong>");
546 $template->setVariable(
"VALUE_PERCENT_SOLVED",
"<strong>" . sprintf(
"%2.2f", $percentage) .
" %" .
"</strong>");
547 $template->parseCurrentBlock();
549 if ($standard_header)
551 if ($hasSuggestedSolutions)
553 $template->setCurrentBlock(
"standard_header_suggested_solution");
554 $template->setVariable(
"SOLUTION_HINT_HEADER", $this->lng->txt(
"solution_hint"));
555 $template->parseCurrentBlock();
557 $template->setCurrentBlock(
"standard_header");
558 $template->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_question_no"));
559 $template->setVariable(
"PERCENT_SOLVED", $this->lng->txt(
"tst_percent_solved"));
560 $template->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
561 $template->setVariable(
"QUESTION_ID", $this->lng->txt(
"question_id"));
562 $template->setVariable(
"MAX_POINTS", $this->lng->txt(
"tst_maximum_points"));
563 $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
564 $template->parseCurrentBlock();
568 if ($hasSuggestedSolutions)
570 $template->setCurrentBlock(
"linked_header_suggested_solution");
571 if (strcmp($sort,
"solution") == 0)
573 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
577 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
579 $this->ctrl->setParameterByClass($targetclass,
"sort",
"solution");
580 $template->setVariable(
"URL_SOLUTION_HINT_HEADER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
581 $template->setVariable(
"SOLUTION_HINT_HEADER", $this->lng->txt(
"solution_hint"));
582 if (strcmp($sort,
"solution") == 0)
584 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
586 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
587 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
588 $template->setVariable(
"IMAGE_SOLUTION_HINT_HEADER", $image->get());
590 $template->parseCurrentBlock();
592 $template->setCurrentBlock(
"linked_header");
593 $this->ctrl->setParameterByClass($targetclass,
"sort",
"nr");
594 if (strcmp($sort,
"nr") == 0)
596 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
600 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
602 $template->setVariable(
"URL_QUESTION_COUNTER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
603 $template->setVariable(
"QUESTION_COUNTER", $this->lng->txt(
"tst_question_no"));
604 if (strcmp($sort,
"nr") == 0)
606 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
608 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
609 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
610 $template->setVariable(
"IMAGE_QUESTION_COUNTER", $image->get());
612 $this->ctrl->setParameterByClass($targetclass,
"sort",
"percent");
613 if (strcmp($sort,
"percent") == 0)
615 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
619 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
621 $template->setVariable(
"URL_PERCENT_SOLVED", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
622 $template->setVariable(
"PERCENT_SOLVED", $this->lng->txt(
"tst_percent_solved"));
623 if (strcmp($sort,
"percent") == 0)
625 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
627 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
628 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
629 $template->setVariable(
"IMAGE_PERCENT_SOLVED", $image->get());
631 $this->ctrl->setParameterByClass($targetclass,
"sort",
"title");
632 if (strcmp($sort,
"title") == 0)
634 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
638 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
640 $template->setVariable(
"URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
641 $template->setVariable(
"QUESTION_TITLE", $this->lng->txt(
"tst_question_title"));
642 if (strcmp($sort,
"title") == 0)
644 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
646 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
647 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
648 $template->setVariable(
"IMAGE_QUESTION_TITLE", $image->get());
650 $this->ctrl->setParameterByClass($targetclass,
"sort",
"max");
651 if (strcmp($sort,
"max") == 0)
653 $this->ctrl->setParameterByClass($targetclass,
"sortorder", strcmp($sortorder,
"asc") ?
"desc" :
"asc");
657 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
659 $template->setVariable(
"URL_MAX_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
660 $template->setVariable(
"MAX_POINTS", $this->lng->txt(
"tst_maximum_points"));
661 if (strcmp($sort,
"max") == 0)
663 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
665 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
666 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
667 $template->setVariable(
"IMAGE_MAX_POINTS", $image->get());
669 $this->ctrl->setParameterByClass($targetclass,
"sort",
"reached");
670 if (strcmp($sort,
"reached") == 0)
672 $this->ctrl->setParameterByClass($targetclass,
"sortorder", !strcmp($sortorder,
"asc") ?
"desc" :
"asc");
676 $this->ctrl->setParameterByClass($targetclass,
"sortorder",
"asc");
678 $template->setVariable(
"URL_REACHED_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
679 $template->setVariable(
"REACHED_POINTS", $this->lng->txt(
"tst_reached_points"));
680 if (strcmp($sort,
"reached") == 0)
682 $image =
new ilTemplate(
"tpl.image.html", TRUE, TRUE);
684 $image->setVariable(
"IMAGE_ALT", $this->lng->txt(
"change_sort_direction"));
685 $image->setVariable(
"IMAGE_TITLE", $this->lng->txt(
"change_sort_direction"));
686 $template->setVariable(
"IMAGE_REACHED_POINTS", $image->get());
688 $template->parseCurrentBlock();
691 return $template->get();
704 if ($this->object->getShowSolutionSignature() && !$this->
object->getAnonymity())
707 $template =
new ilTemplate(
"tpl.il_as_tst_results_userdata_signature.html", TRUE, TRUE,
"Modules/Test");
708 if ($this->object->getShowSerial())
710 $template->setCurrentBlock(
"tst_serial");
711 $template->setVariable(
"VALUE_SERIAL", $this->object->getSerial());
712 $template->setVariable(
"TXT_SERIAL", $this->lng->txt(
'tst_serial'));
713 $template->parseCurrentBlock();
715 $template->setVariable(
"TXT_DATE", $this->lng->txt(
"date"));
716 $template->setVariable(
"VALUE_DATE", strftime(
"%Y-%m-%d %H:%M:%S", time()));
717 $template->setVariable(
"TXT_SIGNATURE", $this->lng->txt(
"tst_signature"));
719 return $template->get();
739 $template =
new ilTemplate(
"tpl.il_as_tst_results_userdata.html", TRUE, TRUE,
"Modules/Test");
740 include_once
'./Services/User/classes/class.ilObjUser.php';
741 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
749 $user->setLastname($this->lng->txt(
"deleted_user"));
751 $t = $this->
object->getTestSession($active_id)->getSubmittedTimestamp();
754 $t = $this->
object->_getLastAccess($this->object->getTestSession()->getActiveId());
756 $print_date = mktime(date(
"H"), date(
"i"), date(
"s"), date(
"m") , date(
"d"), date(
"Y"));
759 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE) || ($overwrite_anonymity)))
761 $template->setCurrentBlock(
"user_matric");
762 $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
763 $template->parseCurrentBlock();
764 $template->setCurrentBlock(
"user_matric_value");
765 $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
766 $template->parseCurrentBlock();
767 $template->touchBlock(
"user_matric_separator");
768 $title_matric =
" - " . $this->lng->txt(
"matriculation") .
": " . $user->getMatriculation();
771 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
772 if (strlen($invited_user[
"clientip"]))
774 $template->setCurrentBlock(
"user_clientip");
775 $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
776 $template->parseCurrentBlock();
777 $template->setCurrentBlock(
"user_clientip_value");
778 $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
779 $template->parseCurrentBlock();
780 $template->touchBlock(
"user_clientip_separator");
781 $title_client =
" - " . $this->lng->txt(
"clientip") .
": " . $invited_user[
"clientip"];
784 $template->setVariable(
"TXT_TEST_TITLE", $this->lng->txt(
"title"));
785 $template->setVariable(
"VALUE_TEST_TITLE", $this->object->getTitle());
786 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
787 $uname = $this->
object->userLookupFullName($user_id, $overwrite_anonymity);
788 $template->setVariable(
"VALUE_USR_NAME", $uname);
789 $template->setVariable(
"TXT_USR_LOGIN", $this->lng->txt(
"login"));
791 $template->setVariable(
"TXT_TEST_DATE", $this->lng->txt(
"tst_tst_date"));
793 $template->setVariable(
"TXT_PRINT_DATE", $this->lng->txt(
"tst_print_date"));
794 $template->setVariable(
"VALUE_PRINT_DATE", strftime(
"%Y-%m-%d %H:%M:%S",$print_date));
797 $pagetitle =
": " . $this->
object->getTitle() . $title_matric . $title_client;
798 $this->tpl->setHeaderPageTitle($pagetitle);
800 return $template->get();
818 $test_id = $this->
object->getTestId();
819 $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
821 $template =
new ilTemplate(
"tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE,
"Modules/Test");
822 $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
823 $result_output = $question_gui->getSolutionOutput($active_id,
$pass, TRUE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
824 $best_output = $question_gui->getSolutionOutput($active_id,
$pass, FALSE, FALSE, $show_question_only, FALSE, TRUE);
825 if (strlen($best_output))
827 $template->setCurrentBlock(
"best_solution");
828 $template->setVariable(
"TEXT_BEST_SOLUTION", $this->lng->txt(
"tst_best_solution_is"));
829 $template->setVariable(
"BEST_OUTPUT", $best_output);
830 $template->parseCurrentBlock();
832 $template->setVariable(
"TEXT_YOUR_SOLUTION", $this->lng->txt(
"tst_your_answer_was"));
833 $maxpoints = $question_gui->object->getMaximumPoints();
836 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) .
" (" . $maxpoints .
" " . $this->lng->txt(
"point") .
")");
840 $template->setVariable(
"QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) .
" (" . $maxpoints .
" " . $this->lng->txt(
"points") .
")");
842 $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
843 $template->setVariable(
"RECEIVED_POINTS", sprintf($this->lng->txt(
"you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id,
$pass), $maxpoints));
844 $template->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this));
845 $template->setVariable(
"BACKLINK_TEXT",
"<< " . $this->lng->txt(
"back"));
846 return $template->get();
856 function getResultsOfUserOutput($active_id,
$pass, $show_pass_details = TRUE, $show_answers = TRUE, $show_question_only = FALSE, $show_reached_points = FALSE)
860 include_once(
"./classes/class.ilTemplate.php");
861 $template =
new ilTemplate(
"tpl.il_as_tst_results_participant.html", TRUE, TRUE,
"Modules/Test");
863 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
864 $uname = $this->
object->userLookupFullName($user_id, TRUE);
866 if (((array_key_exists(
"pass",
$_GET)) && (strlen(
$_GET[
"pass"]) > 0)) || (!is_null(
$pass)))
876 $result_array =& $this->
object->getTestResult($active_id,
$pass);
877 $command_solution_details =
"";
878 if ($show_pass_details)
880 $detailsoverview = $this->
getPassDetailsOverview($result_array, $active_id,
$pass,
"iltestservicegui",
"getResultsOfUserOutput", $command_solution_details);
883 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
884 $showAllAnswers = TRUE;
885 if ($this->object->isExecutable($user_id))
887 $showAllAnswers = FALSE;
891 $list_of_answers = $this->
getPassListOfAnswers($result_array, $active_id,
$pass, FALSE, $showAllAnswers, $show_question_only, $show_reached_points, $compare_solutions = $this->object->getShowSolutionListComparison());
894 $template->setVariable(
"LIST_OF_ANSWERS", $list_of_answers);
896 $template->setVariable(
"PASS_DETAILS", $detailsoverview);
899 $template->setVariable(
"SIGNATURE", $signature);
901 $template->setVariable(
"TEXT_HEADING", sprintf($this->lng->txt(
"tst_result_user_name"), $uname));
902 $template->setVariable(
"USER_DATA", $user_data);
903 $template->setVariable(
"USER_MARK", $statement[
"mark"]);
904 if (strlen($statement[
"markects"]))
906 $template->setVariable(
"USER_MARK_ECTS", $statement[
"markects"]);
908 $template->parseCurrentBlock();
910 return $template->get();
922 $template =
new ilTemplate(
"tpl.il_as_tst_results_head_user_pass.html", TRUE, TRUE,
"Modules/Test");
923 include_once
'./Services/User/classes/class.ilObjUser.php';
924 $user_id = $this->
object->_getUserIdFromActiveId($active_id);
932 $user->setLastname($this->lng->txt(
"deleted_user"));
935 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE)))
937 $template->setCurrentBlock(
"user_matric");
938 $template->setVariable(
"TXT_USR_MATRIC", $this->lng->txt(
"matriculation"));
939 $template->parseCurrentBlock();
940 $template->setCurrentBlock(
"user_matric_value");
941 $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
942 $template->parseCurrentBlock();
943 $template->touchBlock(
"user_matric_separator");
944 $title_matric =
" - " . $this->lng->txt(
"matriculation") .
": " . $user->getMatriculation();
947 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
948 if (strlen($invited_user[
"clientip"]))
950 $template->setCurrentBlock(
"user_clientip");
951 $template->setVariable(
"TXT_CLIENT_IP", $this->lng->txt(
"client_ip"));
952 $template->parseCurrentBlock();
953 $template->setCurrentBlock(
"user_clientip_value");
954 $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
955 $template->parseCurrentBlock();
956 $template->touchBlock(
"user_clientip_separator");
957 $title_client =
" - " . $this->lng->txt(
"clientip") .
": " . $invited_user[
"clientip"];
960 $template->setVariable(
"TXT_USR_NAME", $this->lng->txt(
"name"));
961 $uname = $this->
object->userLookupFullName($user_id, FALSE);
962 $template->setVariable(
"VALUE_USR_NAME", $uname);
963 $template->setVariable(
"TXT_PASS", $this->lng->txt(
"scored_pass"));
964 $template->setVariable(
"VALUE_PASS",
$pass);
965 return $template->get();
978 $foundusers = $this->
object->getParticipantsForTestAndQuestion($test_id, $question_id);
981 foreach ($foundusers as $active_id => $passes)
983 $resultpass = $this->
object->_getResultPass($active_id);
984 for ($i = 0; $i < count($passes); $i++)
986 if (($resultpass != null) && ($resultpass == $passes[$i][
"pass"]))
988 $question_gui =& $this->
object->createQuestionGUI(
"", $passes[$i][
"qid"]);
990 $output .= $question_gui->getSolutionOutput($active_id, $resultpass, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = FALSE, $show_feedback = FALSE);
991 $output .=
"<br /><br /><br />";
992 $file_name = $question_gui->object->getTitle();
996 $this->
object->deliverPDFFromHTML($output,
$file_name);
1003 $sort = (
$_GET[
"sort"]) ? (
$_GET[
"sort"]) :
"nr";
1004 $sortorder = (
$_GET[
"sortorder"]) ? (
$_GET[
"sortorder"]) :
"asc";
1005 if (strcmp($sortorder,
"asc"))
1015 if ($a[$sort] == $b[$sort])
return 0;
1016 return ($a[$sort] < $b[$sort]) ? $smaller : $greater;