ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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)
 
 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)
 
 populateExamId (ilTemplate $tpl, int $activeId, int $pass)
 

Data Fields

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

Protected Member Functions

 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 $DIC;
111 $lng = $DIC['lng'];
112 $tpl = $DIC['tpl'];
113 $ilCtrl = $DIC['ilCtrl'];
114 $ilias = $DIC['ilias'];
115 $tree = $DIC['tree'];
116 $ilDB = $DIC['ilDB'];
117 $ilPluginAdmin = $DIC['ilPluginAdmin'];
118 $ilTabs = $DIC['ilTabs'];
119 $ilObjDataCache = $DIC['ilObjDataCache'];
120
121 $lng->loadLanguageModule('cert');
122
123 $this->db = $ilDB;
124 $this->lng = &$lng;
125 $this->tpl = &$tpl;
126 $this->ctrl = &$ilCtrl;
127 $this->tabs = $ilTabs;
128 $this->objCache = $ilObjDataCache;
129 $this->ilias = &$ilias;
130 $this->object = &$a_object;
131 $this->tree = &$tree;
132 $this->ref_id = $a_object->ref_id;
133
134 $this->service = new ilTestService($a_object);
135
136 require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
137 $this->testSessionFactory = new ilTestSessionFactory($this->object);
138
139 require_once 'Modules/Test/classes/class.ilTestSequenceFactory.php';
140 $this->testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $ilPluginAdmin, $this->object);
141
142 $this->objectiveOrientedContainer = null;
143 }
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 $DIC
Definition: saml.php:7
global $ilDB

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

Member Function Documentation

◆ buildPassDetailsOverviewTableGUI()

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

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

980 {
981 if (!isset($targetGUI->object) && method_exists($targetGUI, 'getTestObj')) {
982 $targetGUI->object = $targetGUI->getTestObj();
983 }
984
985 require_once 'Modules/Test/classes/tables/class.ilTestPassDetailsOverviewTableGUI.php';
986 $tableGUI = new ilTestPassDetailsOverviewTableGUI($this->ctrl, $targetGUI, $targetCMD);
987 $tableGUI->setIsPdfGenerationRequest($this->isPdfDeliveryRequest());
988 return $tableGUI;
989 }

References isPdfDeliveryRequest().

Referenced by ilTestEvaluationGUI\getFilteredTestResult(), getFilteredTestResult(), getPassDetailsOverviewTableGUI(), ilTestEvaluationGUI\outParticipantsPassDetailsResetTableFilter(), ilTestEvaluationGUI\outParticipantsPassDetailsSetTableFilter(), ilTestEvaluationGUI\outUserPassDetailsResetTableFilter(), ilTestEvaluationGUI\outUserPassDetailsSetTableFilter(), ilTestEvalObjectiveOrientedGUI\showVirtualPassResetTableFilterCmd(), and ilTestEvalObjectiveOrientedGUI\showVirtualPassSetTableFilterCmd().

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

◆ buildPassOverviewTableGUI()

ilTestServiceGUI::buildPassOverviewTableGUI (   $targetGUI)
Returns
ilTestPassOverviewTableGUI $tableGUI

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

326 {
327 require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
328
329 $table = new ilTestPassOverviewTableGUI($targetGUI, '');
330
331 $table->setPdfPresentationEnabled(
332 isset($_GET['pdf']) && $_GET['pdf'] == 1
333 );
334
335 $table->setObjectiveOrientedPresentationEnabled(
336 $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
337 );
338
339 return $table;
340 }
$_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 1026 of file class.ilTestServiceGUI.php.

1027 {
1028 require_once 'Modules/Test/classes/class.ilTestQuestionRelatedObjectivesList.php';
1029 $questionRelatedObjectivesList = new ilTestQuestionRelatedObjectivesList();
1030
1031 $objectivesAdapter->buildQuestionRelatedObjectiveList($testSequence, $questionRelatedObjectivesList);
1032
1033 return $questionRelatedObjectivesList;
1034 }
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 1109 of file class.ilTestServiceGUI.php.

1110 {
1111 require_once 'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php';
1112 $toolbar = new ilTestResultsToolbarGUI($this->ctrl, $this->tpl, $this->lng);
1113
1114 return $toolbar;
1115 }

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 282 of file class.ilTestServiceGUI.php.

283 {
284 $cmd = $this->ctrl->getCmd();
285 $next_class = $this->ctrl->getNextClass($this);
286
287 $cmd = $this->getCommand($cmd);
288 switch ($next_class) {
289 default:
290 $ret = &$this->$cmd();
291 break;
292 }
293 return $ret;
294 }
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 625 of file class.ilTestServiceGUI.php.

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

References $t, $template, $user, 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 301 of file class.ilTestServiceGUI.php.

302 {
303 return $cmd;
304 }

Referenced by ilTestEvaluationGUI\executeCommand(), ilTestOutputGUI\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 689 of file class.ilTestServiceGUI.php.

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

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

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 1036 of file class.ilTestServiceGUI.php.

1037 {
1038 global $DIC;
1039 $ilDB = $DIC['ilDB'];
1040 $ilPluginAdmin = $DIC['ilPluginAdmin'];
1041
1042 $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
1043 $table_gui->initFilter();
1044
1045 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
1046 $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
1047
1048 $questionList->setParentObjIdsFilter(array($this->object->getId()));
1049 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
1050
1051 foreach ($table_gui->getFilterItems() as $item) {
1052 if (substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_') {
1053 $v = $item->getValue();
1054
1055 if (is_array($v) && count($v) && !(int) $v[0]) {
1056 continue;
1057 }
1058
1059 $taxId = substr($item->getPostVar(), strlen('tax_'));
1060 $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst');
1061 } elseif ($item->getValue() !== false) {
1062 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1063 }
1064 }
1065
1066 $questionList->load();
1067
1068 $filteredTestResult = array();
1069
1070 $resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
1071
1072 foreach ($resultData as $resultItemKey => $resultItemValue) {
1073 if ($resultItemKey === 'test' || $resultItemKey === 'pass') {
1074 continue;
1075 }
1076
1077 if (!$questionList->isInList($resultItemValue['qid'])) {
1078 continue;
1079 }
1080
1081 $filteredTestResult[] = $resultItemValue;
1082 }
1083
1084 return $filteredTestResult;
1085 }
buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD)

References $DIC, $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 1016 of file class.ilTestServiceGUI.php.

1017 {
1018 require_once 'Modules/Test/classes/class.ilTestGradingMessageBuilder.php';
1019 $gradingMessageBuilder = new ilTestGradingMessageBuilder($this->lng, $this->object);
1020
1021 $gradingMessageBuilder->setActiveId($activeId);
1022
1023 return $gradingMessageBuilder;
1024 }

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 156 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 541 of file class.ilTestServiceGUI.php.

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

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

References $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 466 of file class.ilTestServiceGUI.php.

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

+ Here is the call graph for this function:

◆ getPassOverviewTableData()

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

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

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

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 934 of file class.ilTestServiceGUI.php.

935 {
936 // prepare generation before contents are processed (for mathjax)
938
939 // REQUIRED, since we call this object regardless of the loop
940 $question_gui = $this->object->createQuestionGUI("", $question_id);
941
942 $this->object->setAccessFilteredParticipantList(
943 $this->object->buildStatisticsAccessFilteredParticipantList()
944 );
945
946 $foundusers = $this->object->getParticipantsForTestAndQuestion($test_id, $question_id);
947 $output = '';
948 foreach ($foundusers as $active_id => $passes) {
949 $resultpass = $this->object->_getResultPass($active_id);
950 for ($i = 0; $i < count($passes); $i++) {
951 if (($resultpass !== null) && ($resultpass == $passes[$i]["pass"])) {
952 if ($output) {
953 $output .= "<br /><br /><br />";
954 }
955
956 // check if re-instantiation is really neccessary
957 $question_gui = $this->object->createQuestionGUI("", $passes[$i]["qid"]);
958 $output .= $this->getResultsHeadUserAndPass($active_id, $resultpass + 1);
959 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
960 $output .= $question_gui->getSolutionOutput(
961 $active_id,
962 $resultpass,
963 $graphicalOutput = false,
964 $result_output = false,
965 $show_question_only = false,
966 $show_feedback = false
967 );
968 }
969 }
970 }
971
972 require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
973 ilTestPDFGenerator::generatePDF($output, ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $question_gui->object->getTitleFilenameCompliant(), PDF_USER_RESULT);
974 }
static prepareGenerationRequest($service, $purpose)
Prepare the content processing for a PDF generation request This function should be called as in a re...
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
const PDF_USER_RESULT
PDF Purposes.

References $i, Sabre\VObject\$output, ilTestPDFGenerator\generatePDF(), getResultsHeadUserAndPass(), ilTestPDFGenerator\PDF_OUTPUT_DOWNLOAD, PDF_USER_RESULT, ilPDFGeneratorUtils\prepareGenerationRequest(), 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 884 of file class.ilTestServiceGUI.php.

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

References $pass, $template, $user, 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 754 of file class.ilTestServiceGUI.php.

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

+ 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 599 of file class.ilTestServiceGUI.php.

600 {
601 if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity()) {
602 $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", true, true, "Modules/Test");
603 $template->setVariable("TXT_DATE", $this->lng->txt("date"));
606 $template->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX)));
608 $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
609 $template->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.png"));
610 return $template->get();
611 } else {
612 return "";
613 }
614 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=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:

◆ 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 991 of file class.ilTestServiceGUI.php.

992 {
993 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
994 return false;
995 }
996
997 if ($this->object->isShowGradingStatusEnabled()) {
998 return true;
999 }
1000
1001 if ($this->object->isShowGradingMarkEnabled()) {
1002 return true;
1003 }
1004
1005 if ($this->object->areObligationsEnabled()) {
1006 return true;
1007 }
1008
1009 return false;
1010 }

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 1127 of file class.ilTestServiceGUI.php.

1128 {
1129 if (!$this->object->getShowSolutionDetails()) {
1130 ilUtil::sendInfo($this->lng->txt("no_permission"), true);
1131 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1132 }
1133
1134 $testSession = $this->testSessionFactory->getSession();
1135 $activeId = $testSession->getActiveId();
1136
1137 if (!($activeId > 0)) {
1138 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1139 }
1140
1141 $this->ctrl->saveParameter($this, "pass");
1142 $pass = (int) $_GET['pass'];
1143
1144 $questionId = (int) $_GET['evaluation'];
1145
1146 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1147 $testSequence->loadFromDb();
1148 $testSequence->loadQuestions();
1149
1150 if (!$testSequence->questionExists($questionId)) {
1152 }
1153
1154 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
1155 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1156 $testSequence->loadFromDb();
1157 $testSequence->loadQuestions();
1158
1159 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
1160 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
1161 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
1162 $objectivesList->loadObjectivesTitles();
1163 } else {
1164 $objectivesList = null;
1165 }
1166
1167 global $DIC;
1168 $ilTabs = $DIC['ilTabs'];
1169
1170 if ($this instanceof ilTestEvalObjectiveOrientedGUI) {
1171 $ilTabs->setBackTarget(
1172 $this->lng->txt("tst_back_to_virtual_pass"),
1173 $this->ctrl->getLinkTarget($this, 'showVirtualPass')
1174 );
1175 } else {
1176 $ilTabs->setBackTarget(
1177 $this->lng->txt("tst_back_to_pass_details"),
1178 $this->ctrl->getLinkTarget($this, 'outUserPassDetails')
1179 );
1180 }
1181 $ilTabs->clearSubTabs();
1182
1183 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1184 $this->tpl->setCurrentBlock("ContentStyle");
1185 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
1186 $this->tpl->parseCurrentBlock();
1187
1188 $this->tpl->setCurrentBlock("SyntaxStyle");
1189 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
1190 $this->tpl->parseCurrentBlock();
1191
1192 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1193 if ($this->object->getShowSolutionAnswersOnly()) {
1194 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1195 }
1196
1197 $solution = $this->getCorrectSolutionOutput($questionId, $activeId, $pass, $objectivesList);
1198
1199 $this->tpl->setContent($solution);
1200 }
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, $DIC, $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 1117 of file class.ilTestServiceGUI.php.

1118 {
1119 $this->outCorrectSolution(); // cannot be named xxxCmd, because it's also called from context without Cmd in names
1120 }
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 1090 of file class.ilTestServiceGUI.php.

1091 {
1092 if ($this->isPdfDeliveryRequest()) {
1093 require_once 'Modules/Test/classes/class.ilTestPDFGenerator.php';
1094
1096 $content,
1098 $this->object->getTitleFilenameCompliant(),
1100 );
1101 } else {
1102 $this->tpl->setContent($content);
1103 }
1104 }

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:

◆ populateExamId()

ilTestServiceGUI::populateExamId ( ilTemplate  $tpl,
int  $activeId,
int  $pass 
)
Parameters
ilTemplate$tpl
int$activeId
int$pass

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

1222 {
1223 if ($this->object->isShowExamIdInTestResultsEnabled()) {
1224 $tpl->setVariable("EXAM_ID_TXT", $this->lng->txt('exam_id'));
1225 $tpl->setVariable('EXAM_ID', ilObjTest::lookupExamId(
1226 $activeId,
1227 $pass
1228 ));
1229 }
1230 }

References $pass, $tpl, and ilObjTest\lookupExamId().

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

+ 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 1206 of file class.ilTestServiceGUI.php.

1207 {
1210 $passFinishDate = ilDatePresentation::formatDate(new ilDateTime($passFinishDate, IL_CAL_UNIX));
1212 $tpl->setVariable("PASS_FINISH_DATE_LABEL", $this->lng->txt('tst_pass_finished_on'));
1213 $tpl->setVariable("PASS_FINISH_DATE_VALUE", $passFinishDate);
1214 }
@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 266 of file class.ilTestServiceGUI.php.

267 {
268 $this->objectiveOrientedContainer = $objectiveOrientedContainer;
269 }

References $objectiveOrientedContainer.

◆ setParticipantData()

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

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

149 {
150 $this->participantData = $participantData;
151 }

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

◆ $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: