ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
Returns
ilTestPassDetailsOverviewTableGUI

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

1035 {
1036 require_once 'Modules/Test/classes/tables/class.ilTestPassDetailsOverviewTableGUI.php';
1037 $tableGUI = new ilTestPassDetailsOverviewTableGUI($this->ctrl, $targetGUI, $targetCMD);
1038 $tableGUI->setIsPdfGenerationRequest($this->isPdfDeliveryRequest());
1039 return $tableGUI;
1040 }

References isPdfDeliveryRequest().

Referenced by ilTestEvaluationGUI\getFilteredTestResult(), getFilteredTestResult(), getPassDetailsOverviewTableGUI(), 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,
  $targetCmd = '' 
)
Returns
ilTestPassOverviewTableGUI $tableGUI

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

355 {
356 require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
357
358 $table = new ilTestPassOverviewTableGUI($targetGUI, $targetCmd);
359
360 $table->setPdfPresentationEnabled(
361 isset($_GET['pdf']) && $_GET['pdf'] == 1
362 );
363
364 $table->setObjectiveOrientedPresentationEnabled(
365 $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
366 );
367
368 return $table;
369 }
$_GET["client_id"]
Class ilTestPassOverviewTableGUI.

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

1082 {
1083 require_once 'Modules/Test/classes/class.ilTestQuestionRelatedObjectivesList.php';
1084 $questionRelatedObjectivesList = new ilTestQuestionRelatedObjectivesList();
1085
1086 $objectivesAdapter->buildQuestionRelatedObjectiveList($testSequence, $questionRelatedObjectivesList);
1087
1088 return $questionRelatedObjectivesList;
1089 }
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 1170 of file class.ilTestServiceGUI.php.

1171 {
1172 require_once 'Modules/Test/classes/toolbars/class.ilTestResultsToolbarGUI.php';
1173 $toolbar = new ilTestResultsToolbarGUI($this->ctrl, $this->tpl, $this->lng);
1174
1175 $toolbar->setSkillResultButtonEnabled($this->object->isSkillServiceToBeConsidered());
1176
1177 return $toolbar;
1178 }

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

287 {
288 $cmd = $this->ctrl->getCmd();
289 $next_class = $this->ctrl->getNextClass($this);
290
291 $cmd = $this->getCommand($cmd);
292 switch($next_class)
293 {
294 default:
295 $ret =& $this->$cmd();
296 break;
297 }
298 return $ret;
299 }
getCommand($cmd)
Retrieves the ilCtrl command.
$ret
Definition: parser.php:6
$cmd
Definition: sahs_server.php:35

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

671 {
672 if(!is_object($testSession)) throw new TestException();
673 $template = new ilTemplate("tpl.il_as_tst_results_userdata.html", TRUE, TRUE, "Modules/Test");
674 include_once './Services/User/classes/class.ilObjUser.php';
675 $user_id = $this->object->_getUserIdFromActiveId($active_id);
676 if (strlen(ilObjUser::_lookupLogin($user_id)) > 0)
677 {
678 $user = new ilObjUser($user_id);
679 }
680 else
681 {
682 $user = new ilObjUser();
683 $user->setLastname($this->lng->txt("deleted_user"));
684 }
685 $t = $testSession->getSubmittedTimestamp();
686 if (!$t)
687 {
688 $t = $this->object->_getLastAccess($testSession->getActiveId());
689 }
690
691 if( $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired() )
692 {
693 $uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
694 $template->setCurrentBlock("name");
695 $template->setVariable('TXT_USR_NAME', $this->lng->txt("name"));
696 $template->setVariable('VALUE_USR_NAME', $uname);
697 $template->parseCurrentBlock();
698 }
699
700 $title_matric = "";
701 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE) || ($overwrite_anonymity)))
702 {
703 $template->setCurrentBlock("matriculation");
704 $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
705 $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
706 $template->parseCurrentBlock();
707 $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
708 }
709
710 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
711 if (strlen($invited_user["clientip"]))
712 {
713 $template->setCurrentBlock("client_ip");
714 $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
715 $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
716 $template->parseCurrentBlock();
717 $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
718 }
719
720 $template->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
721 $template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
722
723 // change the pagetitle (tab title or title in title bar of window)
724 $pagetitle = $this->object->getTitle() . $title_matric . $title_client;
725 $this->tpl->setHeaderPageTitle($pagetitle);
726
727 return $template->get();
728 }
static _lookupLogin($a_user_id)
lookup login
special template class to simplify handling of ITX/PEAR

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

307 {
308 return $cmd;
309 }

References $cmd.

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

740 {
741 global $ilUser;
742
743 $test_id = $this->object->getTestId();
744 $question_gui = $this->object->createQuestionGUI("", $question_id);
745
746 if( $this->isPdfDeliveryRequest() )
747 {
748 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
749 }
750
751 $template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE, "Modules/Test");
752 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
753 $result_output = $question_gui->getSolutionOutput($active_id, $pass, TRUE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, FALSE, TRUE);
754 $best_output = $question_gui->getSolutionOutput($active_id, $pass, FALSE, FALSE, $show_question_only, FALSE, TRUE, FALSE, FALSE);
755 if( $this->object->getShowSolutionFeedback() && $_GET['cmd'] != 'outCorrectSolution' )
756 {
757 $specificAnswerFeedback = $question_gui->getSpecificFeedbackOutput($active_id, $pass);
758 if( strlen($specificAnswerFeedback) )
759 {
760 $template->setCurrentBlock("outline_specific_feedback");
761 $template->setVariable("OUTLINE_SPECIFIC_FEEDBACK", $specificAnswerFeedback);
762 $template->parseCurrentBlock();
763 }
764 }
765 if ($this->object->isBestSolutionPrintedWithResult() && strlen($best_output))
766 {
767 $template->setCurrentBlock("best_solution");
768 $template->setVariable("TEXT_BEST_SOLUTION", $this->lng->txt("tst_best_solution_is"));
769 $template->setVariable("BEST_OUTPUT", $best_output);
770 $template->parseCurrentBlock();
771 }
772 $template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
773 $maxpoints = $question_gui->object->getMaximumPoints();
774 if ($maxpoints == 1)
775 {
776 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
777 }
778 else
779 {
780 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
781 }
782 if( $objectivesList !== null )
783 {
784 $objectives = $this->lng->txt('tst_res_lo_objectives_header').': ';
785 $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
786 $template->setVariable('OBJECTIVES', $objectives);
787 }
788 $template->setVariable("SOLUTION_OUTPUT", $result_output);
789 $template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
790 $template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
791 $template->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back"));
792 return $template->get();
793 }
sprintf('%.4f', $callTime)
$ilUser
Definition: imgupload.php:18

References $_GET, $ilUser, $pass, 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 1091 of file class.ilTestServiceGUI.php.

1092 {
1093 global $ilDB, $ilPluginAdmin;
1094
1095 $table_gui = $this->buildPassDetailsOverviewTableGUI($this, 'outUserPassDetails');
1096 $table_gui->initFilter();
1097
1098 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
1099 $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
1100
1101 $questionList->setParentObjIdsFilter(array($this->object->getId()));
1102 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
1103
1104 foreach ($table_gui->getFilterItems() as $item)
1105 {
1106 if( substr($item->getPostVar(), 0, strlen('tax_')) == 'tax_' )
1107 {
1108 $v = $item->getValue();
1109
1110 if( is_array($v) && count($v) && !(int)$v[0] )
1111 {
1112 continue;
1113 }
1114
1115 $taxId = substr($item->getPostVar(), strlen('tax_'));
1116 $questionList->addTaxonomyFilter($taxId, $item->getValue(), $this->object->getId(), 'tst');
1117 }
1118 elseif( $item->getValue() !== false )
1119 {
1120 $questionList->addFieldFilter($item->getPostVar(), $item->getValue());
1121 }
1122 }
1123
1124 $questionList->load();
1125
1126 $filteredTestResult = array();
1127
1128 $resultData = $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
1129
1130 foreach($resultData as $resultItemKey => $resultItemValue)
1131 {
1132 if($resultItemKey === 'test' || $resultItemKey === 'pass')
1133 {
1134 continue;
1135 }
1136
1137 if( !$questionList->isInList($resultItemValue['qid']) )
1138 {
1139 continue;
1140 }
1141
1142 $filteredTestResult[] = $resultItemValue;
1143 }
1144
1145 return $filteredTestResult;
1146 }
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 1071 of file class.ilTestServiceGUI.php.

1072 {
1073 require_once 'Modules/Test/classes/class.ilTestGradingMessageBuilder.php';
1074 $gradingMessageBuilder = new ilTestGradingMessageBuilder($this->lng, $this->object);
1075
1076 $gradingMessageBuilder->setActiveId($activeId);
1077
1078 return $gradingMessageBuilder;
1079 }

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

582 {
583 $this->ctrl->setParameter($targetGUI, 'active_id', $active_id);
584 $this->ctrl->setParameter($targetGUI, 'pass', $pass);
585
586 $tableGUI = $this->buildPassDetailsOverviewTableGUI($targetGUI, $targetCMD);
587
588 $tableGUI->setAnswerListAnchorEnabled($questionAnchorNav);
589 $tableGUI->setSingleAnswerScreenCmd($questionDetailsCMD);
590 $tableGUI->setShowHintCount($this->object->isOfferingQuestionHintsEnabled());
591
592 if( $objectivesList !== null )
593 {
594 $tableGUI->setQuestionRelatedObjectivesList($objectivesList);
595 $tableGUI->setObjectiveOrientedPresentationEnabled(true);
596 }
597
598 $tableGUI->setMultipleObjectivesInvolved($multipleObjectivesInvolved);
599
600 $tableGUI->setActiveId($active_id);
601 $tableGUI->setShowSuggestedSolution(false);
602
603 $usersQuestionSolutions = array();
604
605 foreach($result_array as $key => $val)
606 {
607 if($key === 'test' || $key === 'pass')
608 {
609 continue;
610 }
611
612 if( $this->object->getShowSolutionSuggested() && strlen($val['solution']) )
613 {
614 $tableGUI->setShowSuggestedSolution(true);
615 }
616
617 if( isset($val['pass']) )
618 {
619 $tableGUI->setPassColumnEnabled(true);
620 }
621
622 $usersQuestionSolutions[$key] = $val;
623 }
624
625 $tableGUI->initColumns()->initFilter();
626
627 $tableGUI->setFilterCommand($targetCMD.'SetTableFilter');
628 $tableGUI->setResetCommand($targetCMD.'ResetTableFilter');
629
630 $tableGUI->setData($usersQuestionSolutions);
631
632 return $tableGUI;
633 }

References $pass, and buildPassDetailsOverviewTableGUI().

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

382 {
383 $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", TRUE, TRUE, "Modules/Test");
384
385 $counter = 1;
386 // output of questions with solutions
387 foreach ($result_array as $question_data)
388 {
389 if (($question_data["workedthrough"] == 1) || ($only_answered_questions == FALSE))
390 {
391 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", TRUE, TRUE, "Modules/TestQuestionPool");
392 $question = $question_data["qid"];
393 if (is_numeric($question))
394 {
395 $maintemplate->setCurrentBlock("printview_question");
396 $question_gui = $this->object->createQuestionGUI("", $question);
397 if (is_object($question_gui))
398 {
399 if( $this->isPdfDeliveryRequest() )
400 {
401 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
402 }
403
404 if($anchorNav)
405 {
406 $template->setCurrentBlock('block_id');
407 $template->setVariable('BLOCK_ID', "detailed_answer_block_act_{$active_id}_qst_{$question}");
408 $template->parseCurrentBlock();
409
410 $template->setCurrentBlock('back_anchor');
411 $template->setVariable('HREF_BACK_ANCHOR', "#pass_details_tbl_row_act_{$active_id}_qst_{$question}");
412 $template->setVariable('TXT_BACK_ANCHOR', $this->lng->txt('tst_back_to_question_list'));
413 $template->parseCurrentBlock();
414 }
415
416 if ($show_reached_points)
417 {
418 $template->setCurrentBlock("result_points");
419 $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());
420 $template->parseCurrentBlock();
421 }
422 $template->setVariable("COUNTER_QUESTION", $counter.". ");
423 $template->setVariable("TXT_QUESTION_ID", $this->lng->txt('question_id_short'));
424 $template->setVariable("QUESTION_ID", $question_gui->object->getId());
425 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
426
427 if( $objectivesList !== null )
428 {
429 $objectives = $this->lng->txt('tst_res_lo_objectives_header').': ';
430 $objectives .= $objectivesList->getQuestionRelatedObjectiveTitles($question_gui->object->getId());
431 $template->setVariable("OBJECTIVES", $objectives);
432 }
433
434 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
435
436 $showFeedback = $this->isContextResultPresentation() && $this->object->getShowSolutionFeedback();
437 $show_solutions = $this->isContextResultPresentation() && $show_solutions;
438
439 if($show_solutions)
440 {
441 $compare_template = new ilTemplate('tpl.il_as_tst_answers_compare.html', TRUE, TRUE, 'Modules/Test');
442 $compare_template->setVariable("HEADER_PARTICIPANT", $this->lng->txt('tst_header_participant'));
443 $compare_template->setVariable("HEADER_SOLUTION", $this->lng->txt('tst_header_solution'));
444 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, FALSE, $show_question_only, $showFeedback);
445 $best_output = $question_gui->getSolutionOutput($active_id, $pass, FALSE, FALSE, $show_question_only, FALSE, TRUE);
446
447 $compare_template->setVariable('PARTICIPANT', $result_output);
448 $compare_template->setVariable('SOLUTION', $best_output);
449 $template->setVariable('SOLUTION_OUTPUT', $compare_template->get());
450 }
451 else
452 {
453 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, FALSE, $show_question_only, $showFeedback);
454 $template->setVariable('SOLUTION_OUTPUT', $result_output);
455 }
456
457 $maintemplate->setCurrentBlock("printview_question");
458 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
459 $maintemplate->parseCurrentBlock();
460 $counter ++;
461 }
462 }
463 }
464 }
465
466 if($testResultHeaderLabelBuilder !== null)
467 {
468 if($pass !== null)
469 {
470 $headerText = $testResultHeaderLabelBuilder->getListOfAnswersHeaderLabel($pass + 1);
471 }
472 else
473 {
474 $headerText = $testResultHeaderLabelBuilder->getVirtualListOfAnswersHeaderLabel();
475 }
476 }
477 else
478 {
479 $headerText = '';
480 }
481
482 $maintemplate->setVariable("RESULTS_OVERVIEW", $headerText);
483 return $maintemplate->get();
484 }
$counter

References $counter, $pass, 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 498 of file class.ilTestServiceGUI.php.

499 {
500 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
501
502 $maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", TRUE, TRUE, "Modules/Test");
503
504 include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
506
507 $counter = 1;
508 // output of questions with solutions
509 foreach ($result_array as $question_data)
510 {
511 $question = $question_data["qid"];
512 if (is_numeric($question))
513 {
514 $question_gui = $this->object->createQuestionGUI("", $question);
515 if (in_array($question_gui->object->getQuestionTypeID(), $scoring))
516 {
517 $template = new ilTemplate("tpl.il_as_qpl_question_printview.html", TRUE, TRUE, "Modules/TestQuestionPool");
518 $scoretemplate = new ilTemplate("tpl.il_as_tst_manual_scoring_points.html", TRUE, TRUE, "Modules/Test");
519 #mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
520 $template->setVariable("COUNTER_QUESTION", $counter.". ");
521 $template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
522 $points = $question_gui->object->getMaximumPoints();
523 if ($points == 1)
524 {
525 $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("point"));
526 }
527 else
528 {
529 $template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("points"));
530 }
531
532 $show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
533 $result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, TRUE);
534
535 $solout = $question_gui->object->getSuggestedSolutionOutput();
536 if (strlen($solout))
537 {
538 $scoretemplate->setCurrentBlock("suggested_solution");
539 $scoretemplate->setVariable("TEXT_SUGGESTED_SOLUTION", $this->lng->txt("solution_hint"));
540 $scoretemplate->setVariable("VALUE_SUGGESTED_SOLUTION", $solout);
541 $scoretemplate->parseCurrentBlock();
542 }
543
544 $scoretemplate->setCurrentBlock("feedback");
545 $scoretemplate->setVariable("FEEDBACK_NAME_INPUT", $question);
546 $feedback = $this->object->getManualFeedback($active_id, $question, $pass);
547 $scoretemplate->setVariable("VALUE_FEEDBACK", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, TRUE)));
548 $scoretemplate->setVariable("TEXT_MANUAL_FEEDBACK", $this->lng->txt("set_manual_feedback"));
549 $scoretemplate->parseCurrentBlock();
550
551 $scoretemplate->setVariable("NAME_INPUT", $question);
552 $this->ctrl->setParameter($this, "active_id", $active_id);
553 $this->ctrl->setParameter($this, "pass", $pass);
554 $scoretemplate->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "manscoring"));
555 $scoretemplate->setVariable("LABEL_INPUT", $this->lng->txt("tst_change_points_for_question"));
556 $scoretemplate->setVariable("VALUE_INPUT", " value=\"" . assQuestion::_getReachedPoints($active_id, $question_data["qid"], $pass) . "\"");
557 $scoretemplate->setVariable("VALUE_SAVE", $this->lng->txt("save"));
558
559 $template->setVariable("SOLUTION_OUTPUT", $result_output);
560 $maintemplate->setCurrentBlock("printview_question");
561 $maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
562 $maintemplate->setVariable("QUESTION_SCORING", $scoretemplate->get());
563 $maintemplate->parseCurrentBlock();
564 }
565 $counter ++;
566 }
567 }
568 if ($counter == 1)
569 {
570 // no scorable questions found
571 $maintemplate->setVariable("NO_QUESTIONS_FOUND", $this->lng->txt("manscoring_questions_not_found"));
572 }
573 $maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("manscoring_results_pass"), $pass+1));
574
575 include_once "./Services/YUI/classes/class.ilYuiUtil.php";
577
578 return $maintemplate->get();
579 }
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, 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 {
161 $considerHiddenQuestions = false;
162
163 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
164 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
165 }
166 else
167 {
168 $considerHiddenQuestions = true;
169 }
170
171 $scoredPass = $this->object->_getResultPass($testSession->getActiveId());
172
173 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
175 $testSession->getActiveId()
176 );
177
178 foreach($passes as $pass)
179 {
180 $row = array();
181
182 $considerOptionalQuestions = true;
183
184 if($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired())
185 {
186 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($testSession->getActiveId(), $pass);
187
188 $testSequence->loadFromDb();
189 $testSequence->loadQuestions();
190
191 if($this->object->isRandomTest() && !$testSequence->isAnsweringOptionalQuestionsConfirmed())
192 {
193 $considerOptionalQuestions = false;
194 }
195
196 $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
197 $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
198
199 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
200 $objectivesList->loadObjectivesTitles();
201
202 $row['objectives'] = $objectivesList->getUniqueObjectivesStringForQuestions($testSequence->getUserSequenceQuestions());
203 }
204
205 if($withResults)
206 {
207 $result_array = $this->object->getTestResult($testSession->getActiveId(), $pass, false, $considerHiddenQuestions, $considerOptionalQuestions);
208
209 foreach($result_array as $resultStructKEY => $question)
210 {
211 if( $resultStructKEY === 'test' || $resultStructKEY === 'pass' )
212 {
213 continue;
214 }
215
216 $requestData = $questionHintRequestRegister->getRequestByTestPassIndexAndQuestionId($pass, $question['qid']);
217
218 if( $requestData instanceof ilAssQuestionHintRequestStatisticData && $result_array[$resultStructKEY]['requested_hints'] === null )
219 {
220 $result_array['pass']['total_requested_hints'] += $requestData->getRequestsCount();
221
222 $result_array[$resultStructKEY]['requested_hints'] = $requestData->getRequestsCount();
223 $result_array[$resultStructKEY]['hint_points'] = $requestData->getRequestsPoints();
224 }
225 }
226
227 if(!$result_array['pass']['total_max_points'])
228 {
229 $percentage = 0;
230 } else
231 {
232 $percentage = ($result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points']) * 100;
233 }
234 $total_max = $result_array['pass']['total_max_points'];
235 $total_reached = $result_array['pass']['total_reached_points'];
236 $total_requested_hints = $result_array['pass']['total_requested_hints'];
237 }
238
239 if($withResults)
240 {
241 $row['scored'] = ($pass == $scoredPass);
242 }
243
244 $row['pass'] = $pass;
245 $row['date'] = $this->object->getPassFinishDate($testSession->getActiveId(), $pass);
246 if($withResults)
247 {
248 $row['num_workedthrough_questions'] = $result_array['pass']['num_workedthrough'];
249 $row['num_questions_total'] = $result_array['pass']['num_questions_total'];
250
251 if($this->object->isOfferingQuestionHintsEnabled())
252 {
253 $row['hints'] = $total_requested_hints;
254 }
255
256 $row['reached_points'] = $total_reached;
257 $row['max_points'] = $total_max;
258 $row['percentage'] = $percentage;
259 }
260
261 $data[] = $row;
262 }
263
264 return $data;
265 }
static getRequestRequestStatisticDataRegisterByActiveId($activeId)
static getInstance(ilTestSession $a_test_session)
buildQuestionRelatedObjectivesList(ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)

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

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

989 {
990 // prepare generation before contents are processed (for mathjax)
991 require_once 'Services/PDFGeneration/classes/class.ilPDFGeneration.php';
993
994 // REQUIRED, since we call this object regardless of the loop
995 $question_gui = $this->object->createQuestionGUI("", $question_id);
996
997 $foundusers = $this->object->getParticipantsForTestAndQuestion($test_id, $question_id);
998 $output = '';
999 foreach($foundusers as $active_id => $passes)
1000 {
1001 $resultpass = $this->object->_getResultPass($active_id);
1002 for($i = 0; $i < count($passes); $i++)
1003 {
1004 if(($resultpass !== null) && ($resultpass == $passes[$i]["pass"]))
1005 {
1006 if($output)
1007 {
1008 $output .= "<br /><br /><br />";
1009 }
1010
1011 // check if re-instantiation is really neccessary
1012 $question_gui = $this->object->createQuestionGUI("", $passes[$i]["qid"]);
1013 $output .= $this->getResultsHeadUserAndPass($active_id, $resultpass + 1);
1014 $question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_PRINT_PDF);
1015 $output .= $question_gui->getSolutionOutput(
1016 $active_id,
1017 $resultpass,
1018 $graphicalOutput = FALSE,
1019 $result_output = FALSE,
1020 $show_question_only = FALSE,
1021 $show_feedback = FALSE
1022 );
1023 }
1024 }
1025 }
1026
1027 require_once './Modules/Test/classes/class.ilTestPDFGenerator.php';
1028 ilTestPDFGenerator::generatePDF($output, ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $question_gui->object->getTitleFilenameCompliant());
1029 }
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)
getResultsHeadUserAndPass($active_id, $pass)
Returns the user and pass data for a test results output.
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\s+" &#(? foreach( $entity_files as $file) $output

References $output, ilTestPDFGenerator\generatePDF(), getResultsHeadUserAndPass(), ilTestPDFGenerator\PDF_OUTPUT_DOWNLOAD, 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 933 of file class.ilTestServiceGUI.php.

934 {
935 $template = new ilTemplate("tpl.il_as_tst_results_head_user_pass.html", TRUE, TRUE, "Modules/Test");
936 include_once './Services/User/classes/class.ilObjUser.php';
937 $user_id = $this->object->_getUserIdFromActiveId($active_id);
938 if (strlen(ilObjUser::_lookupLogin($user_id)) > 0)
939 {
940 $user = new ilObjUser($user_id);
941 }
942 else
943 {
944 $user = new ilObjUser();
945 $user->setLastname($this->lng->txt("deleted_user"));
946 }
947 $title_matric = "";
948 if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE)))
949 {
950 $template->setCurrentBlock("user_matric");
951 $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
952 $template->parseCurrentBlock();
953 $template->setCurrentBlock("user_matric_value");
954 $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
955 $template->parseCurrentBlock();
956 $template->touchBlock("user_matric_separator");
957 $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
958 }
959
960 $invited_user = array_pop($this->object->getInvitedUsers($user_id));
961 if (strlen($invited_user["clientip"]))
962 {
963 $template->setCurrentBlock("user_clientip");
964 $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
965 $template->parseCurrentBlock();
966 $template->setCurrentBlock("user_clientip_value");
967 $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
968 $template->parseCurrentBlock();
969 $template->touchBlock("user_clientip_separator");
970 $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
971 }
972
973 $template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
974 $uname = $this->object->userLookupFullName($user_id, FALSE);
975 $template->setVariable("VALUE_USR_NAME", $uname);
976 $template->setVariable("TXT_PASS", $this->lng->txt("scored_pass"));
977 $template->setVariable("VALUE_PASS", $pass);
978 return $template->get();
979 }

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

808 {
809 global $ilObjDataCache;
810
811 include_once("./Services/UICore/classes/class.ilTemplate.php");
812 $template = new ilTemplate("tpl.il_as_tst_results_participant.html", TRUE, TRUE, "Modules/Test");
813
814 if( $this->participantData instanceof ilTestParticipantData )
815 {
816 $user_id = $this->participantData->getUserIdByActiveId($active_id);
817 $uname = $this->participantData->getConcatedFullnameByActiveId($active_id, false);
818 }
819 else
820 {
821 $user_id = $this->object->_getUserIdFromActiveId($active_id);
822 $uname = $this->object->userLookupFullName($user_id, TRUE);
823 }
824
825 if (((array_key_exists("pass", $_GET)) && (strlen($_GET["pass"]) > 0)) || (!is_null($pass)))
826 {
827 if (is_null($pass)) $pass = $_GET["pass"];
828 }
829
830 if (!is_null($pass))
831 {
832 require_once 'Modules/Test/classes/class.ilTestResultHeaderLabelBuilder.php';
833 $testResultHeaderLabelBuilder = new ilTestResultHeaderLabelBuilder($this->lng, $ilObjDataCache);
834
835 $objectivesList = null;
836
837 if( $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired() )
838 {
839 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass);
840 $testSequence->loadFromDb();
841 $testSequence->loadQuestions();
842
843 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
844 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
845
846 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
847 $objectivesList->loadObjectivesTitles();
848
849 $testResultHeaderLabelBuilder->setObjectiveOrientedContainerId($testSession->getObjectiveOrientedContainerId());
850 $testResultHeaderLabelBuilder->setUserId($testSession->getUserId());
851 $testResultHeaderLabelBuilder->setTestObjId($this->object->getId());
852 $testResultHeaderLabelBuilder->setTestRefId($this->object->getRefId());
853 $testResultHeaderLabelBuilder->initObjectiveOrientedMode();
854 }
855
856 $result_array = $this->object->getTestResult(
857 $active_id, $pass, false, !$this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()
858 );
859
860 $user_id = $this->object->_getUserIdFromActiveId($active_id);
861 $showAllAnswers = TRUE;
862 if ($this->object->isExecutable($testSession, $user_id))
863 {
864 $showAllAnswers = FALSE;
865 }
866 if ($show_answers)
867 {
868 $list_of_answers = $this->getPassListOfAnswers(
869 $result_array, $active_id, $pass, $_SESSION['tst_results_show_best_solutions'],
870 $showAllAnswers, $show_question_only, $show_reached_points, $show_pass_details,
871 $objectivesList, $testResultHeaderLabelBuilder
872 );
873 $template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
874 }
875
876 if ($show_pass_details)
877 {
878 $overviewTableGUI = $this->getPassDetailsOverviewTableGUI($result_array, $active_id, $pass, $targetGUI, "getResultsOfUserOutput", '', $show_answers, $objectivesList);
879 $overviewTableGUI->setTitle($testResultHeaderLabelBuilder->getPassDetailsHeaderLabel($pass + 1));
880 $template->setVariable("PASS_DETAILS", $overviewTableGUI->getHTML());
881 }
882
883 $signature = $this->getResultsSignature();
884 $template->setVariable("SIGNATURE", $signature);
885
886 if ($this->object->isShowExamIdInTestResultsEnabled())
887 {
888 $template->setCurrentBlock('exam_id_footer');
889 $template->setVariable('EXAM_ID_VAL', ilObjTest::lookupExamId(
890 $testSession->getActiveId(), $pass
891 ));
892 $template->setVariable('EXAM_ID_TXT', $this->lng->txt('exam_id'));
893 $template->parseCurrentBlock();
894 }
895 }
896
897 $template->setCurrentBlock('participant_back_anchor');
898 $template->setVariable("HREF_PARTICIPANT_BACK_ANCHOR", "#tst_results_toolbar");
899 $template->setVariable("TXT_PARTICIPANT_BACK_ANCHOR", $this->lng->txt('tst_back_to_top'));
900 $template->parseCurrentBlock();
901
902 $template->setCurrentBlock('participant_block_id');
903 $template->setVariable("PARTICIPANT_BLOCK_ID", "participant_active_{$active_id}");
904 $template->parseCurrentBlock();
905
906 if( $this->isGradingMessageRequired() )
907 {
908 $gradingMessageBuilder = $this->getGradingMessageBuilder($active_id);
909 $gradingMessageBuilder->buildList();
910
911 $template->setCurrentBlock('grading_message');
912 $template->setVariable('GRADING_MESSAGE', $gradingMessageBuilder->getList());
913 $template->parseCurrentBlock();
914 }
915
916
917 $user_data = $this->getAdditionalUsrDataHtmlAndPopulateWindowTitle($testSession, $active_id, TRUE);
918 $template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
919 $template->setVariable("USER_DATA", $user_data);
920
921 $this->populatePassFinishDate($template, $this->object->getPassFinishDate($active_id, $pass));
922
923 return $template->get();
924 }
$_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, buildQuestionRelatedObjectivesList(), getAdditionalUsrDataHtmlAndPopulateWindowTitle(), getGradingMessageBuilder(), ilLOTestQuestionAdapter\getInstance(), getObjectiveOrientedContainer(), getPassDetailsOverviewTableGUI(), getPassListOfAnswers(), getResultsSignature(), isGradingMessageRequired(), ilObjTest\lookupExamId(), 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 641 of file class.ilTestServiceGUI.php.

642 {
643 if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity())
644 {
645 $template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", TRUE, TRUE, "Modules/Test");
646 $template->setVariable("TXT_DATE", $this->lng->txt("date"));
649 $template->setVariable("VALUE_DATE", ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX)));
651 $template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
652 $template->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.png"));
653 return $template->get();
654 }
655 else
656 {
657 return "";
658 }
659 }
const IL_CAL_UNIX
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date)
Format a date @access public.
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 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 311 of file class.ilTestServiceGUI.php.

312 {
313 if( $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired() )
314 {
315 require_once 'Services/Link/classes/class.ilLink.php';
316 $courseLink = ilLink::_getLink($this->getObjectiveOrientedContainer()->getRefId());
317 $this->tabs->setBack2Target($this->lng->txt('back_to_objective_container'), $courseLink);
318
319 $this->tabs->addTab(
320 'results_pass_oriented', $this->lng->txt('tst_tab_results_pass_oriented'),
321 $this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'outUserResultsOverview')
322 );
323
324 $this->tabs->addTab(
325 'results_objective_oriented', $this->lng->txt('tst_tab_results_objective_oriented'),
326 $this->ctrl->getLinkTargetByClass('ilTestEvalObjectiveOrientedGUI', 'showVirtualPass')
327 );
328
329 $this->tabs->setTabActive($activeTabId);
330 }
331 }

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

1043 {
1044 if( $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired() )
1045 {
1046 return false;
1047 }
1048
1049 if( $this->object->isShowGradingStatusEnabled() )
1050 {
1051 return true;
1052 }
1053
1054 if( $this->object->isShowGradingMarkEnabled() )
1055 {
1056 return true;
1057 }
1058
1059 if( $this->object->areObligationsEnabled() )
1060 {
1061 return true;
1062 }
1063
1064 return false;
1065 }

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
Returns
bool

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

337 {
338 if( !isset($_GET['pdf']) )
339 {
340 return false;
341 }
342
343 if( !(bool)$_GET['pdf'] )
344 {
345 return false;
346 }
347
348 return true;
349 }

References $_GET.

Referenced by buildPassDetailsOverviewTableGUI(), ilTestEvaluationGUI\executeCommand(), getCorrectSolutionOutput(), getPassListOfAnswers(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserPassDetails(), ilTestEvaluationGUI\outUserResultsOverview(), populateContent(), and ilTestEvalObjectiveOrientedGUI\showVirtualPassCmd().

+ Here is the caller graph for this function:

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

1191 {
1192 if( !$this->object->getShowSolutionDetails() )
1193 {
1194 ilUtil::sendInfo($this->lng->txt("no_permission"), true);
1195 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1196 }
1197
1198 $testSession = $this->testSessionFactory->getSession();
1199 $activeId = $testSession->getActiveId();
1200
1201 if( !($activeId > 0) )
1202 {
1203 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
1204 }
1205
1206 $this->ctrl->saveParameter($this, "pass");
1207 $pass = (int)$_GET['pass'];
1208
1209 $questionId = (int)$_GET['evaluation'];
1210
1211 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1212 $testSequence->loadFromDb();
1213 $testSequence->loadQuestions();
1214
1215 if( !$testSequence->questionExists($questionId) )
1216 {
1218 }
1219
1220 if( $this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired() )
1221 {
1222 $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
1223 $testSequence->loadFromDb();
1224 $testSequence->loadQuestions();
1225
1226 require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
1227 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession);
1228 $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence);
1229 $objectivesList->loadObjectivesTitles();
1230 }
1231 else
1232 {
1233 $objectivesList = null;
1234 }
1235
1236 global $ilTabs;
1237
1238 if($this instanceof ilTestEvalObjectiveOrientedGUI)
1239 {
1240 $ilTabs->setBackTarget(
1241 $this->lng->txt("tst_back_to_virtual_pass"), $this->ctrl->getLinkTarget($this, 'showVirtualPass')
1242 );
1243 }
1244 else
1245 {
1246 $ilTabs->setBackTarget(
1247 $this->lng->txt("tst_back_to_pass_details"), $this->ctrl->getLinkTarget($this, 'outUserPassDetails')
1248 );
1249 }
1250
1251 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
1252 $this->tpl->setCurrentBlock("ContentStyle");
1253 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
1254 $this->tpl->parseCurrentBlock();
1255
1256 $this->tpl->setCurrentBlock("SyntaxStyle");
1257 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
1258 $this->tpl->parseCurrentBlock();
1259
1260 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print.css", "Modules/Test"), "print");
1261 if ($this->object->getShowSolutionAnswersOnly())
1262 {
1263 $this->tpl->addCss(ilUtil::getStyleSheetLocation("output", "test_print_hide_content.css", "Modules/Test"), "print");
1264 }
1265
1266 $solution = $this->getCorrectSolutionOutput($questionId, $activeId, $pass, $objectivesList);
1267
1268 $this->tpl->setContent($solution);
1269 }
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id)
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 1180 of file class.ilTestServiceGUI.php.

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

1152 {
1153 if($this->isPdfDeliveryRequest())
1154 {
1155 require_once 'class.ilTestPDFGenerator.php';
1156
1158 $content, ilTestPDFGenerator::PDF_OUTPUT_DOWNLOAD, $this->object->getTitleFilenameCompliant()
1159 );
1160 }
1161 else
1162 {
1163 $this->tpl->setContent($content);
1164 }
1165 }

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

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

1276 {
1279 $passFinishDate = ilDatePresentation::formatDate(new ilDateTime($passFinishDate, IL_CAL_UNIX));
1281 $tpl->setVariable("PASS_FINISH_DATE_LABEL", $this->lng->txt('tst_pass_finished_on'));
1282 $tpl->setVariable("PASS_FINISH_DATE_VALUE", $passFinishDate);
1283 }
@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 270 of file class.ilTestServiceGUI.php.

271 {
272 $this->objectiveOrientedContainer = $objectiveOrientedContainer;
273 }

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: