ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilTestServiceGUI Class Reference

Service GUI class for tests. More...

+ Inheritance diagram for ilTestServiceGUI:
+ Collaboration diagram for ilTestServiceGUI:

Public Member Functions

 isContextResultPresentation ()
 
 setContextResultPresentation ($contextResultPresentation)
 
 __construct (ilObjTest $a_object)
 The constructor takes the test object reference as parameter. More...
 
 setParticipantData ($participantData)
 
 getParticipantData ()
 
 getPassOverviewTableData (ilTestSession $testSession, $passes, $withResults)
 
 setObjectiveOrientedContainer (ilTestObjectiveOrientedContainer $objectiveOrientedContainer)
 
 getObjectiveOrientedContainer ()
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 Retrieves the ilCtrl command. More...
 
 buildPassOverviewTableGUI ($targetGUI, $targetCmd='')
 
 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. More...
 
 getPassListOfAnswersWithScoring (&$result_array, $active_id, $pass, $show_solutions=false)
 Returns the list of answers of a users test pass and offers a scoring option. More...
 
 getResultsSignature ()
 Returns HTML code for a signature field. More...
 
 getAdditionalUsrDataHtmlAndPopulateWindowTitle ($testSession, $active_id, $overwrite_anonymity=false)
 Returns the user data for a test results output. More...
 
 getCorrectSolutionOutput ($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList=null)
 Returns an output of the solution to an answer compared to the correct solution. More...
 
 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. More...
 
 getResultsHeadUserAndPass ($active_id, $pass)
 Returns the user and pass data for a test results output. More...
 
 getQuestionResultForTestUsers ($question_id, $test_id)
 Creates a HTML representation for the results of a given question in a test. More...
 
 populatePassFinishDate ($tpl, $passFinishDate)
 

Data Fields

 $object = null
 
 $service = null
 
 $lng
 
 $tpl
 
 $ctrl
 
 $ilias
 
 $tree
 
 $ref_id
 

Protected Member Functions

 handleTabs ($activeTabId)
 
 isPdfDeliveryRequest ()
 
 getPassDetailsOverviewTableGUI ($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)
 
 buildPassDetailsOverviewTableGUI ($targetGUI, $targetCMD)
 
 isGradingMessageRequired ()
 
 getGradingMessageBuilder ($activeId)
 
 buildQuestionRelatedObjectivesList (ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
 
 getFilteredTestResult ($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
 
 populateContent ($content)
 
 buildUserTestResultsToolbarGUI ()
 
 outCorrectSolutionCmd ()
 
 outCorrectSolution ()
 Creates an output of the solution of an answer compared to the correct solution. More...
 

Protected Attributes

 $db
 
 $tabs
 
 $objCache
 
 $testSessionFactory = null
 
 $testSequenceFactory = null
 
 $participantData
 

Private Attributes

 $objectiveOrientedContainer
 
 $contextResultPresentation = true
 

Detailed Description

Service GUI class for tests.

This class is the parent class for all service classes which are called from ilObjTestGUI. This is mainly done to reduce the size of ilObjTestGUI to put command service functions into classes that could be called by ilCtrl.

@ilCtrl_IsCalledBy ilTestServiceGUI: ilObjTestGUI

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 21 of file class.ilTestServiceGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestServiceGUI::__construct ( ilObjTest  $a_object)

The constructor takes the test object reference as parameter.

Parameters
object$a_objectAssociated ilObjTest class @access public

Reimplemented in ilTestEvaluationGUI, ilTestScoringByQuestionsGUI, and ilTestScoringGUI.

Definition at line 108 of file class.ilTestServiceGUI.php.

109 {
110 global $lng, $tpl, $ilCtrl, $ilias, $tree, $ilDB, $ilPluginAdmin, $ilTabs, $ilObjDataCache;
111
112 $this->db = $ilDB;
113 $this->lng =&$lng;
114 $this->tpl =&$tpl;
115 $this->ctrl =&$ilCtrl;
116 $this->tabs = $ilTabs;
117 $this->objCache = $ilObjDataCache;
118 $this->ilias =&$ilias;
119 $this->object =&$a_object;
120 $this->tree =&$tree;
121 $this->ref_id = $a_object->ref_id;
122
123 $this->service = new ilTestService($a_object);
124
125 require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
126 $this->testSessionFactory = new ilTestSessionFactory($this->object);
127
128 require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
129 $this->testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
130
131 $this->objectiveOrientedContainer = null;
132 }
Service class for tests.
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
global $ilDB

References $ilCtrl, $ilDB, $ilias, $lng, $tpl, and $tree.

Member Function Documentation

◆ buildPassDetailsOverviewTableGUI()

ilTestServiceGUI::buildPassDetailsOverviewTableGUI (   $targetGUI,
  $targetCMD 
)
protected

◆ buildPassOverviewTableGUI()

ilTestServiceGUI::buildPassOverviewTableGUI (   $targetGUI,
  $targetCmd = '' 
)
Returns
ilTestPassOverviewTableGUI $tableGUI

Definition at line 337 of file class.ilTestServiceGUI.php.

338 {
339 require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
340
341 $table = new ilTestPassOverviewTableGUI($targetGUI, $targetCmd);
342
343 $table->setPdfPresentationEnabled(
344 isset($_GET['pdf']) && $_GET['pdf'] == 1
345 );
346
347 $table->setObjectiveOrientedPresentationEnabled(
348 $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
349 );
350
351 return $table;
352 }
$_GET["client_id"]
Class ilTestPassOverviewTableGUI.
if(empty($password)) $table
Definition: pwgen.php:24

References $_GET, $table, and getObjectiveOrientedContainer().

Referenced by ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), and ilTestEvaluationGUI\outUserResultsOverview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionRelatedObjectivesList()

ilTestServiceGUI::buildQuestionRelatedObjectivesList ( ilLOTestQuestionAdapter  $objectivesAdapter,
ilTestQuestionSequence  $testSequence 
)
protected

Definition at line 1010 of file class.ilTestServiceGUI.php.

1011 {
1012 require_once 'Modules/Test/classes/class.ilTestQuestionRelatedObjectivesList.php';
1013 $questionRelatedObjectivesList = new ilTestQuestionRelatedObjectivesList();
1014
1015 $objectivesAdapter->buildQuestionRelatedObjectiveList($testSequence, $questionRelatedObjectivesList);
1016
1017 return $questionRelatedObjectivesList;
1018 }
buildQuestionRelatedObjectiveList(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)

References ilLOTestQuestionAdapter\buildQuestionRelatedObjectiveList().

Referenced by ilTestPlayerAbstractGUI\archiveParticipantSubmission(), ilTestSubmissionReviewGUI\buildUserReviewOutput(), getPassOverviewTableData(), getResultsOfUserOutput(), outCorrectSolution(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildUserTestResultsToolbarGUI()

ilTestServiceGUI::buildUserTestResultsToolbarGUI ( )
protected
Returns
ilTestResultsToolbarGUI

Definition at line 1091 of file class.ilTestServiceGUI.php.

1092 {
1093 require_once 'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php';
1094 $toolbar = new ilTestResultsToolbarGUI($this->ctrl, $this->tpl, $this->lng);
1095
1096 $toolbar->setSkillResultButtonEnabled($this->object->isSkillServiceToBeConsidered());
1097
1098 return $toolbar;
1099 }

Referenced by ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserPassDetails(), ilTestEvaluationGUI\outUserResultsOverview(), and ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

+ Here is the caller graph for this function:

◆ executeCommand()

ilTestServiceGUI::executeCommand ( )

execute command

Reimplemented in ilTestEvalObjectiveOrientedGUI, ilTestEvaluationGUI, ilTestOutputGUI, ilTestPlayerDynamicQuestionSetGUI, ilTestScoringGUI, and ilTestSubmissionReviewGUI.

Definition at line 271 of file class.ilTestServiceGUI.php.

272 {
273 $cmd = $this->ctrl->getCmd();
274 $next_class = $this->ctrl->getNextClass($this);
275
276 $cmd = $this->getCommand($cmd);
277 switch ($next_class) {
278 default:
279 $ret =&$this->$cmd();
280 break;
281 }
282 return $ret;
283 }
getCommand($cmd)
Retrieves the ilCtrl command.
$ret
Definition: parser.php:6

References $ret, and getCommand().

+ Here is the call graph for this function:

◆ getAdditionalUsrDataHtmlAndPopulateWindowTitle()

ilTestServiceGUI::getAdditionalUsrDataHtmlAndPopulateWindowTitle (   $testSession,
  $active_id,
  $overwrite_anonymity = false 
)

Returns the user data for a test results output.

Parameters
ilTestSession|ilTestSessionDynamicQuestionSet
integer$user_idThe user ID of the user
boolean$overwrite_anonymityTRUE if the anonymity status should be overwritten, FALSE otherwise
Returns
string HTML code of the user data for the test results @access public

Definition at line 623 of file class.ilTestServiceGUI.php.

624 {
625 if (!is_object($testSession)) {
626 throw new TestException();
627 }
628 $template = new ilTemplate("tpl.il_as_tst_results_userdata.html", true, true, "Modules/Test");
629 include_once './Services/User/classes/class.ilObjUser.php';
630 $user_id = $this->object->_getUserIdFromActiveId($active_id);
631 if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
632 $user = new ilObjUser($user_id);
633 } else {
634 $user = new ilObjUser();
635 $user->setLastname($this->lng->txt("deleted_user"));
636 }
637 $t = $testSession->getSubmittedTimestamp();
638 if (!$t) {
639 $t = $this->object->_getLastAccess($testSession->getActiveId());
640 }
641
642 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
643 $uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
644 $template->setCurrentBlock("name");
645 $template->setVariable('TXT_USR_NAME', $this->lng->txt("name"));
646 $template->setVariable('VALUE_USR_NAME', $uname);
647 $template->parseCurrentBlock();
648 }
649
650 $title_matric = "";
651 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false) || ($overwrite_anonymity))) {
652 $template->setCurrentBlock("matriculation");
653 $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
654 $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
655 $template->parseCurrentBlock();
656 $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
657 }
658
659 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
660 if (strlen($invited_user["clientip"])) {
661 $template->setCurrentBlock("client_ip");
662 $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
663 $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
664 $template->parseCurrentBlock();
665 $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
666 }
667
668 $template->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
669 $template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
670
671 // change the pagetitle (tab title or title in title bar of window)
672 $pagetitle = $this->object->getTitle() . $title_matric . $title_client;
673 $this->tpl->setHeaderPageTitle($pagetitle);
674
675 return $template->get();
676 }
static _lookupLogin($a_user_id)
lookup login
special template class to simplify handling of ITX/PEAR
$template

