24include_once 
"./Modules/Test/classes/inc.AssessmentConstants.php";
 
  139        $ilCtrl = 
$DIC[
'ilCtrl'];
 
  143        $component_repository = 
$DIC[
'component.repository'];
 
  144        $ilTabs = 
$DIC[
'ilTabs'];
 
  145        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
  147        $lng->loadLanguageModule(
'cert');
 
  153        $this->
ctrl = &$ilCtrl;
 
  154        $this->
tabs = $ilTabs;
 
  155        $this->objCache = $ilObjDataCache;
 
  157        $this->
object = &$a_object;
 
  158        $this->tree = &
$tree;
 
  159        $this->ref_id = $a_object->
getRefId();
 
  162        $this->testrequest = 
$DIC->test()->internal()->request();
 
  166        $this->randomGroup = 
$DIC->refinery()->random();
 
  167        $this->objectiveOrientedContainer = 
null;
 
  199            $considerHiddenQuestions = 
false;
 
  201            require_once 
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
 
  204            $considerHiddenQuestions = 
true;
 
  207        $scoredPass = $this->
object->_getResultPass($testSession->
getActiveId());
 
  209        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
  214        foreach ($passes as $pass) {
 
  220            $considerOptionalQuestions = 
true;
 
  223                $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($testSession->
getActiveId(), $pass);
 
  224                $testSequence->loadFromDb();
 
  225                $testSequence->loadQuestions();
 
  227                if ($this->
object->isRandomTest() && !$testSequence->isAnsweringOptionalQuestionsConfirmed()) {
 
  228                    $considerOptionalQuestions = 
false;
 
  231                $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
 
  232                $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
 
  235                $objectivesList->loadObjectivesTitles();
 
  237                $row[
'objectives'] = $objectivesList->getUniqueObjectivesStringForQuestions($testSequence->getUserSequenceQuestions());
 
  241                $result_array = $this->
object->getTestResult($testSession->
getActiveId(), $pass, 
false, $considerHiddenQuestions, $considerOptionalQuestions);
 
  243                foreach ($result_array as $resultStructKEY => $question) {
 
  244                    if ($resultStructKEY === 
'test' || $resultStructKEY === 
'pass') {
 
  248                    $requestData = $questionHintRequestRegister->getRequestByTestPassIndexAndQuestionId($pass, $question[
'qid']);
 
  251                        $result_array[
'pass'][
'total_requested_hints'] += $requestData->getRequestsCount();
 
  253                        $result_array[$resultStructKEY][
'requested_hints'] = $requestData->getRequestsCount();
 
  254                        $result_array[$resultStructKEY][
'hint_points'] = $requestData->getRequestsPoints();
 
  258                if (!$result_array[
'pass'][
'total_max_points']) {
 
  259                    $row[
'percentage'] = 0;
 
  261                    $row[
'percentage'] = ($result_array[
'pass'][
'total_reached_points'] / $result_array[
'pass'][
'total_max_points']) * 100;
 
  264                $row[
'max_points'] = $result_array[
'pass'][
'total_max_points'];
 
  265                $row[
'reached_points'] = $result_array[
'pass'][
'total_reached_points'];
 
  266                $row[
'scored'] = ($pass == $scoredPass);
 
  267                $row[
'num_workedthrough_questions'] = $result_array[
'pass'][
'num_workedthrough'];
 
  268                $row[
'num_questions_total'] = $result_array[
'pass'][
'num_questions_total'];
 
  270                if ($this->
object->isOfferingQuestionHintsEnabled()) {
 
  271                    $row[
'hints'] = $result_array[
'pass'][
'total_requested_hints'];
 
  302        $cmd = $this->
ctrl->getCmd();
 
  303        $next_class = $this->
ctrl->getNextClass($this);
 
  306        switch ($next_class) {
 
  308                $ret = &$this->$cmd();
 
  329        if (!$this->testrequest->isset(
'pdf')) {
 
  333        if (!(
bool) $this->testrequest->raw(
'pdf')) {
 
  345        require_once 
'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
 
  349        $table->setPdfPresentationEnabled(
 
  350            $this->testrequest->isset(
'pdf') && $this->testrequest->raw(
'pdf') == 1
 
  353        $table->setObjectiveOrientedPresentationEnabled(
 
  374        $show_solutions = 
false,
 
  375        $only_answered_questions = 
false,
 
  376        $show_question_only = 
false,
 
  377        $show_reached_points = 
false,
 
  382        $maintemplate = new 
ilTemplate(
"tpl.il_as_tst_list_of_answers.html", 
true, 
true, 
"Modules/Test");
 
  386        foreach ($result_array as $question_data) {
 
  387            if (!array_key_exists(
'workedthrough', $question_data)) {
 
  388                $question_data[
'workedthrough'] = 0;
 
  390            if (!array_key_exists(
'qid', $question_data)) {
 
  391                $question_data[
'qid'] = -1;
 
  394            if (($question_data[
"workedthrough"] == 1) || ($only_answered_questions == 
false)) {
 
  395                $template = 
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  396                $question_id = $question_data[
"qid"] ?? 
null;
 
  397                if ($question_id !== 
null 
  398                    && $question_id !== -1
 
  399                    && is_numeric($question_id)) {
 
  400                    $maintemplate->setCurrentBlock(
"printview_question");
 
  401                    $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
 
  407                    if (is_object($question_gui)) {
 
  413                            $template->setCurrentBlock(
'block_id');
 
  414                            $template->setVariable(
'BLOCK_ID', 
"detailed_answer_block_act_{$active_id}_qst_{$question_id}");
 
  415                            $template->parseCurrentBlock();
 
  417                            $template->setCurrentBlock(
'back_anchor');
 
  418                            $template->setVariable(
'HREF_BACK_ANCHOR', 
"#pass_details_tbl_row_act_{$active_id}_qst_{$question_id}");
 
  419                            $template->setVariable(
'TXT_BACK_ANCHOR', $this->
lng->txt(
'tst_back_to_question_list'));
 
  420                            $template->parseCurrentBlock();
 
  423                        if ($show_reached_points) {
 
  424                            $template->setCurrentBlock(
"result_points");
 
  425                            $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());
 
  426                            $template->parseCurrentBlock();
 
  428                        $template->setVariable(
"COUNTER_QUESTION", $counter . 
". ");
 
  429                        $template->setVariable(
"TXT_QUESTION_ID", $this->
lng->txt(
'question_id_short'));
 
  430                        $template->setVariable(
"QUESTION_ID", $question_gui->object->getId());
 
  431                        $template->setVariable(
"QUESTION_TITLE", $this->
object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()));
 
  433                        if ($objectivesList !== 
null) {
 
  434                            $objectives = $this->
lng->txt(
'tst_res_lo_objectives_header') . 
': ';
 
  435                            $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
 
  439                        $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? 
true : 
false;
 
  445                        if ($show_best_solution) {
 
  446                            $compare_template = 
new ilTemplate(
'tpl.il_as_tst_answers_compare.html', 
true, 
true, 
'Modules/Test');
 
  447                            $test_session = $this->testSessionFactory->getSession($active_id);
 
  448                            if ($pass <= $test_session->getLastFinishedPass()) {
 
  449                                $compare_template->setVariable(
"HEADER_PARTICIPANT", $this->
lng->txt(
'tst_header_participant'));
 
  451                                $compare_template->setVariable(
"HEADER_PARTICIPANT", $this->
lng->txt(
'tst_header_participant_no_answer'));
 
  454                            $compare_template->setVariable(
"HEADER_SOLUTION", $this->
lng->txt(
'tst_header_solution'));
 
  455                            $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output, 
false, $show_question_only, $show_feedback);
 
  456                            $best_output = $question_gui->getSolutionOutput($active_id, $pass, 
false, 
false, $show_question_only, 
false, 
true);
 
  458                            $compare_template->setVariable(
'PARTICIPANT', $result_output);
 
  459                            $compare_template->setVariable(
'SOLUTION', $best_output);
 
  461                                $intermediate_output = $question_gui->getAutoSavedSolutionOutput(
 
  472                                $compare_template->setVariable(
'TXT_INTERMEDIATE', $this->
lng->txt(
'autosavecontent'));
 
  473                                $compare_template->setVariable(
'INTERMEDIATE', $intermediate_output);
 
  475                            $template->setVariable(
'SOLUTION_OUTPUT', $compare_template->get());
 
  477                            $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_graphical_output, 
false, $show_question_only, $show_feedback);
 
  479                                $intermediate_output = $question_gui->getAutoSavedSolutionOutput(
 
  490                                $template->setVariable(
'TXT_INTERMEDIATE', $this->
lng->txt(
'autosavecontent'));
 
  491                                $template->setVariable(
'INTERMEDIATE', $intermediate_output);
 
  493                            $template->setVariable(
'SOLUTION_OUTPUT', $result_output);
 
  496                        $maintemplate->setCurrentBlock(
"printview_question");
 
  497                        $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
 
  498                        $maintemplate->parseCurrentBlock();
 
  505        if ($testResultHeaderLabelBuilder !== 
null) {
 
  506            if ($pass !== 
null) {
 
  507                $headerText = $testResultHeaderLabelBuilder->getListOfAnswersHeaderLabel($pass + 1);
 
  509                $headerText = $testResultHeaderLabelBuilder->getVirtualListOfAnswersHeaderLabel();
 
  515        $maintemplate->setVariable(
"RESULTS_OVERVIEW", $headerText);
 
  516        return $maintemplate->get();
 
  524        $fixedSeed = $this->buildFixedShufflerSeed($question_id, $pass_id, $active_id);
 
  526        return $this->randomGroup->shuffleArray(
new GivenSeed($fixedSeed));
 
  531        $seed = ($question_id + $pass_id) * $active_id;
 
  533        if (is_float($seed) && is_float($seed = $active_id + $pass_id)) {
 
  540            $seed = $seed * ($div + $seed % 10);
 
  560        $maintemplate = 
new ilTemplate(
"tpl.il_as_tst_list_of_answers.html", 
true, 
true, 
"Modules/Test");
 
  565        foreach ($result_array as $question_data) {
 
  566            $question = $question_data[
"qid"];
 
  567            if (is_numeric($question)) {
 
  568                $question_gui = $this->
object->createQuestionGUI(
"", $question);
 
  569                if (in_array($question_gui->object->getQuestionTypeID(), $scoring)) {
 
  570                    $template = 
new ilTemplate(
"tpl.il_as_qpl_question_printview.html", 
true, 
true, 
"Modules/TestQuestionPool");
 
  571                    $scoretemplate = 
new ilTemplate(
"tpl.il_as_tst_manual_scoring_points.html", 
true, 
true, 
"Modules/Test");
 
  572                    #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
 
  573                    $template->setVariable(
"COUNTER_QUESTION", $counter . 
". ");
 
  574                    $template->setVariable(
"QUESTION_TITLE", $this->
object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()));
 
  575                    $points = $question_gui->object->getMaximumPoints();
 
  577                        $template->setVariable(
"QUESTION_POINTS", $points . 
" " . $this->
lng->txt(
"point"));
 
  579                        $template->setVariable(
"QUESTION_POINTS", $points . 
" " . $this->
lng->txt(
"points"));
 
  582                    $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? 
true : 
false;
 
  583                    $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, 
false, $show_question_only, $this->
object->getShowSolutionFeedback(), 
false, 
true);
 
  585                    $solout = $question_gui->object->getSuggestedSolutionOutput();
 
  586                    if (strlen($solout)) {
 
  587                        $scoretemplate->setCurrentBlock(
"suggested_solution");
 
  588                        $scoretemplate->setVariable(
"TEXT_SUGGESTED_SOLUTION", $this->
lng->txt(
"solution_hint"));
 
  589                        $scoretemplate->setVariable(
"VALUE_SUGGESTED_SOLUTION", $solout);
 
  590                        $scoretemplate->parseCurrentBlock();
 
  593                    $scoretemplate->setCurrentBlock(
"feedback");
 
  594                    $scoretemplate->setVariable(
"FEEDBACK_NAME_INPUT", $question);
 
  596                    $scoretemplate->setVariable(
 
  599                            $this->
object->prepareTextareaOutput($feedback, 
true)
 
  602                    $scoretemplate->setVariable(
"TEXT_MANUAL_FEEDBACK", $this->
lng->txt(
"set_manual_feedback"));
 
  603                    $scoretemplate->parseCurrentBlock();
 
  605                    $scoretemplate->setVariable(
"NAME_INPUT", $question);
 
  606                    $this->
ctrl->setParameter($this, 
"active_id", $active_id);
 
  607                    $this->
ctrl->setParameter($this, 
"pass", $pass);
 
  608                    $scoretemplate->setVariable(
"FORMACTION", $this->
ctrl->getFormAction($this, 
"manscoring"));
 
  609                    $scoretemplate->setVariable(
"LABEL_INPUT", $this->
lng->txt(
"tst_change_points_for_question"));
 
  611                    $scoretemplate->setVariable(
"VALUE_SAVE", $this->
lng->txt(
"save"));
 
  613                    $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
 
  614                    $maintemplate->setCurrentBlock(
"printview_question");
 
  615                    $maintemplate->setVariable(
"QUESTION_PRINTVIEW", $template->get());
 
  616                    $maintemplate->setVariable(
"QUESTION_SCORING", $scoretemplate->get());
 
  617                    $maintemplate->parseCurrentBlock();
 
  624            $maintemplate->setVariable(
"NO_QUESTIONS_FOUND", $this->
lng->txt(
"manscoring_questions_not_found"));
 
  626        $maintemplate->setVariable(
"RESULTS_OVERVIEW", sprintf($this->
lng->txt(
"manscoring_results_pass"), $pass + 1));
 
  628        include_once 
"./Services/YUI/classes/class.ilYuiUtil.php";
 
  631        return $maintemplate->get();
 
  643        $multipleObjectivesInvolved = 
true 
  645        $this->
ctrl->setParameter($targetGUI, 
'active_id', $active_id);
 
  646        $this->
ctrl->setParameter($targetGUI, 
'pass', $pass);
 
  648        $tableGUI = $this->buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD);
 
  650        if (!$this->isPdfDeliveryRequest()) {
 
  651            $tableGUI->setAnswerListAnchorEnabled($questionAnchorNav);
 
  654        $tableGUI->setSingleAnswerScreenCmd($questionDetailsCMD);
 
  655        $tableGUI->setShowHintCount($this->
object->isOfferingQuestionHintsEnabled());
 
  657        if ($objectivesList !== 
null) {
 
  658            $tableGUI->setQuestionRelatedObjectivesList($objectivesList);
 
  659            $tableGUI->setObjectiveOrientedPresentationEnabled(
true);
 
  662        $tableGUI->setMultipleObjectivesInvolved($multipleObjectivesInvolved);
 
  664        $tableGUI->setActiveId($active_id);
 
  665        $tableGUI->setShowSuggestedSolution(
false);
 
  667        $usersQuestionSolutions = array();
 
  669        foreach ($result_array as 
$key => $val) {
 
  670            if (
$key === 
'test' || 
$key === 
'pass') {
 
  674            if ($this->
object->getShowSolutionSuggested() && strlen($val[
'solution'])) {
 
  675                $tableGUI->setShowSuggestedSolution(
true);
 
  678            if (isset($val[
'pass'])) {
 
  679                $tableGUI->setPassColumnEnabled(
true);
 
  682            $usersQuestionSolutions[
$key] = $val;
 
  685        $tableGUI->initColumns();
 
  686        $tableGUI->initFilter();
 
  688        $tableGUI->setFilterCommand($targetCMD . 
'SetTableFilter');
 
  689        $tableGUI->setResetCommand($targetCMD . 
'ResetTableFilter');
 
  691        $tableGUI->setData($usersQuestionSolutions);
 
  704        if ($this->
object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
 
  705            $template = 
new ilTemplate(
"tpl.il_as_tst_results_userdata_signature.html", 
true, 
true, 
"Modules/Test");
 
  706            $template->setVariable(
"TXT_DATE", $this->
lng->txt(
"date"));
 
  711            $template->setVariable(
"TXT_SIGNATURE", $this->
lng->txt(
"tst_signature"));
 
  713            return $template->get();
 
  730        if (!is_object($testSession)) {
 
  731            throw new InvalidArgumentException(
'Not an object, expected ilTestSession|ilTestSessionDynamicQuestionSet');
 
  733        $template = 
new ilTemplate(
"tpl.il_as_tst_results_userdata.html", 
true, 
true, 
"Modules/Test");
 
  734        include_once 
'./Services/User/classes/class.ilObjUser.php';
 
  735        $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
  740            $user->setLastname($this->
lng->txt(
"deleted_user"));
 
  742        $t = $testSession->getSubmittedTimestamp();
 
  744            $t = $this->
object->_getLastAccess($testSession->getActiveId());
 
  747        if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
 
  748            $uname = $this->
object->userLookupFullName($user_id, $overwrite_anonymity);
 
  749            $template->setCurrentBlock(
"name");
 
  750            $template->setVariable(
'TXT_USR_NAME', $this->
lng->txt(
"name"));
 
  751            $template->setVariable(
'VALUE_USR_NAME', $uname);
 
  752            $template->parseCurrentBlock();
 
  756        if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == 
false) || ($overwrite_anonymity))) {
 
  757            $template->setCurrentBlock(
"matriculation");
 
  758            $template->setVariable(
"TXT_USR_MATRIC", $this->
lng->txt(
"matriculation"));
 
  759            $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
 
  760            $template->parseCurrentBlock();
 
  761            $title_matric = 
" - " . $this->
lng->txt(
"matriculation") . 
": " . $user->getMatriculation();
 
  764        $invited_user = array_pop($this->
object->getInvitedUsers($user_id));
 
  766        if ($invited_user != 
null && strlen($invited_user[
"clientip"])) {
 
  767            $template->setCurrentBlock(
"client_ip");
 
  768            $template->setVariable(
"TXT_CLIENT_IP", $this->
lng->txt(
"client_ip"));
 
  769            $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
 
  770            $template->parseCurrentBlock();
 
  771            $title_client = 
" - " . $this->
lng->txt(
"clientip") . 
": " . $invited_user[
"clientip"];
 
  774        $template->setVariable(
"TXT_TEST_TITLE", $this->
lng->txt(
"title"));
 
  775        $template->setVariable(
"VALUE_TEST_TITLE", $this->
object->getTitle());
 
  778        $pagetitle = $this->
object->getTitle() . $title_matric . $title_client;
 
  779        $this->tpl->setHeaderPageTitle($pagetitle);
 
  781        return $template->get();
 
  795        $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
 
  797        if ($this->isPdfDeliveryRequest()) {
 
  801        $template = 
new ilTemplate(
"tpl.il_as_tst_correct_solution_output.html", 
true, 
true, 
"Modules/Test");
 
  802        $show_question_only = ($this->
object->getShowSolutionAnswersOnly()) ? 
true : 
false;
 
  803        $result_output = $question_gui->getSolutionOutput($active_id, $pass, 
true, 
false, $show_question_only, $this->
object->getShowSolutionFeedback(), 
false, 
false, 
true);
 
  805            $result_output .= $question_gui->getAutoSavedSolutionOutput(
 
  818        $best_output = $question_gui->getSolutionOutput($active_id, $pass, 
false, 
false, $show_question_only, 
false, 
true, 
false, 
false);
 
  819        if ($this->
object->getShowSolutionFeedback() && $this->testrequest->raw(
'cmd') != 
'outCorrectSolution') {
 
  820            $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput(
 
  821                $question_gui->object->fetchIndexedValuesFromValuePairs(
 
  822                    $question_gui->object->getSolutionValues($active_id, $pass)
 
  825            if (strlen($specificAnswerFeedback)) {
 
  826                $template->setCurrentBlock(
"outline_specific_feedback");
 
  827                $template->setVariable(
"OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
 
  828                $template->parseCurrentBlock();
 
  831        if ($this->
object->isBestSolutionPrintedWithResult() && strlen($best_output)) {
 
  832            $template->setCurrentBlock(
"best_solution");
 
  833            $template->setVariable(
"TEXT_BEST_SOLUTION", $this->
lng->txt(
"tst_best_solution_is"));
 
  834            $template->setVariable(
"BEST_OUTPUT", $best_output);
 
  835            $template->parseCurrentBlock();
 
  837        $template->setVariable(
"TEXT_YOUR_SOLUTION", $this->
lng->txt(
"tst_your_answer_was"));
 
  838        $template->setVariable(
"TEXT_SOLUTION_OUTPUT", $this->
lng->txt(
"tst_your_answer_was")); 
 
  840        $maxpoints = $question_gui->object->getMaximumPoints();
 
  841        if ($maxpoints == 1) {
 
  842            $template->setVariable(
"QUESTION_TITLE", $this->
object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()) . 
" (" . $maxpoints . 
" " . $this->
lng->txt(
"point") . 
")");
 
  844            $template->setVariable(
"QUESTION_TITLE", $this->
object->getQuestionTitle($question_gui->object->getTitleForHTMLOutput()) . 
" (" . $maxpoints . 
" " . $this->
lng->txt(
"points") . 
")");
 
  846        if ($objectivesList !== 
null) {
 
  847            $objectives = $this->
lng->txt(
'tst_res_lo_objectives_header') . 
': ';
 
  848            $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
 
  851        $template->setVariable(
"SOLUTION_OUTPUT", $result_output);
 
  852        $template->setVariable(
"RECEIVED_POINTS", sprintf($this->
lng->txt(
"you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
 
  853        $template->setVariable(
"FORMACTION", $this->
ctrl->getFormAction($this));
 
  854        $template->setVariable(
"BACKLINK_TEXT", 
"<< " . $this->
lng->txt(
"back"));
 
  855        return $template->get();
 
  870    public function getResultsOfUserOutput($testSession, $active_id, $pass, $targetGUI, $show_pass_details = 
true, $show_answers = 
true, $show_question_only = 
false, $show_reached_points = 
false): string
 
  873        $ilObjDataCache = 
$DIC[
'ilObjDataCache'];
 
  875        include_once(
"./Services/UICore/classes/class.ilTemplate.php");
 
  876        $template = 
new ilTemplate(
"tpl.il_as_tst_results_participant.html", 
true, 
true, 
"Modules/Test");
 
  879            $user_id = $this->participantData->getUserIdByActiveId($active_id);
 
  880            $uname = $this->participantData->getConcatedFullnameByActiveId($active_id, 
false);
 
  882            $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
  883            $uname = $this->
object->userLookupFullName($user_id, 
true);
 
  886        if ($this->
object->getAnonymity()) {
 
  887            $uname = $this->
lng->txt(
'anonymous');
 
  890        if ((($this->testrequest->isset(
'pass')) && (strlen($this->testrequest->raw(
"pass")) > 0)) || (!is_null($pass))) {
 
  891            if (is_null($pass)) {
 
  892                $pass = $this->testrequest->raw(
"pass");
 
  896        if (!is_null($pass)) {
 
  897            require_once 
'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
 
  899            $objectivesList = 
null;
 
  901            if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
 
  902                $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
 
  903                $testSequence->loadFromDb();
 
  904                $testSequence->loadQuestions();
 
  906                require_once 
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
 
  909                $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
 
  910                $objectivesList->loadObjectivesTitles();
 
  912                $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
 
  913                $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
 
  914                $testResultHeaderLabelBuilder->setTestObjId($this->
object->getId());
 
  915                $testResultHeaderLabelBuilder->setTestRefId($this->
object->getRefId());
 
  916                $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
 
  919            $result_array = $this->
object->getTestResult(
 
  923                !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
 
  926            $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
  927            $showAllAnswers = 
true;
 
  928            if ($this->
object->isExecutable($testSession, $user_id)) {
 
  929                $showAllAnswers = 
false;
 
  932                $list_of_answers = $this->getPassListOfAnswers(
 
  939                    $show_reached_points,
 
  942                    $testResultHeaderLabelBuilder
 
  944                $template->setVariable(
"LIST_OF_ANSWERS", $list_of_answers);
 
  947            if ($show_pass_details) {
 
  948                $overviewTableGUI = $this->getPassDetailsOverviewTableGUI(
 
  953                    "getResultsOfUserOutput",
 
  958                $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
 
  959                $template->setVariable(
"PASS_DETAILS", $overviewTableGUI->getHTML());
 
  962            $signature = $this->getResultsSignature();
 
  963            $template->setVariable(
"SIGNATURE", $signature);
 
  965            if ($this->
object->isShowExamIdInTestResultsEnabled()) {
 
  966                $template->setCurrentBlock(
'exam_id_footer');
 
  968                    $testSession->getActiveId(),
 
  971                $template->setVariable(
'EXAM_ID_TXT', $this->
lng->txt(
'exam_id'));
 
  972                $template->parseCurrentBlock();
 
  976        $template->setCurrentBlock(
'participant_back_anchor');
 
  977        $template->setVariable(
"HREF_PARTICIPANT_BACK_ANCHOR", 
"#tst_results_toolbar");
 
  978        $template->setVariable(
"TXT_PARTICIPANT_BACK_ANCHOR", $this->
lng->txt(
'tst_back_to_top'));
 
  979        $template->parseCurrentBlock();
 
  981        $template->setCurrentBlock(
'participant_block_id');
 
  982        $template->setVariable(
"PARTICIPANT_BLOCK_ID", 
"participant_active_{$active_id}");
 
  983        $template->parseCurrentBlock();
 
  985        if ($this->isGradingMessageRequired()) {
 
  986            $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
 
  987            $gradingMessageBuilder->buildList();
 
  989            $template->setCurrentBlock(
'grading_message');
 
  990            $template->setVariable(
'GRADING_MESSAGE', $gradingMessageBuilder->getList());
 
  991            $template->parseCurrentBlock();
 
  995        $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, 
true);
 
  996        $template->setVariable(
"TEXT_HEADING", sprintf($this->
lng->txt(
"tst_result_user_name"), $uname));
 
  997        $template->setVariable(
"USER_DATA", $user_data);
 
  999        $this->populateExamId($template, (
int) $active_id, (
int) $pass);
 
 1002        return $template->get();
 
 1014        $template = 
new ilTemplate(
"tpl.il_as_tst_results_head_user_pass.html", 
true, 
true, 
"Modules/Test");
 
 1015        include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 1016        $user_id = $this->
object->_getUserIdFromActiveId($active_id);
 
 1021            $user->setLastname($this->
lng->txt(
"deleted_user"));
 
 1023        if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == 
false))) {
 
 1024            $template->setCurrentBlock(
"user_matric");
 
 1025            $template->setVariable(
"TXT_USR_MATRIC", $this->
lng->txt(
"matriculation"));
 
 1026            $template->parseCurrentBlock();
 
 1027            $template->setCurrentBlock(
"user_matric_value");
 
 1028            $template->setVariable(
"VALUE_USR_MATRIC", $user->getMatriculation());
 
 1029            $template->parseCurrentBlock();
 
 1030            $template->touchBlock(
"user_matric_separator");
 
 1033        $invited_user = array_pop($this->
object->getInvitedUsers($user_id));
 
 1034        if (strlen($invited_user[
"clientip"] ?? 
'')) {
 
 1035            $template->setCurrentBlock(
"user_clientip");
 
 1036            $template->setVariable(
"TXT_CLIENT_IP", $this->
lng->txt(
"client_ip"));
 
 1037            $template->parseCurrentBlock();
 
 1038            $template->setCurrentBlock(
"user_clientip_value");
 
 1039            $template->setVariable(
"VALUE_CLIENT_IP", $invited_user[
"clientip"]);
 
 1040            $template->parseCurrentBlock();
 
 1041            $template->touchBlock(
"user_clientip_separator");
 
 1044        $template->setVariable(
"TXT_USR_NAME", $this->
lng->txt(
"name"));
 
 1045        $uname = $this->
object->userLookupFullName($user_id, 
false);
 
 1046        $template->setVariable(
"VALUE_USR_NAME", $uname);
 
 1047        $template->setVariable(
"TXT_PASS", $this->
lng->txt(
"scored_pass"));
 
 1048        $template->setVariable(
"VALUE_PASS", $pass);
 
 1049        return $template->get();
 
 1064        $question_gui = $this->
object->createQuestionGUI(
"", $question_id);
 
 1066        $this->
object->setAccessFilteredParticipantList(
 
 1067            $this->
object->buildStatisticsAccessFilteredParticipantList()
 
 1070        $foundusers = $this->
object->getParticipantsForTestAndQuestion($test_id, $question_id);
 
 1072        foreach ($foundusers as $active_id => $passes) {
 
 1073            $resultpass = $this->
object->_getResultPass($active_id);
 
 1074            for (
$i = 0; 
$i < count($passes); 
$i++) {
 
 1075                if (($resultpass !== 
null) && ($resultpass == $passes[
$i][
"pass"])) {
 
 1077                        $output .= 
"<br /><br /><br />";
 
 1081                    $question_gui = $this->
object->createQuestionGUI(
"", $passes[
$i][
"qid"]);
 
 1082                    $output .= $this->getResultsHeadUserAndPass($active_id, $resultpass + 1);
 
 1084                    $output .= $question_gui->getSolutionOutput(
 
 1087                        $graphicalOutput = 
false,
 
 1088                        $result_output = 
false,
 
 1089                        $show_question_only = 
false,
 
 1090                        $show_feedback = 
false 
 1096        require_once 
'./Modules/Test/classes/class.ilTestPDFGenerator.php';
 
 1105        if (!isset($targetGUI->object) && method_exists($targetGUI, 
'getTestObj')) {
 
 1106            $targetGUI->object = $targetGUI->getTestObj();
 
 1110        $tableGUI->setIsPdfGenerationRequest($this->isPdfDeliveryRequest());
 
 1116        if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
 
 1120        if ($this->
object->isShowGradingStatusEnabled()) {
 
 1124        if ($this->
object->isShowGradingMarkEnabled()) {
 
 1137        require_once 
'Modules/Test/classes/class.ilTestGradingMessageBuilder.php';
 
 1140        $gradingMessageBuilder->setActiveId($activeId);
 
 1142        return $gradingMessageBuilder;
 
 1147        require_once 
'Modules/Test/classes/class.ilTestQuestionRelatedObjectivesList.php';
 
 1152        return $questionRelatedObjectivesList;
 
 1155    protected function getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions): array
 
 1159        $component_repository = 
$DIC[
'component.repository'];
 
 1161        $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 
'outUserPassDetails');
 
 1162        $table_gui->initFilter();
 
 1166        $questionList->setParentObjIdsFilter(array($this->
object->getId()));
 
 1169        foreach ($table_gui->getFilterItems() as $item) {
 
 1170            if (substr($item->getPostVar(), 0, strlen(
'tax_')) == 
'tax_') {
 
 1171                $v = $item->getValue();
 
 1173                if (is_array($v) && count($v) && !(
int) $v[0]) {
 
 1177                $taxId = substr($item->getPostVar(), strlen(
'tax_'));
 
 1178                $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 
'tst');
 
 1179            } elseif ($item->getValue() !== 
false) {
 
 1180                $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
 
 1184        $questionList->load();
 
 1186        $filteredTestResult = array();
 
 1188        $resultData = $this->
object->getTestResult($active_id, $pass, 
false, $considerHiddenQuestions, $considerOptionalQuestions);
 
 1190        foreach ($resultData as $resultItemKey => $resultItemValue) {
 
 1191            if ($resultItemKey === 
'test' || $resultItemKey === 
'pass') {
 
 1195            if (!$questionList->isInList($resultItemValue[
'qid'])) {
 
 1199            $filteredTestResult[] = $resultItemValue;
 
 1202        return $filteredTestResult;
 
 1210        if ($this->isPdfDeliveryRequest()) {
 
 1214                $this->
object->getTitleFilenameCompliant(),
 
 1218            $this->tpl->setContent($content);
 
 1227        require_once 
'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php';
 
 1235        $this->outCorrectSolution(); 
 
 1245        if (!$this->
object->getShowSolutionDetails()) {
 
 1246            $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_permission"), 
true);
 
 1247            $this->
ctrl->redirectByClass(
"ilobjtestgui", 
"infoScreen");
 
 1250        $testSession = $this->testSessionFactory->getSession();
 
 1251        $activeId = $testSession->getActiveId();
 
 1253        if (!($activeId > 0)) {
 
 1254            $this->
ctrl->redirectByClass(
"ilobjtestgui", 
"infoScreen");
 
 1257        $this->
ctrl->saveParameter($this, 
"pass");
 
 1258        $pass = (
int) $this->testrequest->raw(
"pass");
 
 1260        $questionId = (
int) $this->testrequest->raw(
'evaluation');
 
 1262        $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
 
 1263        $testSequence->loadFromDb();
 
 1264        $testSequence->loadQuestions();
 
 1266        if (!$testSequence->questionExists($questionId)) {
 
 1270        if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
 
 1271            $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
 
 1272            $testSequence->loadFromDb();
 
 1273            $testSequence->loadQuestions();
 
 1275            require_once 
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
 
 1277            $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
 
 1278            $objectivesList->loadObjectivesTitles();
 
 1280            $objectivesList = 
null;
 
 1284        $ilTabs = 
$DIC[
'ilTabs'];
 
 1287            $ilTabs->setBackTarget(
 
 1288                $this->
lng->txt(
"tst_back_to_virtual_pass"),
 
 1289                $this->ctrl->getLinkTarget($this, 
'showVirtualPass')
 
 1292            $ilTabs->setBackTarget(
 
 1293                $this->
lng->txt(
"tst_back_to_pass_details"),
 
 1294                $this->ctrl->getLinkTarget($this, 
'outUserPassDetails')
 
 1297        $ilTabs->clearSubTabs();
 
 1299        include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
 
 1300        $this->tpl->setCurrentBlock(
"ContentStyle");
 
 1302        $this->tpl->parseCurrentBlock();
 
 1304        $this->tpl->setCurrentBlock(
"SyntaxStyle");
 
 1306        $this->tpl->parseCurrentBlock();
 
 1309        if ($this->
object->getShowSolutionAnswersOnly()) {
 
 1313        $solution = $this->getCorrectSolutionOutput($questionId, $activeId, $pass, $objectivesList);
 
 1315        $this->tpl->setContent($solution);
 
 1328        $tpl->setVariable(
"PASS_FINISH_DATE_LABEL", $this->
lng->txt(
'tst_pass_finished_on'));
 
 1329        $tpl->setVariable(
"PASS_FINISH_DATE_VALUE", $passFinishDate);
 
 1339        if ($this->
object->isShowExamIdInTestResultsEnabled()) {
 
 1350        return $this->object;
 
setVariable($variable, $value='')
Sets a variable value.
 
const RENDER_PURPOSE_PRINT_PDF
 
static _getReachedPoints(int $active_id, int $question_id, int $pass)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static getRequestRequestStatisticDataRegisterByActiveId($activeId)
 
const QUESTION_INSTANCE_TYPE_DUPLICATES
 
static useRelativeDates()
 
static setUseRelativeDates(bool $a_status)
set use relative dates
 
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
 
@classDescription Date and time handling
 
buildQuestionRelatedObjectiveList(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
 
static getInstance(ilTestSession $a_test_session)
 
static _getManualScoring()
Retrieve the manual scoring settings.
 
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
 
static getSyntaxStylePath()
 
static accessViolationRedirect()
 
static lookupExamId($active_id, $pass)
 
static lookupLastTestPassAccess($activeId, $passIndex)
 
static getSingleManualFeedback(int $active_id, int $question_id, int $pass)
 
static _lookupLogin(int $a_user_id)
 
static prepareGenerationRequest(string $service, string $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
 
static get(string $a_var)
 
special template class to simplify handling of ITX/PEAR
 
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
 
const PDF_OUTPUT_DOWNLOAD
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
const FIXED_SHUFFLER_SEED_MIN_LENGTH
 
Service GUI class for tests.
 
ILIAS Test InternalRequestService $testrequest
 
getGradingMessageBuilder($activeId)
 
getFilteredTestResult($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
 
outCorrectSolution()
Creates an output of the solution of an answer compared to the correct solution.
 
getCorrectSolutionOutput($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList=null)
Returns an output of the solution to an answer compared to the correct solution.
 
populateContent($content)
 
populateExamId(ilTemplate $tpl, int $activeId, int $pass)
 
getResultsOfUserOutput($testSession, $active_id, $pass, $targetGUI, $show_pass_details=true, $show_answers=true, $show_question_only=false, $show_reached_points=false)
Output of the pass overview for a test called by a test participant.
 
getObjectiveOrientedContainer()
 
getPassDetailsOverviewTableGUI( $result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)
 
setObjectiveOrientedContainer(ilTestObjectiveOrientedContainer $objectiveOrientedContainer)
 
executeCommand()
execute command
 
isContextResultPresentation()
 
populatePassFinishDate($tpl, $passFinishDate)
 
$contextResultPresentation
 
__construct(ilObjTest $a_object)
The constructor takes the test object reference as parameter.
 
getResultsSignature()
Returns HTML code for a signature field.
 
getCommand($cmd)
Retrieves the ilCtrl command.
 
buildPassOverviewTableGUI($targetGUI)
 
buildQuestionAnswerShuffler(int $question_id, int $active_id, int $pass_id)
 
getQuestionResultForTestUsers($question_id, $test_id)
Creates a HTML representation for the results of a given question in a test.
 
buildUserTestResultsToolbarGUI()
 
buildFixedShufflerSeed(int $question_id, int $pass_id, int $active_id)
 
setContextResultPresentation($contextResultPresentation)
 
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
 
getPassOverviewTableData(ilTestSession $testSession, $passes, $withResults)
This method uses the data of a given test pass to create an evaluation for displaying into a table us...
 
isGradingMessageRequired()
 
getPassListOfAnswers(&$result_array, $active_id, $pass, $show_solutions=false, $only_answered_questions=false, $show_question_only=false, $show_reached_points=false, $anchorNav=false, ilTestQuestionRelatedObjectivesList $objectivesList=null, ilTestResultHeaderLabelBuilder $testResultHeaderLabelBuilder=null)
Returns the list of answers of a users test pass.
 
getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, $overwrite_anonymity=false)
Returns the user data for a test results output.
 
getResultsHeadUserAndPass($active_id, $pass)
Returns the user and pass data for a test results output.
 
$objectiveOrientedContainer
 
setParticipantData($participantData)
 
buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD)
 
getPassListOfAnswersWithScoring(&$result_array, $active_id, $pass, $show_solutions=false)
Returns the list of answers of a users test pass and offers a scoring option.
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
 
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
 
static initDomEvent(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent used in Services/Calendar, Modules/Session, Modules/Test (Jan 2022)
 
const PDF_USER_RESULT
PDF Purposes.
 
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
 
header include for all ilias files.