References $t, $template, ilObjUser\_lookupLogin(), and getObjectiveOrientedContainer().

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserPassDetails(), ilTestEvaluationGUI\outUserResultsOverview(), and ilTestPlayerAbstractGUI\showListOfAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCommand()

ilTestServiceGUI::getCommand (   $cmd)

Retrieves the ilCtrl command.

@access public

Definition at line 290 of file class.ilTestServiceGUI.php.

291 {
292 return $cmd;
293 }

Referenced by ilTestEvaluationGUI\executeCommand(), ilTestOutputGUI\executeCommand(), ilTestScoringGUI\executeCommand(), and executeCommand().

+ Here is the caller graph for this function:

◆ getCorrectSolutionOutput()

ilTestServiceGUI::getCorrectSolutionOutput (   $question_id,
  $active_id,
  $pass,
ilTestQuestionRelatedObjectivesList  $objectivesList = null 
)

Returns an output of the solution to an answer compared to the correct solution.

Parameters
integer$question_idDatabase ID of the question
integer$active_idActive ID of the active user
integer$passTest pass
Returns
string HTML code of the correct solution comparison @access public

Definition at line 687 of file class.ilTestServiceGUI.php.

688 {
689 global $ilUser;
690
691 $test_id = $this->object->getTestId();
692 $question_gui = $this->object->createQuestionGUI("", $question_id);
693
694 if ($this->isPdfDeliveryRequest()) {
695 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
696 }
697
698 $template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", true, true, "Modules/Test");
699 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
700 $result_output = $question_gui->getSolutionOutput($active_id, $pass, true, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, false, true);
701 $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true, false, false);
702 if ($this->object->getShowSolutionFeedback() && $_GET['cmd'] != 'outCorrectSolution') {
703 $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput($active_id, $pass);
704 if (strlen($specificAnswerFeedback)) {
705 $template->setCurrentBlock("outline_specific_feedback");
706 $template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
707 $template->parseCurrentBlock();
708 }
709 }
710 if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output)) {
711 $template->setCurrentBlock("best_solution");
712 $template->setVariable("TEXT_BEST_SOLUTION", $this->lng->txt("tst_best_solution_is"));
713 $template->setVariable("BEST_OUTPUT", $best_output);
714 $template->parseCurrentBlock();
715 }
716 $template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
717 $maxpoints = $question_gui->object->getMaximumPoints();
718 if ($maxpoints == 1) {
719 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
720 } else {
721 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
722 }
723 if ($objectivesList !== null) {
724 $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
725 $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
726 $template->setVariable('OBJECTIVES', $objectives);
727 }
728 $template->setVariable("SOLUTION_OUTPUT", $result_output);
729 $template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
730 $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
731 $template->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back"));
732 return $template->get();
733 }
sprintf('%.4f', $callTime)
$ilUser
Definition: imgupload.php:18

References $_GET, $ilUser, $pass, $template, isPdfDeliveryRequest(), assQuestionGUI\RENDER_PURPOSE_PRINT_PDF, and sprintf.

Referenced by ilTestPlayerAbstractGUI\outCorrectSolution(), and outCorrectSolution().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFilteredTestResult()

ilTestServiceGUI::getFilteredTestResult (   $active_id,
  $pass,
  $considerHiddenQuestions,
  $considerOptionalQuestions 
)
protected

Reimplemented in ilTestEvaluationGUI.

Definition at line 1020 of file class.ilTestServiceGUI.php.

1021 {
1022 global $ilDB, $ilPluginAdmin;
1023
1024 $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
1025 $table_gui->initFilter();
1026
1027 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
1028 $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
1029
1030 $questionList->setParentObjIdsFilter(array($this->object->getId()));
1031 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
1032
1033 foreach ($table_gui->getFilterItems() as $item) {
1034 if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
1035 $v = $item->getValue();
1036
1037 if (is_array($v) && count($v) && !(int) $v[0]) {
1038 continue;
1039 }
1040
1041 $taxId = substr($item->getPostVar(), strlen('tax_'));
1042 $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst');
1043 } elseif ($item->getValue() !== false) {
1044 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1045 }
1046 }
1047
1048 $questionList->load();
1049
1050 $filteredTestResult = array();
1051
1052 $resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
1053
1054 foreach ($resultData as $resultItemKey => $resultItemValue) {
1055 if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
1056 continue;
1057 }
1058
1059 if (!$questionList->isInList($resultItemValue['qid'])) {
1060 continue;
1061 }
1062
1063 $filteredTestResult[] = $resultItemValue;
1064 }
1065
1066 return $filteredTestResult;
1067 }
buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD)

References $ilDB, $pass, buildPassDetailsOverviewTableGUI(), and ilAssQuestionList\QUESTION_INSTANCE_TYPE_DUPLICATES.

+ Here is the call graph for this function:

◆ getGradingMessageBuilder()

ilTestServiceGUI::getGradingMessageBuilder (   $activeId)
protected
Parameters
integer$activeId
Returns
ilTestGradingMessageBuilder

Definition at line 1000 of file class.ilTestServiceGUI.php.

1001 {
1002 require_once 'Modules/Test/classes/class.ilTestGradingMessageBuilder.php';
1003 $gradingMessageBuilder = new ilTestGradingMessageBuilder($this->lng, $this->object);
1004
1005 $gradingMessageBuilder->setActiveId($activeId);
1006
1007 return $gradingMessageBuilder;
1008 }

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvaluationGUI\outUserResultsOverview().

+ Here is the caller graph for this function:

◆ getObjectiveOrientedContainer()

◆ getParticipantData()

ilTestServiceGUI::getParticipantData ( )
Returns
\ilTestParticipantData

Definition at line 145 of file class.ilTestServiceGUI.php.

References $participantData.

◆ getPassDetailsOverviewTableGUI()

ilTestServiceGUI::getPassDetailsOverviewTableGUI (   $result_array,
  $active_id,
  $pass,
  $targetGUI,
  $targetCMD,
  $questionDetailsCMD,
  $questionAnchorNav,
ilTestQuestionRelatedObjectivesList  $objectivesList = null,
  $multipleObjectivesInvolved = true 
)
protected

Definition at line 539 of file class.ilTestServiceGUI.php.

540 {
541 $this->ctrl->setParameter($targetGUI, 'active_id', $active_id);
542 $this->ctrl->setParameter($targetGUI, 'pass', $pass);
543
544 $tableGUI = $this->buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD);
545
546 if (!$this->isPdfDeliveryRequest()) {
547 $tableGUI->setAnswerListAnchorEnabled($questionAnchorNav);
548 }
549
550 $tableGUI->setSingleAnswerScreenCmd($questionDetailsCMD);
551 $tableGUI->setShowHintCount($this->object->isOfferingQuestionHintsEnabled());
552
553 if ($objectivesList !== null) {
554 $tableGUI->setQuestionRelatedObjectivesList($objectivesList);
555 $tableGUI->setObjectiveOrientedPresentationEnabled(true);
556 }
557
558 $tableGUI->setMultipleObjectivesInvolved($multipleObjectivesInvolved);
559
560 $tableGUI->setActiveId($active_id);
561 $tableGUI->setShowSuggestedSolution(false);
562
563 $usersQuestionSolutions = array();
564
565 foreach ($result_array as $key => $val) {
566 if ($key === 'test' || $key === 'pass') {
567 continue;
568 }
569
570 if ($this->object->getShowSolutionSuggested() && strlen($val['solution'])) {
571 $tableGUI->setShowSuggestedSolution(true);
572 }
573
574 if (isset($val['pass'])) {
575 $tableGUI->setPassColumnEnabled(true);
576 }
577
578 $usersQuestionSolutions[$key] = $val;
579 }
580
581 $tableGUI->initColumns()->initFilter();
582
583 $tableGUI->setFilterCommand($targetCMD . 'SetTableFilter');
584 $tableGUI->setResetCommand($targetCMD . 'ResetTableFilter');
585
586 $tableGUI->setData($usersQuestionSolutions);
587
588 return $tableGUI;
589 }
$key
Definition: croninfo.php:18

References $key, $pass, buildPassDetailsOverviewTableGUI(), and isPdfDeliveryRequest().

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPassListOfAnswers()

ilTestServiceGUI::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.

Parameters
array$result_arrayAn array containing the results of the users test pass (generated by ilObjTest::getTestResult)
integer$active_idActive ID of the active user
integer$passTest pass
boolean$show_solutionsTRUE, if the solution output should be shown in the answers, FALSE otherwise
Returns
string HTML code of the list of answers @access public

Definition at line 364 of file class.ilTestServiceGUI.php.

365 {
366 $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", true, true, "Modules/Test");
367
368 $counter = 1;
369 // output of questions with solutions
370 foreach ($result_array as $question_data) {
371 if (($question_data["workedthrough"] == 1) || ($only_answered_questions == false)) {
372 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", true, true, "Modules/TestQuestionPool");
373 $question = $question_data["qid"];
374 if (is_numeric($question)) {
375 $maintemplate->setCurrentBlock("printview_question");
376 $question_gui = $this->object->createQuestionGUI("", $question);
377 if (is_object($question_gui)) {
378 if ($this->isPdfDeliveryRequest()) {
379 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
380 }
381
382 if ($anchorNav) {
383 $template->setCurrentBlock('block_id');
384 $template->setVariable('BLOCK_ID', "detailed_answer_block_act_{$active_id}_qst_{$question}");
385 $template->parseCurrentBlock();
386
387 $template->setCurrentBlock('back_anchor');
388 $template->setVariable('HREF_BACK_ANCHOR', "#pass_details_tbl_row_act_{$active_id}_qst_{$question}");
389 $template->setVariable('TXT_BACK_ANCHOR', $this->lng->txt('tst_back_to_question_list'));
390 $template->parseCurrentBlock();
391 }
392
393 if ($show_reached_points) {
394 $template->setCurrentBlock("result_points");
395 $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());
396 $template->parseCurrentBlock();
397 }
398 $template->setVariable("COUNTER_QUESTION", $counter . ". ");
399 $template->setVariable("TXT_QUESTION_ID", $this->lng->txt('question_id_short'));
400 $template->setVariable("QUESTION_ID", $question_gui->object->getId());
401 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
402
403 if ($objectivesList !== null) {
404 $objectives = $this->lng->txt('tst_res_lo_objectives_header') . ': ';
405 $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
406 $template->setVariable("OBJECTIVES", $objectives);
407 }
408
409 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
410
411 $showFeedback = $this->isContextResultPresentation() && $this->object->getShowSolutionFeedback();
412 $show_solutions = $this->isContextResultPresentation() && $show_solutions;
413
414 if ($show_solutions) {
415 $compare_template = new ilTemplate('tpl.il_as_tst_answers_compare.html', true, true, 'Modules/Test');
416 $compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant'));
417 $compare_template->setVariable("HEADER_SOLUTION", $this->lng->txt('tst_header_solution'));
418 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $showFeedback);
419 $best_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, $show_question_only, false, true);
420
421 $compare_template->setVariable('PARTICIPANT', $result_output);
422 $compare_template->setVariable('SOLUTION', $best_output);
423 $template->setVariable('SOLUTION_OUTPUT', $compare_template->get());
424 } else {
425 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $showFeedback);
426 $template->setVariable('SOLUTION_OUTPUT', $result_output);
427 }
428
429 $maintemplate->setCurrentBlock("printview_question");
430 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
431 $maintemplate->parseCurrentBlock();
432 $counter++;
433 }
434 }
435 }
436 }
437
438 if ($testResultHeaderLabelBuilder !== null) {
439 if ($pass !== null) {
440 $headerText = $testResultHeaderLabelBuilder->getListOfAnswersHeaderLabel($pass + 1);
441 } else {
442 $headerText = $testResultHeaderLabelBuilder->getVirtualListOfAnswersHeaderLabel();
443 }
444 } else {
445 $headerText = '';
446 }
447
448 $maintemplate->setVariable("RESULTS_OVERVIEW", $headerText);
449 return $maintemplate->get();
450 }
$counter

References $counter, $pass, $template, isContextResultPresentation(), isPdfDeliveryRequest(), and assQuestionGUI\RENDER_PURPOSE_PRINT_PDF.

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPassListOfAnswersWithScoring()

ilTestServiceGUI::getPassListOfAnswersWithScoring ( $result_array,
  $active_id,
  $pass,
  $show_solutions = false 
)

Returns the list of answers of a users test pass and offers a scoring option.

Parameters
array$result_arrayAn array containing the results of the users test pass (generated by ilObjTest::getTestResult)
integer$active_idActive ID of the active user
integer$passTest pass
boolean$show_solutionsTRUE, if the solution output should be shown in the answers, FALSE otherwise
Returns
string HTML code of the list of answers @access public
Deprecated:

Definition at line 464 of file class.ilTestServiceGUI.php.

465 {
466 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
467
468 $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", true, true, "Modules/Test");
469
470 include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
472
473 $counter = 1;
474 // output of questions with solutions
475 foreach ($result_array as $question_data) {
476 $question = $question_data["qid"];
477 if (is_numeric($question)) {
478 $question_gui = $this->object->createQuestionGUI("", $question);
479 if (in_array($question_gui->object->getQuestionTypeID(), $scoring)) {
480 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", true, true, "Modules/TestQuestionPool");
481 $scoretemplate = new ilTemplate("tpl.il_as_tst_manual_scoring_points.html", true, true, "Modules/Test");
482 #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
483 $template->setVariable("COUNTER_QUESTION", $counter . ". ");
484 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
485 $points = $question_gui->object->getMaximumPoints();
486 if ($points == 1) {
487 $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("point"));
488 } else {
489 $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("points"));
490 }
491
492 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? true : false;
493 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, false, $show_question_only, $this->object->getShowSolutionFeedback(), false, true);
494
495 $solout = $question_gui->object->getSuggestedSolutionOutput();
496 if (strlen($solout)) {
497 $scoretemplate->setCurrentBlock("suggested_solution");
498 $scoretemplate->setVariable("TEXT_SUGGESTED_SOLUTION", $this->lng->txt("solution_hint"));
499 $scoretemplate->setVariable("VALUE_SUGGESTED_SOLUTION", $solout);
500 $scoretemplate->parseCurrentBlock();
501 }
502
503 $scoretemplate->setCurrentBlock("feedback");
504 $scoretemplate->setVariable("FEEDBACK_NAME_INPUT", $question);
505 $feedback = $this->object->getManualFeedback($active_id, $question, $pass);
506 $scoretemplate->setVariable("VALUE_FEEDBACK", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, true)));
507 $scoretemplate->setVariable("TEXT_MANUAL_FEEDBACK", $this->lng->txt("set_manual_feedback"));
508 $scoretemplate->parseCurrentBlock();
509
510 $scoretemplate->setVariable("NAME_INPUT", $question);
511 $this->ctrl->setParameter($this, "active_id", $active_id);
512 $this->ctrl->setParameter($this, "pass", $pass);
513 $scoretemplate->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "manscoring"));
514 $scoretemplate->setVariable("LABEL_INPUT", $this->lng->txt("tst_change_points_for_question"));
515 $scoretemplate->setVariable("VALUE_INPUT", " value=\"" . assQuestion::_getReachedPoints($active_id, $question_data["qid"], $pass) . "\"");
516 $scoretemplate->setVariable("VALUE_SAVE", $this->lng->txt("save"));
517
518 $template->setVariable("SOLUTION_OUTPUT", $result_output);
519 $maintemplate->setCurrentBlock("printview_question");
520 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
521 $maintemplate->setVariable("QUESTION_SCORING", $scoretemplate->get());
522 $maintemplate->parseCurrentBlock();
523 }
524 $counter++;
525 }
526 }
527 if ($counter == 1) {
528 // no scorable questions found
529 $maintemplate->setVariable("NO_QUESTIONS_FOUND", $this->lng->txt("manscoring_questions_not_found"));
530 }
531 $maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("manscoring_results_pass"), $pass+1));
532
533 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
535
536 return $maintemplate->get();
537 }
static _getReachedPoints($active_id, $question_id, $pass=null)
Returns the points, a learner has reached answering the question.
static _getManualScoring()
Retrieve the manual scoring settings.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static initDomEvent()
Init YUI DomEvent.

References $counter, $pass, $template, ilObjAssessmentFolder\_getManualScoring(), assQuestion\_getReachedPoints(), ilYuiUtil\initDomEvent(), ilUtil\prepareFormOutput(), and sprintf.

+ Here is the call graph for this function:

◆ getPassOverviewTableData()

ilTestServiceGUI::getPassOverviewTableData ( ilTestSession  $testSession,
  $passes,
  $withResults 
)
Parameters
ilTestSession$testSession
$short
Returns
array

Definition at line 155 of file class.ilTestServiceGUI.php.

156 {
157 $data = array();
158
159 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
160 $considerHiddenQuestions = false;
161
162 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
163 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
164 } else {
165 $considerHiddenQuestions = true;
166 }
167
168 $scoredPass = $this->object->_getResultPass($testSession->getActiveId());
169
170 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
172 $testSession->getActiveId()
173 );
174
175 foreach ($passes as $pass) {
176 $row = array();
177
178 $considerOptionalQuestions = true;
179
180 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
181 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($testSession->getActiveId(), $pass);
182
183 $testSequence->loadFromDb();
184 $testSequence->loadQuestions();
185
186 if ($this->object->isRandomTest() && !$testSequence->isAnsweringOptionalQuestionsConfirmed()) {
187 $considerOptionalQuestions = false;
188 }
189
190 $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
191 $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
192
193 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
194 $objectivesList->loadObjectivesTitles();
195
196 $row['objectives'] = $objectivesList->getUniqueObjectivesStringForQuestions($testSequence->getUserSequenceQuestions());
197 }
198
199 if ($withResults) {
200 $result_array = $this->object->getTestResult($testSession->getActiveId(), $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
201
202 foreach ($result_array as $resultStructKEY => $question) {
203 if ($resultStructKEY === 'test' || $resultStructKEY === 'pass') {
204 continue;
205 }
206
207 $requestData = $questionHintRequestRegister->getRequestByTestPassIndexAndQuestionId($pass, $question['qid']);
208
209 if ($requestData instanceof ilAssQuestionHintRequestStatisticData && $result_array[$resultStructKEY]['requested_hints'] === null) {
210 $result_array['pass']['total_requested_hints'] += $requestData->getRequestsCount();
211
212 $result_array[$resultStructKEY]['requested_hints'] = $requestData->getRequestsCount();
213 $result_array[$resultStructKEY]['hint_points'] = $requestData->getRequestsPoints();
214 }
215 }
216
217 if (!$result_array['pass']['total_max_points']) {
218 $percentage = 0;
219 } else {
220 $percentage = ($result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points']) * 100;
221 }
222 $total_max = $result_array['pass']['total_max_points'];
223 $total_reached = $result_array['pass']['total_reached_points'];
224 $total_requested_hints = $result_array['pass']['total_requested_hints'];
225 }
226
227 if ($withResults) {
228 $row['scored'] = ($pass == $scoredPass);
229 }
230
231 $row['pass'] = $pass;
232 $row['date'] = ilObjTest::lookupLastTestPassAccess($testSession->getActiveId(), $pass);
233 if ($withResults) {
234 $row['num_workedthrough_questions'] = $result_array['pass']['num_workedthrough'];
235 $row['num_questions_total'] = $result_array['pass']['num_questions_total'];
236
237 if ($this->object->isOfferingQuestionHintsEnabled()) {
238 $row['hints'] = $total_requested_hints;
239 }
240
241 $row['reached_points'] = $total_reached;
242 $row['max_points'] = $total_max;
243 $row['percentage'] = $percentage;
244 }
245
246 $data[] = $row;
247 }
248
249 return $data;
250 }
static getRequestRequestStatisticDataRegisterByActiveId($activeId)
static getInstance(ilTestSession $a_test_session)
static lookupLastTestPassAccess($activeId, $passIndex)
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)

References $data, $pass, $row, buildQuestionRelatedObjectivesList(), ilTestSession\getActiveId(), ilLOTestQuestionAdapter\getInstance(), getObjectiveOrientedContainer(), ilAssQuestionHintTracking\getRequestRequestStatisticDataRegisterByActiveId(), and ilObjTest\lookupLastTestPassAccess().

Referenced by ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), and ilTestEvaluationGUI\outUserResultsOverview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionResultForTestUsers()

ilTestServiceGUI::getQuestionResultForTestUsers (   $question_id,
  $test_id 
)

Creates a HTML representation for the results of a given question in a test.

Parameters
integer$question_idThe original id of the question
integer$test_idThe test id
Returns
string HTML code of the question results

Definition at line 925 of file class.ilTestServiceGUI.php.

926 {
927 // prepare generation before contents are processed (for mathjax)
928 require_once 'Services/PDFGeneration/classes/class.ilPDFGeneration.php';
930
931 // REQUIRED, since we call this object regardless of the loop
932 $question_gui = $this->object->createQuestionGUI("", $question_id);
933
934 $foundusers = $this->object->getParticipantsForTestAndQuestion($test_id, $question_id);
935 $output = '';
936 foreach ($foundusers as $active_id => $passes) {
937 $resultpass = $this->object->_getResultPass($active_id);
938 for ($i = 0; $i < count($passes); $i++) {
939 if (($resultpass !== null) && ($resultpass == $passes[$i]["pass"])) {
940 if ($output) {
941 $output .= "<br /><br /><br />";
942 }
943
944 // check if re-instantiation is really neccessary
945 $question_gui = $this->object->createQuestionGUI("", $passes[$i]["qid"]);
946 $output .= $this->getResultsHeadUserAndPass($active_id, $resultpass + 1);
947 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
948 $output .= $question_gui->getSolutionOutput(
949 $active_id,
950 $resultpass,
951 $graphicalOutput = false,
952 $result_output = false,
953 $show_question_only = false,
954 $show_feedback = false
955 );
956 }
957 }
958 }
959
960 require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
961 ilTestPDFGenerator::generatePDF($output, ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $question_gui->object->getTitleFilenameCompliant(), PDF_USER_RESULT);
962 }
static prepareGeneration()
Prepare the PDF generation This initializes the purpose for MathJax rendering It has to be called bef...
static generatePDF($pdf_output, $output_mode, $filename=null, $purpose=null)
getResultsHeadUserAndPass($active_id, $pass)
Returns the user and pass data for a test results output.
$i
Definition: disco.tpl.php:19
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output
const PDF_USER_RESULT
PDF Purposes.

References $i, $output, ilTestPDFGenerator\generatePDF(), getResultsHeadUserAndPass(), ilTestPDFGenerator\PDF_OUTPUT_DOWNLOAD, PDF_USER_RESULT, ilPDFGeneration\prepareGeneration(), and assQuestionGUI\RENDER_PURPOSE_PRINT_PDF.

Referenced by ilTestEvaluationGUI\exportQuestionForAllParticipants().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResultsHeadUserAndPass()

ilTestServiceGUI::getResultsHeadUserAndPass (   $active_id,
  $pass 
)

Returns the user and pass data for a test results output.

Parameters
integer$active_idThe active ID of the user
Returns
string HTML code of the user data for the test results @access public

Definition at line 875 of file class.ilTestServiceGUI.php.

876 {
877 $template = new ilTemplate("tpl.il_as_tst_results_head_user_pass.html", true, true, "Modules/Test");
878 include_once './Services/User/classes/class.ilObjUser.php';
879 $user_id = $this->object->_getUserIdFromActiveId($active_id);
880 if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
881 $user = new ilObjUser($user_id);
882 } else {
883 $user = new ilObjUser();
884 $user->setLastname($this->lng->txt("deleted_user"));
885 }
886 $title_matric = "";
887 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == false))) {
888 $template->setCurrentBlock("user_matric");
889 $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
890 $template->parseCurrentBlock();
891 $template->setCurrentBlock("user_matric_value");
892 $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
893 $template->parseCurrentBlock();
894 $template->touchBlock("user_matric_separator");
895 $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
896 }
897
898 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
899 if (strlen($invited_user["clientip"])) {
900 $template->setCurrentBlock("user_clientip");
901 $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
902 $template->parseCurrentBlock();
903 $template->setCurrentBlock("user_clientip_value");
904 $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
905 $template->parseCurrentBlock();
906 $template->touchBlock("user_clientip_separator");
907 $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
908 }
909
910 $template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
911 $uname = $this->object->userLookupFullName($user_id, false);
912 $template->setVariable("VALUE_USR_NAME", $uname);
913 $template->setVariable("TXT_PASS", $this->lng->txt("scored_pass"));
914 $template->setVariable("VALUE_PASS", $pass);
915 return $template->get();
916 }

References $pass, $template, and ilObjUser\_lookupLogin().

Referenced by getQuestionResultForTestUsers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getResultsOfUserOutput()

ilTestServiceGUI::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.

Parameters
ilTestSession | ilTestSessionDynamicQuestionSet$testSession
integer$active_id
integer$pass
boolean$show_pass_details
boolean$show_answers
boolean$show_question_only
boolean$show_reached_points@access public

Definition at line 747 of file class.ilTestServiceGUI.php.

748 {
749 global $ilObjDataCache;
750
751 include_once("./Services/UICore/classes/class.ilTemplate.php");
752 $template = new ilTemplate("tpl.il_as_tst_results_participant.html", true, true, "Modules/Test");
753
754 if ($this->participantData instanceof ilTestParticipantData) {
755 $user_id = $this->participantData->getUserIdByActiveId($active_id);
756 $uname = $this->participantData->getConcatedFullnameByActiveId($active_id, false);
757 } else {
758 $user_id = $this->object->_getUserIdFromActiveId($active_id);
759 $uname = $this->object->userLookupFullName($user_id, true);
760 }
761
762 if (((array_key_exists("pass", $_GET)) && (strlen($_GET["pass"]) > 0)) || (!is_null($pass))) {
763 if (is_null($pass)) {
764 $pass = $_GET["pass"];
765 }
766 }
767
768 if (!is_null($pass)) {
769 require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
770 $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
771
772 $objectivesList = null;
773
774 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
775 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
776 $testSequence->loadFromDb();
777 $testSequence->loadQuestions();
778
779 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
780 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
781
782 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
783 $objectivesList->loadObjectivesTitles();
784
785 $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
786 $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
787 $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
788 $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
789 $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
790 }
791
792 $result_array = $this->object->getTestResult(
793 $active_id,
794 $pass,
795 false,
796 !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
797 );
798
799 $user_id = $this->object->_getUserIdFromActiveId($active_id);
800 $showAllAnswers = true;
801 if ($this->object->isExecutable($testSession, $user_id)) {
802 $showAllAnswers = false;
803 }
804 if ($show_answers) {
805 $list_of_answers = $this->getPassListOfAnswers(
806 $result_array,
807 $active_id,
808 $pass,
809 $_SESSION['tst_results_show_best_solutions'],
810 $showAllAnswers,
811 $show_question_only,
812 $show_reached_points,
813 $show_pass_details,
814 $objectivesList,
815 $testResultHeaderLabelBuilder
816 );
817 $template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
818 }
819
820 if ($show_pass_details) {
821 $overviewTableGUI = $this->getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, "getResultsOfUserOutput", '', $show_answers, $objectivesList);
822 $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
823 $template->setVariable("PASS_DETAILS", $overviewTableGUI->getHTML());
824 }
825
826 $signature = $this->getResultsSignature();
827 $template->setVariable("SIGNATURE", $signature);
828
829 if ($this->object->isShowExamIdInTestResultsEnabled()) {
830 $template->setCurrentBlock('exam_id_footer');
831 $template->setVariable('EXAM_ID_VAL', ilObjTest::lookupExamId(
832 $testSession->getActiveId(),
833 $pass
834 ));
835 $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
836 $template->parseCurrentBlock();
837 }
838 }
839
840 $template->setCurrentBlock('participant_back_anchor');
841 $template->setVariable("HREF_PARTICIPANT_BACK_ANCHOR", "#tst_results_toolbar");
842 $template->setVariable("TXT_PARTICIPANT_BACK_ANCHOR", $this->lng->txt('tst_back_to_top'));
843 $template->parseCurrentBlock();
844
845 $template->setCurrentBlock('participant_block_id');
846 $template->setVariable("PARTICIPANT_BLOCK_ID", "participant_active_{$active_id}");
847 $template->parseCurrentBlock();
848
849 if ($this->isGradingMessageRequired()) {
850 $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
851 $gradingMessageBuilder->buildList();
852
853 $template->setCurrentBlock('grading_message');
854 $template->setVariable('GRADING_MESSAGE', $gradingMessageBuilder->getList());
855 $template->parseCurrentBlock();
856 }
857
858
859 $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, true);
860 $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
861 $template->setVariable("USER_DATA", $user_data);
862
864
865 return $template->get();
866 }
$_SESSION["AccountId"]
static lookupExamId($active_id, $pass)
populatePassFinishDate($tpl, $passFinishDate)
getResultsSignature()
Returns HTML code for a signature field.
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.
getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)

References $_GET, $_SESSION, $pass, $template, buildQuestionRelatedObjectivesList(), getAdditionalUsrDataHtmlAndPopulateWindowTitle(), getGradingMessageBuilder(), ilLOTestQuestionAdapter\getInstance(), getObjectiveOrientedContainer(), getPassDetailsOverviewTableGUI(), getPassListOfAnswers(), getResultsSignature(), isGradingMessageRequired(), ilObjTest\lookupExamId(), ilObjTest\lookupLastTestPassAccess(), populatePassFinishDate(), and sprintf.

+ Here is the call graph for this function:

◆ getResultsSignature()

ilTestServiceGUI::getResultsSignature ( )

Returns HTML code for a signature field.

Returns
string HTML code of the date and signature field for the test results @access public

Definition at line 597 of file class.ilTestServiceGUI.php.

598 {
599 if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
600 $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", true, true, "Modules/Test");
601 $template->setVariable("TXT_DATE", $this->lng->txt("date"));
604 $template->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX)));
606 $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
607 $template->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.png"));
608 return $template->get();
609 } else {
610 return "";
611 }
612 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
static setUseRelativeDates($a_status)
set use relative dates
static useRelativeDates()
check if relative dates are used
Class for single dates.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)

References $template, ilDatePresentation\formatDate(), ilUtil\getImagePath(), IL_CAL_UNIX, ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestPlayerAbstractGUI\showListOfAnswers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleTabs()

ilTestServiceGUI::handleTabs (   $activeTabId)
protected

Definition at line 295 of file class.ilTestServiceGUI.php.

296 {
297 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
298 require_once 'Services/Link/classes/class.ilLink.php';
299 $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
300 $this->tabs->setBack2Target($this->lng->txt('back_to_objective_container'), $courseLink);
301
302 $this->tabs->addTab(
303 'results_pass_oriented',
304 $this->lng->txt('tst_tab_results_pass_oriented'),
305 $this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'outUserResultsOverview')
306 );
307
308 $this->tabs->addTab(
309 'results_objective_oriented',
310 $this->lng->txt('tst_tab_results_objective_oriented'),
311 $this->ctrl->getLinkTargetByClass('ilTestEvalObjectiveOrientedGUI', 'showVirtualPass')
312 );
313
314 $this->tabs->setTabActive($activeTabId);
315 }
316 }

References ilLink\_getLink(), and getObjectiveOrientedContainer().

Referenced by ilTestEvalObjectiveOrientedGUI\executeCommand(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvaluationGUI\outUserResultsOverview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isContextResultPresentation()

ilTestServiceGUI::isContextResultPresentation ( )
Returns
boolean

Definition at line 89 of file class.ilTestServiceGUI.php.

References $contextResultPresentation.

Referenced by getPassListOfAnswers().

+ Here is the caller graph for this function:

◆ isGradingMessageRequired()

ilTestServiceGUI::isGradingMessageRequired ( )
protected

Definition at line 975 of file class.ilTestServiceGUI.php.

976 {
977 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
978 return false;
979 }
980
981 if ($this->object->isShowGradingStatusEnabled()) {
982 return true;
983 }
984
985 if ($this->object->isShowGradingMarkEnabled()) {
986 return true;
987 }
988
989 if ($this->object->areObligationsEnabled()) {
990 return true;
991 }
992
993 return false;
994 }

References getObjectiveOrientedContainer().

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvaluationGUI\outUserResultsOverview().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPdfDeliveryRequest()

ilTestServiceGUI::isPdfDeliveryRequest ( )
protected

◆ outCorrectSolution()

ilTestServiceGUI::outCorrectSolution ( )
protected

Creates an output of the solution of an answer compared to the correct solution.

@access public

Reimplemented in ilTestPlayerAbstractGUI.

Definition at line 1111 of file class.ilTestServiceGUI.php.

1112 {
1113 if (!$this->object->getShowSolutionDetails()) {
1114 ilUtil::sendInfo($this->lng->txt("no_permission"), true);
1115 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1116 }
1117
1118 $testSession = $this->testSessionFactory->getSession();
1119 $activeId = $testSession->getActiveId();
1120
1121 if (!($activeId > 0)) {
1122 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1123 }
1124
1125 $this->ctrl->saveParameter($this, "pass");
1126 $pass = (int) $_GET['pass'];
1127
1128 $questionId = (int) $_GET['evaluation'];
1129
1130 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1131 $testSequence->loadFromDb();
1132 $testSequence->loadQuestions();
1133
1134 if (!$testSequence->questionExists($questionId)) {
1136 }
1137
1138 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1139 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1140 $testSequence->loadFromDb();
1141 $testSequence->loadQuestions();
1142
1143 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
1144 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
1145 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
1146 $objectivesList->loadObjectivesTitles();
1147 } else {
1148 $objectivesList = null;
1149 }
1150
1151 global $ilTabs;
1152
1153 if ($this instanceof ilTestEvalObjectiveOrientedGUI) {
1154 $ilTabs->setBackTarget(
1155 $this->lng->txt("tst_back_to_virtual_pass"),
1156 $this->ctrl->getLinkTarget($this, 'showVirtualPass')
1157 );
1158 } else {
1159 $ilTabs->setBackTarget(
1160 $this->lng->txt("tst_back_to_pass_details"),
1161 $this->ctrl->getLinkTarget($this, 'outUserPassDetails')
1162 );
1163 }
1164
1165 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1166 $this->tpl->setCurrentBlock("ContentStyle");
1167 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
1168 $this->tpl->parseCurrentBlock();
1169
1170 $this->tpl->setCurrentBlock("SyntaxStyle");
1171 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
1172 $this->tpl->parseCurrentBlock();
1173
1174 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1175 if ($this->object->getShowSolutionAnswersOnly()) {
1176 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1177 }
1178
1179 $solution = $this->getCorrectSolutionOutput($questionId, $activeId, $pass, $objectivesList);
1180
1181 $this->tpl->setContent($solution);
1182 }
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true)
get content style path
static accessViolationRedirect()
getCorrectSolutionOutput($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList=null)
Returns an output of the solution to an answer compared to the correct solution.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_GET, $pass, ilObjTestGUI\accessViolationRedirect(), buildQuestionRelatedObjectivesList(), ilObjStyleSheet\getContentStylePath(), getCorrectSolutionOutput(), ilLOTestQuestionAdapter\getInstance(), getObjectiveOrientedContainer(), ilUtil\getStyleSheetLocation(), ilObjStyleSheet\getSyntaxStylePath(), and ilUtil\sendInfo().

Referenced by outCorrectSolutionCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ outCorrectSolutionCmd()

ilTestServiceGUI::outCorrectSolutionCmd ( )
protected

Definition at line 1101 of file class.ilTestServiceGUI.php.

1102 {
1103 $this->outCorrectSolution(); // cannot be named xxxCmd, because it's also called from context without Cmd in names
1104 }
outCorrectSolution()
Creates an output of the solution of an answer compared to the correct solution.

References outCorrectSolution().

+ Here is the call graph for this function:

◆ populateContent()

ilTestServiceGUI::populateContent (   $content)
protected
Parameters
string$content

Definition at line 1072 of file class.ilTestServiceGUI.php.

1073 {
1074 if ($this->isPdfDeliveryRequest()) {
1075 require_once 'Modules/Test/classes/class.ilTestPDFGenerator.php';
1076
1078 $content,
1080 $this->object->getTitleFilenameCompliant(),
1082 );
1083 } else {
1084 $this->tpl->setContent($content);
1085 }
1086 }

References ilTestPDFGenerator\generatePDF(), isPdfDeliveryRequest(), ilTestPDFGenerator\PDF_OUTPUT_DOWNLOAD, and PDF_USER_RESULT.

Referenced by ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populatePassFinishDate()

ilTestServiceGUI::populatePassFinishDate (   $tpl,
  $passFinishDate 
)
Parameters
ilTemplate$tpl
int$passFinishDate

Definition at line 1188 of file class.ilTestServiceGUI.php.

1189 {
1192 $passFinishDate = ilDatePresentation::formatDate(new ilDateTime($passFinishDate, IL_CAL_UNIX));
1194 $tpl->setVariable("PASS_FINISH_DATE_LABEL", $this->lng->txt('tst_pass_finished_on'));
1195 $tpl->setVariable("PASS_FINISH_DATE_VALUE", $passFinishDate);
1196 }
@classDescription Date and time handling

References $tpl, ilDatePresentation\formatDate(), IL_CAL_UNIX, ilDatePresentation\setUseRelativeDates(), and ilDatePresentation\useRelativeDates().

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), and ilTestEvaluationGUI\outUserPassDetails().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContextResultPresentation()

ilTestServiceGUI::setContextResultPresentation (   $contextResultPresentation)
Parameters
boolean$contextResultPresentation

Definition at line 97 of file class.ilTestServiceGUI.php.

98 {
99 $this->contextResultPresentation = $contextResultPresentation;
100 }

References $contextResultPresentation.

Referenced by ilTestEvaluationGUI\outUserListOfAnswerPasses().

+ Here is the caller graph for this function:

◆ setObjectiveOrientedContainer()

ilTestServiceGUI::setObjectiveOrientedContainer ( ilTestObjectiveOrientedContainer  $objectiveOrientedContainer)
Parameters
ilTestObjectiveOrientedContainer$objectiveOrientedContainer

Definition at line 255 of file class.ilTestServiceGUI.php.

256 {
257 $this->objectiveOrientedContainer = $objectiveOrientedContainer;
258 }

References $objectiveOrientedContainer.

◆ setParticipantData()

ilTestServiceGUI::setParticipantData (   $participantData)
Parameters
\ilTestParticipantData$participantData

Definition at line 137 of file class.ilTestServiceGUI.php.

138 {
139 $this->participantData = $participantData;
140 }

References $participantData.

Field Documentation

◆ $contextResultPresentation

ilTestServiceGUI::$contextResultPresentation = true
private

◆ $ctrl

ilTestServiceGUI::$ctrl

Definition at line 44 of file class.ilTestServiceGUI.php.

◆ $db

ilTestServiceGUI::$db
protected

Definition at line 36 of file class.ilTestServiceGUI.php.

◆ $ilias

ilTestServiceGUI::$ilias

◆ $lng

◆ $objCache

ilTestServiceGUI::$objCache
protected

Definition at line 54 of file class.ilTestServiceGUI.php.

◆ $object

ilTestServiceGUI::$object = null

Definition at line 26 of file class.ilTestServiceGUI.php.

◆ $objectiveOrientedContainer

ilTestServiceGUI::$objectiveOrientedContainer
private

◆ $participantData

ilTestServiceGUI::$participantData
protected

◆ $ref_id

ilTestServiceGUI::$ref_id

Definition at line 58 of file class.ilTestServiceGUI.php.

◆ $service

ilTestServiceGUI::$service = null

Definition at line 31 of file class.ilTestServiceGUI.php.

◆ $tabs

ilTestServiceGUI::$tabs
protected

Definition at line 49 of file class.ilTestServiceGUI.php.

◆ $testSequenceFactory

ilTestServiceGUI::$testSequenceFactory = null
protected

◆ $testSessionFactory

ilTestServiceGUI::$testSessionFactory = null
protected

◆ $tpl

◆ $tree


The documentation for this class was generated from the following file: