ILIAS  release_8 Revision v8.24
ilTestOutputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilTestOutputGUI:
+ Collaboration diagram for ilTestOutputGUI:

Public Member Functions

 executeCommand ()
 Execute Command. More...
 
 saveQuestionSolution ($authorized=true, $force=false)
 saves the user input of a question More...
 
- Public Member Functions inherited from ilTestPlayerAbstractGUI
 __construct ($a_object)
 ilTestOutputGUI constructor More...
 
 saveTagsCmd ()
 Save tags for tagging gui. More...
 
 updateWorkingTime ()
 updates working time and stores state saveresult to see if question has to be stored or not More...
 
 removeIntermediateSolution ()
 remove an auto-saved solution of the current question More...
 
 saveQuestionSolution ($authorized=true, $force=false)
 saves the user input of a question More...
 
 suspendTestCmd ()
 
 isMaxProcessingTimeReached ()
 Checks wheather the maximum processing time is reached or not. More...
 
 setAnonymousIdCmd ()
 Sets a session variable with the test access code for an anonymous test user. More...
 
 getLockParameter ()
 
 displayAccessCodeCmd ()
 
 accessCodeConfirmedCmd ()
 
 handleUserSettings ()
 Handles some form parameters on starting and resuming a test. More...
 
 redirectAfterAutosaveCmd ()
 Redirect the user after an automatic save when the time limit is reached. More...
 
 redirectAfterDashboardCmd ()
 
 autosaveCmd ()
 Automatically save a user answer while working on the test (called repeatedly by asynchronous posts in configured autosave interval) More...
 
 autosaveOnTimeLimitCmd ()
 Automatically save a user answer when the limited duration of a test run is reached (called by synchronous form submit when the remaining time count down reaches zero) More...
 
 toggleSideListCmd ()
 Toggle side list. More...
 
 finishTestCmd ($requires_confirmation=true)
 
 redirectBackCmd ()
 
 getKioskHead ()
 
 checkOnlineTestAccess ()
 check access restrictions like client ip, partipating user etc. More...
 
 isTestAccessible ()
 test accessible returns true if the user can perform the test More...
 
 isNrOfTriesReached ()
 nr of tries exceeded More...
 
 endingTimeReached ()
 handle endingTimeReached More...
 
 maxProcessingTimeReached ()
 Outputs a message when the maximum processing time is reached. More...
 
 confirmSubmitAnswers ()
 confirm submit results if confirm then results are submitted and the screen will be redirected to the startpage of the test @access public More...
 
 outProcessingTime ($active_id)
 
 checkWorkingTimeCmd ()
 This is asynchronously called by tpl.workingtime.js to check for changes in the user's processing time for a test. More...
 
 outQuestionSummaryCmd ($fullpage=true, $contextFinishTest=false, $obligationsInfo=false, $obligationsFilter=false)
 Output of a summary of all test questions for test participants. More...
 
 outQuestionSummaryWithObligationsInfoCmd ()
 
 outObligationsOnlySummaryCmd ()
 
 showMaximumAllowedUsersReachedMessage ()
 
 backFromFinishingCmd ()
 
 outCorrectSolution ()
 Creates an output of the solution of an answer compared to the correct solution. More...
 
 showListOfAnswers ($active_id, $pass=null, $top_data="", $bottom_data="")
 Creates an output of the list of answers for a test participant during the test (only the actual pass will be shown) More...
 
 getContentBlockName ()
 Returns the name of the current content block (depends on the kiosk mode setting) More...
 
 outUserResultsOverviewCmd ()
 
- Public Member Functions inherited from ilTestServiceGUI
 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)
 This method uses the data of a given test pass to create an evaluation for displaying into a table used in the ilTestEvaluationGUI. More...
 
 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)
 
 getObject ()
 

Protected Member Functions

 startTestCmd ()
 
 updateLearningProgressOnTestStart ()
 
 showQuestionCmd ()
 
 editSolutionCmd ()
 
 submitSolutionAndNextCmd ()
 
 submitSolutionCmd ()
 
 discardSolutionCmd ()
 
 skipQuestionCmd ()
 
 handleQuestionPostponing ($sequenceElement)
 
 handleCheckTestPassValid ()
 
 nextQuestionCmd ()
 
 previousQuestionCmd ()
 
 isFirstQuestionInSequence ($sequenceElement)
 
 isLastQuestionInSequence ($sequenceElement)
 
 canSaveResult ()
 Returns TRUE if the answers of the current user could be saved. More...
 
 getCurrentQuestionId ()
 
 showInstantResponseCmd ()
 
 handleQuestionActionCmd ()
 
 performTearsAndAngerBrokenConfessionChecks ()
 
 generateRandomTestPassForActiveUser ()
 
 resumePlayerCmd ()
 Resume a test at the last position. More...
 
 isShowingPostponeStatusReguired ($questionId)
 
 adoptUserSolutionsFromPreviousPass ()
 
 populateQuestionOptionalMessage ()
 
 isOptionalQuestionAnsweringConfirmationRequired ($sequenceKey)
 
 isQuestionSummaryFinishTestButtonRequired ()
 
 handleTearsAndAngerNoObjectiveOrientedQuestion ()
 
 handlePrimaryButton (ilTestNavigationToolbarGUI $navigationToolbarGUI, $currentQuestionId)
 
- Protected Member Functions inherited from ilTestPlayerAbstractGUI
 checkReadAccess ()
 
 checkTestExecutable ()
 
 checkTestSessionUser (ilTestSession $testSession)
 
 ensureExistingTestSession (ilTestSession $testSession)
 
 initProcessLocker ($activeId)
 
 canSaveResult ()
 
 determineInlineScoreDisplay ()
 
 populateTestNavigationToolbar (ilTestNavigationToolbarGUI $toolbarGUI)
 
 populateQuestionNavigation ($sequenceElement, $disabled, $primaryNext)
 
 populatePreviousButtons ($disabled)
 
 populateNextButtons ($disabled, $primaryNext)
 
 populateLowerNextButtonBlock ($disabled, $primaryNext)
 
 populateUpperNextButtonBlock ($disabled, $primaryNext)
 
 populateLowerPreviousButtonBlock ($disabled)
 
 populateUpperPreviousButtonBlock ($disabled)
 
 populateSpecificFeedbackBlock (assQuestionGUI $question_gui)
 
 populateGenericFeedbackBlock (assQuestionGUI $question_gui, $solutionCorrect)
 
 populateScoreBlock ($reachedPoints, $maxPoints)
 
 populateSolutionBlock ($solutionoutput)
 
 populateSyntaxStyleBlock ()
 
 populateContentStyleBlock ()
 
 startPlayerCmd ()
 Start a test for the first time. More...
 
 resumePlayerCmd ()
 Resume a test at the last position. More...
 
 initTestCmd ()
 Start a test for the first time after a redirect. More...
 
 getCurrentQuestionId ()
 
 detectChangesCmd ()
 Detect changes sent in the background to the server This is called by ajax from ilTestPlayerQuestionEditControl.js It is needed by Java and Flash question and eventually plgin question vtypes. More...
 
 submitIntermediateSolutionCmd ()
 
 markQuestionAndSaveIntermediateCmd ()
 
 markQuestionCmd ()
 Set a question solved. More...
 
 unmarkQuestionAndSaveIntermediateCmd ()
 
 unmarkQuestionCmd ()
 Set a question unsolved. More...
 
 confirmFinishCmd ()
 The final submission of a test was confirmed. More...
 
 performTestPassFinishedTasks ($finishedPass)
 
 afterTestPassFinishedCmd ()
 
 archiveParticipantSubmission ($active, $pass)
 
 backToInfoScreenCmd ()
 
 prepareTestPage ($presentationMode, $sequenceElement, $questionId)
 
 isOptionalQuestionAnsweringConfirmationRequired ($sequenceElement)
 
 isShowingPostponeStatusReguired ($questionId)
 
 showQuestionViewable (assQuestionGUI $questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse)
 
 showQuestionEditable (assQuestionGUI $questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse)
 
 determineSolutionPassIndex (assQuestionGUI $questionGui)
 
 showQuestionCmd ()
 
 editSolutionCmd ()
 
 submitSolutionCmd ()
 
 revertChangesCmd ()
 
 discardSolutionCmd ()
 
 skipQuestionCmd ()
 
 startTestCmd ()
 
 showSideList ($presentationMode, $currentSequenceElement)
 
 isQuestionSummaryFinishTestButtonRequired ()
 
 showRequestedHintListCmd ()
 Go to requested hint list. More...
 
 confirmHintRequestCmd ()
 Go to hint request confirmation. More...
 
 isFirstQuestionInSequence ($sequenceElement)
 
 isLastQuestionInSequence ($sequenceElement)
 
 handleQuestionActionCmd ()
 
 showInstantResponseCmd ()
 
 nextQuestionCmd ()
 
 previousQuestionCmd ()
 
 prepareSummaryPage ()
 
 initTestPageTemplate ()
 
 populateKioskHead ()
 
 handlePasswordProtectionRedirect ()
 
 isParticipantsAnswerFixed ($questionId)
 
 getIntroductionPageButtonLabel ()
 
 initAssessmentSettings ()
 
 handleSkillTriggering (ilTestSession $testSession)
 
 buildTestPassQuestionList ()
 
 showAnswerOptionalQuestionsConfirmation ()
 
 confirmAnswerOptionalQuestionsCmd ()
 
 cancelAnswerOptionalQuestionsCmd ()
 
 populateHelperGuiContent ($helperGui)
 
 populateCharSelectorIfRequired ()
 
 getTestNavigationToolbarGUI ()
 
 buildReadOnlyStateQuestionNavigationGUI ($questionId)
 
 buildEditableStateQuestionNavigationGUI ($questionId, $charSelectorAvailable)
 
 getFinishTestCommand ()
 
 populateInstantResponseModal (assQuestionGUI $questionGui, $navUrl)
 
 populateInstantResponseBlocks (assQuestionGUI $questionGui, $authorizedSolution)
 
 populateFeedbackBlockHeader ($withFocusAnchor)
 
 populateFeedbackBlockMessage (string $a_message)
 
 getCurrentSequenceElement ()
 
 getSequenceElementParameter ()
 
 getPresentationModeParameter ()
 
 getInstantResponseParameter ()
 
 getNextCommandParameter ()
 
 getNextSequenceParameter ()
 
 getNavigationUrlParameter ()
 
 getAnswerChangedParameter ()
 Get the 'answer changed' status from the current request It may be set by ilTestPlayerNavigationControl.js or by a previousRequest. More...
 
 setAnswerChangedParameter ($changed=true)
 Set the 'answer changed' url parameter for generated links. More...
 
 handleIntermediateSubmit ()
 Check the 'answer changed' parameter when a question form is intermediately submitted. More...
 
 saveNavigationPreventConfirmation ()
 Save the save the switch to prevent the navigation confirmation. More...
 
 getQuestionGuiInstance ($question_id, $fromCache=true)
 
 getQuestionInstance ($questionId, $fromCache=true)
 
 initTestQuestionConfig (assQuestion $questionOBJ)
 
 handleTearsAndAngerQuestionIsNull ($questionId, $sequenceElement)
 
 populateMessageContent ($contentHTML)
 
 populateModals ()
 
 populateDiscardSolutionModal ()
 
 populateNavWhenChangedModal ()
 
 populateNextLocksUnchangedModal ()
 
 populateNextLocksChangedModal ()
 
 setFollowUpQuestionLocksConfirmationPrevented ()
 
 isFollowUpQuestionLocksConfirmationPrevented ()
 
 getQuestionsDefaultPresentationMode ($isQuestionWorkedThrough)
 
 registerForcedFeedbackNavUrl ($forcedFeedbackNavUrl)
 
 getRegisteredForcedFeedbackNavUrl ()
 
 isForcedFeedbackNavUrlRegistered ()
 
 unregisterForcedFeedbackNavUrl ()
 
 handleFileUploadCmd ()
 
- Protected Member Functions inherited from ilTestServiceGUI
 isPdfDeliveryRequest ()
 
 buildQuestionAnswerShuffler (int $question_id, int $active_id, int $pass_id)
 
 buildFixedShufflerSeed (int $question_id, int $pass_id, int $active_id)
 
 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

 $questionRelatedObjectivesList
 
- Protected Attributes inherited from ilTestPlayerAbstractGUI
 $passwordChecker
 
 $processLocker
 
 $testSession
 
 $assSettings
 
 $testSequence = null
 
- Protected Attributes inherited from ilTestServiceGUI
ILIAS Test InternalRequestService $testrequest
 
 $db
 
Refinery $refinery
 
 $tabs
 
 $objCache
 
 $testSessionFactory = null
 
 $testSequenceFactory = null
 
 $participantData
 

Private Member Functions

 isValidSequenceElement ($sequenceElement)
 

Additional Inherited Members

- Data Fields inherited from ilTestPlayerAbstractGUI
const PRESENTATION_MODE_VIEW = 'view'
 
const PRESENTATION_MODE_EDIT = 'edit'
 
const FIXED_SHUFFLER_SEED_MIN_LENGTH = 8
 
 $ref_id
 
 $saveResult
 
 $sequence
 
 $cmdCtrl
 
 $maxProcessingTimeReached
 
 $endingTimeReached
 
const FOLLOWUP_QST_LOCKS_PREVENT_CONFIRMATION_PARAM = 'followup_qst_locks_prevent_confirmation'
 
- Data Fields inherited from ilTestServiceGUI
 $object = null
 
 $service = null
 
 $lng
 
 $tpl
 
 $ctrl
 
 $ilias
 
 $tree
 
 $ref_id
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Output class for assessment test execution

The ilTestOutputGUI class creates the output for the ilObjTestGUI class when learners execute a test. This saves some heap space because the ilObjTestGUI class will be much smaller then

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
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

@inGroup ModulesTest

Definition at line 33 of file class.ilTestOutputGUI.php.

Member Function Documentation

◆ adoptUserSolutionsFromPreviousPass()

ilTestOutputGUI::adoptUserSolutionsFromPreviousPass ( )
protected

Definition at line 892 of file class.ilTestOutputGUI.php.

893 {
894 global $DIC;
895 $ilDB = $DIC['ilDB'];
896 $ilUser = $DIC['ilUser'];
897
898 $assSettings = new ilSetting('assessment');
899
900 $isAssessmentLogEnabled = ilObjAssessmentFolder::_enabledAssessmentLogging();
901
902 $userSolutionAdopter = new ilAssQuestionUserSolutionAdopter($ilDB, $assSettings, $isAssessmentLogEnabled);
903
904 $userSolutionAdopter->setUserId($ilUser->getId());
905 $userSolutionAdopter->setActiveId($this->testSession->getActiveId());
906 $userSolutionAdopter->setTargetPass($this->testSequence->getPass());
907 $userSolutionAdopter->setQuestionIds($this->testSequence->getOptionalQuestions());
908
909 $userSolutionAdopter->perform();
910 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$ilUser
Definition: imgupload.php:34

References ilTestPlayerAbstractGUI\$assSettings, $DIC, $ilDB, $ilUser, and ilObjAssessmentFolder\_enabledAssessmentLogging().

Referenced by startTestCmd().

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

◆ canSaveResult()

ilTestOutputGUI::canSaveResult ( )
protected

Returns TRUE if the answers of the current user could be saved.

Returns
boolean TRUE if the answers could be saved, FALSE otherwise

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 645 of file class.ilTestOutputGUI.php.

645 : bool
646 {
647 return !$this->object->endingTimeReached() && !$this->isMaxProcessingTimeReached() && !$this->isNrOfTriesReached();
648 }
isMaxProcessingTimeReached()
Checks wheather the maximum processing time is reached or not.

References ilTestPlayerAbstractGUI\isMaxProcessingTimeReached(), and ilTestPlayerAbstractGUI\isNrOfTriesReached().

Referenced by saveQuestionSolution().

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

◆ discardSolutionCmd()

ilTestOutputGUI::discardSolutionCmd ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 524 of file class.ilTestOutputGUI.php.

525 {
526 $currentSequenceElement = $this->getCurrentSequenceElement();
527
528 $currentQuestionOBJ = $this->getQuestionInstance(
529 $this->testSequence->getQuestionForSequence($currentSequenceElement)
530 );
531
532 $currentQuestionOBJ->resetUsersAnswer(
533 $this->testSession->getActiveId(),
534 $this->testSession->getPass()
535 );
536
537 $this->ctrl->saveParameter($this, 'sequence');
538
539 $this->ctrl->setParameter($this, 'pmode', ilTestPlayerAbstractGUI::PRESENTATION_MODE_VIEW);
540
541 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
542 }
getQuestionInstance($questionId, $fromCache=true)

References ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\getCurrentSequenceElement(), ilTestPlayerAbstractGUI\getQuestionInstance(), ilTestPlayerAbstractGUI\PRESENTATION_MODE_VIEW, and ilTestPlayerCommands\SHOW_QUESTION.

+ Here is the call graph for this function:

◆ editSolutionCmd()

ilTestOutputGUI::editSolutionCmd ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 444 of file class.ilTestOutputGUI.php.

445 {
446 $this->ctrl->setParameter($this, 'pmode', ilTestPlayerAbstractGUI::PRESENTATION_MODE_EDIT);
447 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
448 }

References ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\PRESENTATION_MODE_EDIT, and ilTestPlayerCommands\SHOW_QUESTION.

+ Here is the call graph for this function:

◆ executeCommand()

ilTestOutputGUI::executeCommand ( )

Execute Command.

Reimplemented from ilTestServiceGUI.

Definition at line 43 of file class.ilTestOutputGUI.php.

44 {
45 global $DIC;
46 $ilDB = $DIC['ilDB'];
47 $component_repository = $DIC['component.repository'];
48 $lng = $DIC['lng'];
49 $refinery = $DIC['refinery'];
50 $ilTabs = $DIC['ilTabs'];
51
52 $this->checkReadAccess();
53
54 $ilTabs->clearTargets();
55
56 $cmd = $this->ctrl->getCmd();
57 $next_class = $this->ctrl->getNextClass($this);
58
59 $this->ctrl->saveParameter($this, "sequence");
60 $this->ctrl->saveParameter($this, "pmode");
61 $this->ctrl->saveParameter($this, "active_id");
62
64
65 $testSessionFactory = new ilTestSessionFactory($this->object);
66 $this->testSession = $testSessionFactory->getSession($this->testrequest->raw('active_id'));
67
68 $this->ensureExistingTestSession($this->testSession);
69 $this->checkTestSessionUser($this->testSession);
70
71 $this->initProcessLocker($this->testSession->getActiveId());
72
73 $testSequenceFactory = new ilTestSequenceFactory($ilDB, $lng, $refinery, $component_repository, $this->object);
74 $this->testSequence = $testSequenceFactory->getSequenceByTestSession($this->testSession);
75 $this->testSequence->loadFromDb();
76 $this->testSequence->loadQuestions();
77
78 $DIC->globalScreen()->tool()->context()->current()->addAdditionalData(
80 $this->object->getKioskMode()
81 );
82 $title = $this->object->getTitle();
83 if (($sequence_index = $this->getSequenceElementParameter()) !== null) {
84 $title .= ' - ' . $this->lng->txt('question') . $sequence_index;
85 }
86 $DIC->globalScreen()->tool()->context()->current()->addAdditionalData(
88 $title
89 );
90 $instance_name = $DIC['ilSetting']->get('short_inst_name');
91 if (trim($instance_name) === '') {
92 $instance_name = 'ILIAS';
93 }
94 $DIC->globalScreen()->tool()->context()->current()->addAdditionalData(
96 $instance_name
97 );
98
99 $this->questionRelatedObjectivesList = new ilTestQuestionRelatedObjectivesList();
100
103
105
106 $cmd = $this->getCommand($cmd);
107
108 switch ($next_class) {
109 case 'ilassquestionpagegui':
110 $this->checkTestExecutable();
111
112 $questionId = $this->testSequence->getQuestionForSequence($this->getCurrentSequenceElement());
113
114 $page_gui = new ilAssQuestionPageGUI($questionId);
115 $ret = $this->ctrl->forwardCommand($page_gui);
116 break;
117
118 case 'iltestsubmissionreviewgui':
119 $this->checkTestExecutable();
120
121 $gui = new ilTestSubmissionReviewGUI($this, $this->object, $this->testSession);
122 $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
123 $ret = $this->ctrl->forwardCommand($gui);
124 break;
125
126 case 'ilassquestionhintrequestgui':
127 $this->checkTestExecutable();
128
129 $questionGUI = $this->object->createQuestionGUI(
130 "",
131 $this->testSequence->getQuestionForSequence($this->getCurrentSequenceElement())
132 );
133
134 $questionHintTracking = new ilAssQuestionHintTracking(
135 $questionGUI->object->getId(),
136 $this->testSession->getActiveId(),
137 $this->testSession->getPass()
138 );
139
140 $gui = new ilAssQuestionHintRequestGUI($this, ilTestPlayerCommands::SHOW_QUESTION, $questionGUI, $questionHintTracking);
141
142 // fau: testNav - save the 'answer changed' status for viewing hint requests
144 // fau.
145 $ret = $this->ctrl->forwardCommand($gui);
146
147 break;
148
149 case 'iltestsignaturegui':
150 $this->checkTestExecutable();
151
152 $gui = new ilTestSignatureGUI($this);
153 $ret = $this->ctrl->forwardCommand($gui);
154 break;
155
156 case 'iltestpasswordprotectiongui':
157 $this->checkTestExecutable();
158
159 $gui = new ilTestPasswordProtectionGUI($this->ctrl, $this->tpl, $this->lng, $this, $this->passwordChecker);
160 $ret = $this->ctrl->forwardCommand($gui);
161 break;
162
163 default:
165 $this->checkTestExecutable();
166 }
167
168 if (strtolower($cmd) === 'showquestion') {
169 $testPassesSelector = new ilTestPassesSelector($this->db, $this->object);
170 $testPassesSelector->setActiveId($this->testSession->getActiveId());
171 $testPassesSelector->setLastFinishedPass($this->testSession->getLastFinishedPass());
172
173 if (!$testPassesSelector->openPassExists()) {
174 $this->tpl->setOnScreenMessage('info', $this->lng->txt('tst_pass_finished'), true);
175 $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
176 }
177 }
178
179 $cmd .= 'Cmd';
180 $ret = $this->$cmd();
181 break;
182 }
183 return $ret;
184 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkTestSessionUser(ilTestSession $testSession)
setAnswerChangedParameter($changed=true)
Set the 'answer changed' url parameter for generated links.
ensureExistingTestSession(ilTestSession $testSession)
getAnswerChangedParameter()
Get the 'answer changed' status from the current request It may be set by ilTestPlayerNavigationContr...
getCommand($cmd)
Retrieves the ilCtrl command.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initConnectionWithAnimation()
Init YUI connection and animation module used in Modules/Test (Jan 2022)
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template

References $DIC, $ilDB, ilTestServiceGUI\$lng, ilTestServiceGUI\$refinery, ilTestServiceGUI\$testSequenceFactory, ilTestServiceGUI\$testSessionFactory, ilTestPlayerAbstractGUI\checkReadAccess(), ilTestPlayerAbstractGUI\checkTestExecutable(), ilTestPlayerAbstractGUI\checkTestSessionUser(), ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\ensureExistingTestSession(), ilTestPlayerAbstractGUI\getAnswerChangedParameter(), ilTestServiceGUI\getCommand(), ilTestPlayerAbstractGUI\getCurrentSequenceElement(), ilTestServiceGUI\getObjectiveOrientedContainer(), ilTestPlayerAbstractGUI\getSequenceElementParameter(), ilTestPlayerAbstractGUI\handlePasswordProtectionRedirect(), ilTestPlayerAbstractGUI\initAssessmentSettings(), ilYuiUtil\initConnectionWithAnimation(), iljQueryUtil\initjQuery(), ilTestPlayerAbstractGUI\initProcessLocker(), ilTestPlayerCommands\isTestExecutionCommand(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilTestPlayerAbstractGUI\setAnswerChangedParameter(), ilTestPlayerCommands\SHOW_QUESTION, ilTestPlayerLayoutProvider\TEST_PLAYER_KIOSK_MODE_ENABLED, ilTestPlayerLayoutProvider\TEST_PLAYER_SHORT_TITLE, and ilTestPlayerLayoutProvider\TEST_PLAYER_TITLE.

+ Here is the call graph for this function:

◆ generateRandomTestPassForActiveUser()

ilTestOutputGUI::generateRandomTestPassForActiveUser ( )
protected

Definition at line 812 of file class.ilTestOutputGUI.php.

813 {
814 global $DIC;
815 $tree = $DIC['tree'];
816 $ilDB = $DIC['ilDB'];
817 $component_repository = $DIC['component.repository'];
818
819 $questionSetConfig = new ilTestRandomQuestionSetConfig($tree, $ilDB, $component_repository, $this->object);
820 $questionSetConfig->loadFromDb();
821
822 $sourcePoolDefinitionFactory = new ilTestRandomQuestionSetSourcePoolDefinitionFactory($ilDB, $this->object);
823
824 $sourcePoolDefinitionList = new ilTestRandomQuestionSetSourcePoolDefinitionList($ilDB, $this->object, $sourcePoolDefinitionFactory);
825 $sourcePoolDefinitionList->loadDefinitions();
826
827 $this->processLocker->executeRandomPassBuildOperation(function () use ($ilDB, $component_repository, $questionSetConfig, $sourcePoolDefinitionList) {
829 $stagingPoolQuestionList = new ilTestRandomQuestionSetStagingPoolQuestionList($ilDB, $component_repository);
830
831 $questionSetBuilder = ilTestRandomQuestionSetBuilder::getInstance($ilDB, $this->object, $questionSetConfig, $sourcePoolDefinitionList, $stagingPoolQuestionList);
832
833 $questionSetBuilder->performBuild($this->testSession);
834 }
835 }, $sourcePoolDefinitionList->hasTaxonomyFilters());
836 }
static getInstance(ilDBInterface $db, ilObjTest $testOBJ, ilTestRandomQuestionSetConfig $questionSetConfig, ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList, ilTestRandomQuestionSetStagingPoolQuestionList $stagingPoolQuestionList)

References $DIC, $ilDB, ilTestServiceGUI\$tree, ilTestRandomQuestionSetBuilder\getInstance(), and performTearsAndAngerBrokenConfessionChecks().

Referenced by resumePlayerCmd(), and startTestCmd().

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

◆ getCurrentQuestionId()

ilTestOutputGUI::getCurrentQuestionId ( )
protected
Returns
integer

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 653 of file class.ilTestOutputGUI.php.

653 : int
654 {
655 return $this->testSequence->getQuestionForSequence($this->testrequest->raw("sequence"));
656 }

◆ handleCheckTestPassValid()

ilTestOutputGUI::handleCheckTestPassValid ( )
protected

Definition at line 580 of file class.ilTestOutputGUI.php.

580 : void
581 {
582 $testObj = new ilObjTest($this->ref_id, true);
583
584 $participants = $testObj->getActiveParticipantList();
585 $participant = $participants->getParticipantByActiveId($this->testrequest->getActiveId());
586 if (!$participant || !$participant->hasUnfinishedPasses()) {
587 $this->tpl->setOnScreenMessage('failure', $this->lng->txt("tst_current_run_no_longer_valid"), true);
588 $this->backToInfoScreenCmd();
589 }
590 }

References ilTestPlayerAbstractGUI\backToInfoScreenCmd(), and ILIAS\Repository\lng().

Referenced by nextQuestionCmd(), and previousQuestionCmd().

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

◆ handlePrimaryButton()

ilTestOutputGUI::handlePrimaryButton ( ilTestNavigationToolbarGUI  $navigationToolbarGUI,
  $currentQuestionId 
)
protected
Parameters
ilTestNavigationToolbarGUI$navigationToolbarGUI
$currentQuestionId
Returns
bool

Definition at line 946 of file class.ilTestOutputGUI.php.

946 : bool
947 {
948 $isNextPrimary = true;
949
950 if ($this->object->isForceInstantFeedbackEnabled()) {
951 $isNextPrimary = false;
952 }
953
954 $questionsMissingResult = assQuestion::getQuestionsMissingResultRecord(
955 $this->testSession->getActiveId(),
956 $this->testSession->getPass(),
957 $this->testSequence->getOrderedSequenceQuestions()
958 );
959
960 if (!count($questionsMissingResult)) {
961 $navigationToolbarGUI->setFinishTestButtonPrimary(true);
962 $isNextPrimary = false;
963 } elseif (count($questionsMissingResult) == 1) {
964 $lastOpenQuestion = current($questionsMissingResult);
965
966 if ($currentQuestionId == $lastOpenQuestion) {
967 $navigationToolbarGUI->setFinishTestButtonPrimary(true);
968 $isNextPrimary = false;
969 }
970 }
971
972 return $isNextPrimary;
973 }
static getQuestionsMissingResultRecord(int $activeId, int $pass, array $questionIds)
setFinishTestButtonPrimary($finishTestButtonPrimary)

References assQuestion\getQuestionsMissingResultRecord(), ILIAS\Repository\object(), and ilTestNavigationToolbarGUI\setFinishTestButtonPrimary().

Referenced by showQuestionCmd().

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

◆ handleQuestionActionCmd()

ilTestOutputGUI::handleQuestionActionCmd ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 758 of file class.ilTestOutputGUI.php.

759 {
760 $questionId = $this->testSequence->getQuestionForSequence(
762 );
763
764 if (!$this->isParticipantsAnswerFixed($questionId)) {
765 $this->updateWorkingTime();
766 $this->saveQuestionSolution(false);
767 // fau: testNav - add changed status of the question
768 $this->setAnswerChangedParameter(true);
769 // fau.
770 }
771
772 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
773 }
saveQuestionSolution($authorized=true, $force=false)
saves the user input of a question
updateWorkingTime()
updates working time and stores state saveresult to see if question has to be stored or not

References ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\getCurrentSequenceElement(), ilTestPlayerAbstractGUI\isParticipantsAnswerFixed(), saveQuestionSolution(), ilTestPlayerAbstractGUI\setAnswerChangedParameter(), ilTestPlayerCommands\SHOW_QUESTION, and ilTestPlayerAbstractGUI\updateWorkingTime().

+ Here is the call graph for this function:

◆ handleQuestionPostponing()

ilTestOutputGUI::handleQuestionPostponing (   $sequenceElement)
protected

Definition at line 564 of file class.ilTestOutputGUI.php.

565 {
566 $questionId = $this->testSequence->getQuestionForSequence($sequenceElement);
567
568 $isQuestionWorkedThrough = assQuestion::_isWorkedThrough(
569 $this->testSession->getActiveId(),
570 $questionId,
571 $this->testSession->getPass()
572 );
573
574 if (!$isQuestionWorkedThrough) {
575 $this->testSequence->postponeQuestion($questionId);
576 $this->testSequence->saveToDb();
577 }
578 }
static _isWorkedThrough(int $active_id, int $question_id, int $pass)
Returns true if the question was worked through in the given pass Worked through means that the user ...

References assQuestion\_isWorkedThrough().

Referenced by nextQuestionCmd().

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

◆ handleTearsAndAngerNoObjectiveOrientedQuestion()

ilTestOutputGUI::handleTearsAndAngerNoObjectiveOrientedQuestion ( )
protected

Definition at line 934 of file class.ilTestOutputGUI.php.

935 {
936 $this->tpl->setOnScreenMessage('failure', sprintf($this->lng->txt('tst_objective_oriented_test_pass_without_questions'), $this->object->getTitle()), true);
937
938 $this->backToInfoScreenCmd();
939 }

References ilTestPlayerAbstractGUI\backToInfoScreenCmd(), and ILIAS\Repository\lng().

Referenced by showQuestionCmd().

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

◆ isFirstQuestionInSequence()

ilTestOutputGUI::isFirstQuestionInSequence (   $sequenceElement)
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 630 of file class.ilTestOutputGUI.php.

630 : bool
631 {
632 return $sequenceElement == $this->testSequence->getFirstSequence();
633 }

◆ isLastQuestionInSequence()

ilTestOutputGUI::isLastQuestionInSequence (   $sequenceElement)
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 635 of file class.ilTestOutputGUI.php.

635 : bool
636 {
637 return $sequenceElement == $this->testSequence->getLastSequence();
638 }

◆ isOptionalQuestionAnsweringConfirmationRequired()

ilTestOutputGUI::isOptionalQuestionAnsweringConfirmationRequired (   $sequenceKey)
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 914 of file class.ilTestOutputGUI.php.

914 : bool
915 {
916 if ($this->testSequence->isAnsweringOptionalQuestionsConfirmed()) {
917 return false;
918 }
919
920 $questionId = $this->testSequence->getQuestionForSequence($sequenceKey);
921
922 if (!$this->testSequence->isQuestionOptional($questionId)) {
923 return false;
924 }
925
926 return true;
927 }

◆ isQuestionSummaryFinishTestButtonRequired()

ilTestOutputGUI::isQuestionSummaryFinishTestButtonRequired ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 929 of file class.ilTestOutputGUI.php.

929 : bool
930 {
931 return true;
932 }

◆ isShowingPostponeStatusReguired()

ilTestOutputGUI::isShowingPostponeStatusReguired (   $questionId)
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 887 of file class.ilTestOutputGUI.php.

887 : bool
888 {
889 return $this->testSequence->isPostponedQuestion($questionId);
890 }

◆ isValidSequenceElement()

ilTestOutputGUI::isValidSequenceElement (   $sequenceElement)
private

Definition at line 279 of file class.ilTestOutputGUI.php.

279 : bool
280 {
281 if ($sequenceElement === false) {
282 return false;
283 }
284
285 if ($sequenceElement < 1) {
286 return false;
287 }
288
289 if (!$this->testSequence->getPositionOfSequence($sequenceElement)) {
290 return false;
291 }
292
293 return true;
294 }

Referenced by nextQuestionCmd(), previousQuestionCmd(), showQuestionCmd(), skipQuestionCmd(), and submitSolutionAndNextCmd().

+ Here is the caller graph for this function:

◆ nextQuestionCmd()

ilTestOutputGUI::nextQuestionCmd ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 592 of file class.ilTestOutputGUI.php.

593 {
595 $lastSequenceElement = $this->getCurrentSequenceElement();
596 $nextSequenceElement = $this->testSequence->getNextSequence($lastSequenceElement);
597
598 if ($this->object->isPostponingEnabled()) {
599 $this->handleQuestionPostponing($lastSequenceElement);
600 }
601
602 if (!$this->isValidSequenceElement($nextSequenceElement)) {
603 $nextSequenceElement = $this->testSequence->getFirstSequence();
604 }
605
606 $this->ctrl->setParameter($this, 'sequence', $nextSequenceElement);
607 $this->ctrl->setParameter($this, 'pmode', '');
608
609 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
610 }
handleQuestionPostponing($sequenceElement)
isValidSequenceElement($sequenceElement)

References ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\getCurrentSequenceElement(), handleCheckTestPassValid(), handleQuestionPostponing(), isValidSequenceElement(), ILIAS\Repository\object(), and ilTestPlayerCommands\SHOW_QUESTION.

+ Here is the call graph for this function:

◆ performTearsAndAngerBrokenConfessionChecks()

ilTestOutputGUI::performTearsAndAngerBrokenConfessionChecks ( )
protected

Definition at line 775 of file class.ilTestOutputGUI.php.

775 : bool
776 {
777 if ($this->testSession->getActiveId() > 0) {
778 if ($this->testSequence->hasRandomQuestionsForPass($this->testSession->getActiveId(), $this->testSession->getPass()) > 0) {
779 // Something went wrong. Maybe the user pressed the start button twice
780 // Questions already exist so there is no need to create new questions
781
782 global $DIC;
783 $ilLog = $DIC['ilLog'];
784 $ilUser = $DIC['ilUser'];
785
786 $ilLog->write(
787 __METHOD__ . ' Random Questions allready exists for user ' .
788 $ilUser->getId() . ' in test ' . $this->object->getTestId()
789 );
790
791 return true;
792 }
793 } else {
794 // This may not happen! If it happens, raise a fatal error...
795
796 global $DIC;
797 $ilLog = $DIC['ilLog'];
798 $ilUser = $DIC['ilUser'];
799
800 $ilLog->write(__METHOD__ . ' ' . sprintf(
801 $this->lng->txt("error_random_question_generation"),
802 $ilUser->getId(),
803 $this->object->getTestId()
804 ));
805
806 return true;
807 };
808
809 return false;
810 }

References $DIC, $ilUser, and ILIAS\Repository\lng().

Referenced by generateRandomTestPassForActiveUser().

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

◆ populateQuestionOptionalMessage()

ilTestOutputGUI::populateQuestionOptionalMessage ( )
abstractprotected

Reimplemented in ilTestPlayerFixedQuestionSetGUI, and ilTestPlayerRandomQuestionSetGUI.

Referenced by showQuestionCmd().

+ Here is the caller graph for this function:

◆ previousQuestionCmd()

ilTestOutputGUI::previousQuestionCmd ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 612 of file class.ilTestOutputGUI.php.

613 {
615
616 $sequenceElement = $this->testSequence->getPreviousSequence(
618 );
619
620 if (!$this->isValidSequenceElement($sequenceElement)) {
621 $sequenceElement = $this->testSequence->getLastSequence();
622 }
623
624 $this->ctrl->setParameter($this, 'sequence', $sequenceElement);
625 $this->ctrl->setParameter($this, 'pmode', '');
626
627 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
628 }

References ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\getCurrentSequenceElement(), handleCheckTestPassValid(), isValidSequenceElement(), and ilTestPlayerCommands\SHOW_QUESTION.

+ Here is the call graph for this function:

◆ resumePlayerCmd()

ilTestOutputGUI::resumePlayerCmd ( )
protected

Resume a test at the last position.

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 841 of file class.ilTestOutputGUI.php.

842 {
843 $this->handleUserSettings();
844
845 $active_id = $this->testSession->getActiveId();
846 $this->ctrl->setParameter($this, "active_id", $active_id);
847
848 $active_time_id = $this->object->startWorkingTime($active_id, $this->testSession->getPass());
849 ilSession::set("active_time_id", $active_time_id);
850 ilSession::set('tst_pass_finish', 0);
851
852 if ($this->object->isRandomTest()) {
853 if (!$this->testSequence->hasRandomQuestionsForPass($active_id, $this->testSession->getPass())) {
854 // create a new set of random questions
856 }
857 }
858
859 $shuffle = $this->object->getShuffleQuestions();
860 if ($this->object->isRandomTest()) {
861 $shuffle = false;
862 }
863
864 assQuestion::_updateTestPassResults(
865 $active_id,
866 $this->testSession->getPass(),
867 $this->object->areObligationsEnabled(),
868 null,
869 $this->object->getId()
870 );
871
872 // ensure existing test sequence
873 if (!$this->testSequence->hasSequence()) {
874 $this->testSequence->createNewSequence($this->object->getQuestionCount(), $shuffle);
875 $this->testSequence->saveToDb();
876 }
877
878 if ($this->object->getListOfQuestionsStart()) {
879 $this->ctrl->redirect($this, ilTestPlayerCommands::QUESTION_SUMMARY);
880 }
881
882 $this->ctrl->setParameter($this, 'sequence', $this->testSession->getLastSequence());
883 $this->ctrl->setParameter($this, 'pmode', '');
884 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
885 }
static set(string $a_var, $a_val)
Set a value.
handleUserSettings()
Handles some form parameters on starting and resuming a test.

References ILIAS\Repository\ctrl(), generateRandomTestPassForActiveUser(), ilTestPlayerAbstractGUI\handleUserSettings(), ILIAS\Repository\object(), ilTestPlayerCommands\QUESTION_SUMMARY, ilSession\set(), and ilTestPlayerCommands\SHOW_QUESTION.

+ Here is the call graph for this function:

◆ saveQuestionSolution()

ilTestOutputGUI::saveQuestionSolution (   $authorized = true,
  $force = false 
)

saves the user input of a question

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 661 of file class.ilTestOutputGUI.php.

661 : bool
662 {
663 $this->updateWorkingTime();
664 $this->saveResult = false;
665 if (!$force) {
666 $formtimestamp = $_POST["formtimestamp"] ?? '';
667 if (strlen($formtimestamp) == 0) {
668 $formtimestamp = $this->testrequest->raw("formtimestamp");
669 }
670 if (ilSession::get('formtimestamp') == null || $formtimestamp != ilSession::get("formtimestamp")) {
671 ilSession::set("formtimestamp", $formtimestamp);
672 } else {
673 return false;
674 }
675 }
676
677 /*
678 #21097 - exceed maximum passes
679 this is a battle of conditions; e.g. ilTestPlayerAbstractGUI::autosaveOnTimeLimitCmd forces saving of results.
680 However, if an admin has finished the pass in the meantime, a new pass should not be created.
681 */
682 if ($force && $this->isNrOfTriesReached()) {
683 $force = false;
684 }
685
686 // save question solution
687 if ($this->canSaveResult() || $force) {
688 // but only if the ending time is not reached
689 $q_id = $this->testSequence->getQuestionForSequence($this->testrequest->raw("sequence"));
690
691 if ($this->isParticipantsAnswerFixed($q_id)) {
692 // should only be reached by firebugging the disabled form in ui
693 throw new ilTestException('not allowed request');
694 }
695
696 if (is_numeric($q_id) && (int) $q_id) {
697 $questionOBJ = $this->getQuestionInstance($q_id);
698
699 $active_id = (int) $this->testSession->getActiveId();
700 $pass = ilObjTest::_getPass($active_id);
701 $this->saveResult = $questionOBJ->persistWorkingState(
702 $active_id,
703 $pass,
704 $this->object->areObligationsEnabled(),
705 $authorized
706 );
707
708 if ($authorized && $this->testSession->isObjectiveOriented()) {
709 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($this->testSession);
710 $objectivesAdapter->updateQuestionResult($this->testSession, $questionOBJ);
711 }
712
713 if ($authorized && $this->object->isSkillServiceToBeConsidered()) {
714 $this->handleSkillTriggering($this->testSession);
715 }
716 }
717 }
718
719 if ($this->saveResult == false || (!$questionOBJ->validateSolutionSubmit() && $questionOBJ->savePartial())) {
720 $this->ctrl->setParameter($this, "save_error", "1");
721 ilSession::set("previouspost", $_POST);
722 }
723
724 return $this->saveResult;
725 }
static getInstance(ilTestSession $a_test_session)
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
static get(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
canSaveResult()
Returns TRUE if the answers of the current user could be saved.
handleSkillTriggering(ilTestSession $testSession)

References ilTestPlayerAbstractGUI\$saveResult, ilObjTest\_getPass(), canSaveResult(), ILIAS\Repository\ctrl(), ilSession\get(), ilLOTestQuestionAdapter\getInstance(), ilTestPlayerAbstractGUI\getQuestionInstance(), ilTestPlayerAbstractGUI\handleSkillTriggering(), ILIAS\Repository\int(), ilTestPlayerAbstractGUI\isNrOfTriesReached(), ilTestPlayerAbstractGUI\isParticipantsAnswerFixed(), ILIAS\Repository\object(), ilSession\set(), and ilTestPlayerAbstractGUI\updateWorkingTime().

Referenced by handleQuestionActionCmd(), showInstantResponseCmd(), submitSolutionAndNextCmd(), and submitSolutionCmd().

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

◆ showInstantResponseCmd()

ilTestOutputGUI::showInstantResponseCmd ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 727 of file class.ilTestOutputGUI.php.

728 {
729 $questionId = $this->testSequence->getQuestionForSequence(
731 );
732
733 if (!$this->isParticipantsAnswerFixed($questionId)) {
734 if ($this->saveQuestionSolution(true)) {
736 $this->setAnswerChangedParameter(false);
737 } else {
738 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
739 }
740 $this->testSequence->setQuestionChecked($questionId);
741 $this->testSequence->saveToDb();
742 } elseif ($this->object->isForceInstantFeedbackEnabled()) {
743 $this->testSequence->setQuestionChecked($questionId);
744 $this->testSequence->saveToDb();
745 }
746
747 $this->ctrl->setParameter($this, 'instresp', 1);
748
749 // fau: testNav - handle navigation after feedback
750 if ($this->getNavigationUrlParameter()) {
753 }
754 // fau.
755 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
756 }
removeIntermediateSolution()
remove an auto-saved solution of the current question
saveNavigationPreventConfirmation()
Save the save the switch to prevent the navigation confirmation.
registerForcedFeedbackNavUrl($forcedFeedbackNavUrl)

References ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\getCurrentSequenceElement(), ilTestPlayerAbstractGUI\getNavigationUrlParameter(), ilTestPlayerAbstractGUI\isParticipantsAnswerFixed(), ILIAS\Repository\object(), ilTestPlayerAbstractGUI\registerForcedFeedbackNavUrl(), ilTestPlayerAbstractGUI\removeIntermediateSolution(), ilTestPlayerAbstractGUI\saveNavigationPreventConfirmation(), saveQuestionSolution(), ilTestPlayerAbstractGUI\setAnswerChangedParameter(), and ilTestPlayerCommands\SHOW_QUESTION.

+ Here is the call graph for this function:

◆ showQuestionCmd()

ilTestOutputGUI::showQuestionCmd ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 296 of file class.ilTestOutputGUI.php.

297 {
298 ilSession::set('tst_pass_finish', 0);
299
301 "active_time_id",
302 $this->object->startWorkingTime(
303 $this->testSession->getActiveId(),
304 $this->testSession->getPass()
305 )
306 );
307
308 global $DIC;
309 $help = $DIC->help();
310 $help->setScreenIdComponent("tst");
311 $help->setScreenId("assessment");
312 $help->setSubScreenId("question");
313
314 $sequenceElement = $this->getCurrentSequenceElement();
315
316 if (!$this->isValidSequenceElement($sequenceElement)) {
317 $sequenceElement = $this->testSequence->getFirstSequence();
318 }
319
320 $this->testSession->setLastSequence($sequenceElement);
321 $this->testSession->saveToDb();
322
323
324 $questionId = $this->testSequence->getQuestionForSequence($sequenceElement);
325
326 if (!(int) $questionId && $this->testSession->isObjectiveOriented()) {
328 }
329
330 if (!$this->testSequence->isQuestionPresented($questionId)) {
331 $this->testSequence->setQuestionPresented($questionId);
332 $this->testSequence->saveToDb();
333 }
334
335 $isQuestionWorkedThrough = assQuestion::_isWorkedThrough(
336 $this->testSession->getActiveId(),
337 $questionId,
338 $this->testSession->getPass()
339 );
340
341 // fau: testNav - always use edit mode, except for fixed answer
342 if ($this->isParticipantsAnswerFixed($questionId)) {
344 $instantResponse = true;
345 } else {
347 // #37025 don't show instant response if a request for it should fix the answer and answer is not yet fixed
348 if ($this->object->isInstantFeedbackAnswerFixationEnabled()) {
349 $instantResponse = false;
350 } else {
351 $instantResponse = $this->getInstantResponseParameter();
352 }
353 }
354 // fau.
355
356 $questionGui = $this->getQuestionGuiInstance($questionId);
357
358 if (!($questionGui instanceof assQuestionGUI)) {
359 $this->handleTearsAndAngerQuestionIsNull($questionId, $sequenceElement);
360 }
361
362 $questionGui->setSequenceNumber($this->testSequence->getPositionOfSequence($sequenceElement));
363 $questionGui->setQuestionCount($this->testSequence->getUserQuestionCount());
364
365 $headerBlockBuilder = new ilTestQuestionHeaderBlockBuilder($this->lng);
366 $headerBlockBuilder->setHeaderMode($this->object->getTitleOutput());
367 $headerBlockBuilder->setQuestionTitle($questionGui->object->getTitleForHTMLOutput());
368 $headerBlockBuilder->setQuestionPoints($questionGui->object->getPoints());
369 $headerBlockBuilder->setQuestionPosition($this->testSequence->getPositionOfSequence($sequenceElement));
370 $headerBlockBuilder->setQuestionCount($this->testSequence->getUserQuestionCount());
371 $headerBlockBuilder->setQuestionPostponed($this->testSequence->isPostponedQuestion($questionId));
372 $headerBlockBuilder->setQuestionObligatory(
373 $this->object->areObligationsEnabled() && ilObjTest::isQuestionObligatory($questionGui->object->getId())
374 );
375 if ($this->testSession->isObjectiveOriented()) {
376 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($this->testSession);
377 $objectivesAdapter->buildQuestionRelatedObjectiveList($this->testSequence, $this->questionRelatedObjectivesList);
378 $this->questionRelatedObjectivesList->loadObjectivesTitles();
379
380 $objectivesString = $this->questionRelatedObjectivesList->getQuestionRelatedObjectiveTitles($questionId);
381 $headerBlockBuilder->setQuestionRelatedObjectives($objectivesString);
382 }
383 $questionGui->setQuestionHeaderBlockBuilder($headerBlockBuilder);
384
385 $this->prepareTestPage($presentationMode, $sequenceElement, $questionId);
386
387 $navigationToolbarGUI = $this->getTestNavigationToolbarGUI();
388 $navigationToolbarGUI->setFinishTestButtonEnabled(true);
389
390 $isNextPrimary = $this->handlePrimaryButton($navigationToolbarGUI, $questionId);
391
392 $this->ctrl->setParameter($this, 'sequence', $sequenceElement);
393 $this->ctrl->setParameter($this, 'pmode', $presentationMode);
394 $formAction = $this->ctrl->getFormAction($this, ilTestPlayerCommands::SUBMIT_INTERMEDIATE_SOLUTION);
395
396 switch ($presentationMode) {
398
399 // fau: testNav - enable navigation toolbar in edit mode
400 $navigationToolbarGUI->setDisabledStateEnabled(false);
401 // fau.
402 $this->showQuestionEditable($questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse);
403
404 break;
405
407
408 if ($this->testSequence->isQuestionOptional($questionGui->object->getId())) {
410 }
411
412 $this->showQuestionViewable($questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse);
413
414 break;
415
416 default:
417 throw new ilTestException('no presentation mode given');
418 }
419
420 $navigationToolbarGUI->build();
421 $this->populateTestNavigationToolbar($navigationToolbarGUI);
422
423 // fau: testNav - enable the question navigation in edit mode
424 $this->populateQuestionNavigation($sequenceElement, false, $isNextPrimary);
425 // fau.
426
427 if ($instantResponse) {
428 // fau: testNav - always use authorized solution for instant feedback
430 $questionGui,
431 true
432 );
433 // fau.
434 }
435
436 // fau: testNav - add feedback modal
440 }
441 // fau.
442 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
handlePrimaryButton(ilTestNavigationToolbarGUI $navigationToolbarGUI, $currentQuestionId)
populateQuestionOptionalMessage()
prepareTestPage($presentationMode, $sequenceElement, $questionId)
handleTearsAndAngerQuestionIsNull($questionId, $sequenceElement)
getQuestionGuiInstance($question_id, $fromCache=true)
populateInstantResponseModal(assQuestionGUI $questionGui, $navUrl)
showQuestionEditable(assQuestionGUI $questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse)
populateInstantResponseBlocks(assQuestionGUI $questionGui, $authorizedSolution)
populateTestNavigationToolbar(ilTestNavigationToolbarGUI $toolbarGUI)
populateQuestionNavigation($sequenceElement, $disabled, $primaryNext)
showQuestionViewable(assQuestionGUI $questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse)

References $DIC, assQuestion\_isWorkedThrough(), ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\getCurrentSequenceElement(), ilLOTestQuestionAdapter\getInstance(), ilTestPlayerAbstractGUI\getInstantResponseParameter(), ilTestPlayerAbstractGUI\getQuestionGuiInstance(), ilTestPlayerAbstractGUI\getRegisteredForcedFeedbackNavUrl(), ilTestPlayerAbstractGUI\getTestNavigationToolbarGUI(), handlePrimaryButton(), handleTearsAndAngerNoObjectiveOrientedQuestion(), ilTestPlayerAbstractGUI\handleTearsAndAngerQuestionIsNull(), ilTestPlayerAbstractGUI\isForcedFeedbackNavUrlRegistered(), ilTestPlayerAbstractGUI\isParticipantsAnswerFixed(), ilObjTest\isQuestionObligatory(), isValidSequenceElement(), ILIAS\Repository\lng(), ILIAS\Repository\object(), ilTestPlayerAbstractGUI\populateInstantResponseBlocks(), ilTestPlayerAbstractGUI\populateInstantResponseModal(), ilTestPlayerAbstractGUI\populateQuestionNavigation(), populateQuestionOptionalMessage(), ilTestPlayerAbstractGUI\populateTestNavigationToolbar(), ilTestPlayerAbstractGUI\prepareTestPage(), ilTestPlayerAbstractGUI\PRESENTATION_MODE_EDIT, ilTestPlayerAbstractGUI\PRESENTATION_MODE_VIEW, ilSession\set(), ilTestPlayerAbstractGUI\showQuestionEditable(), ilTestPlayerAbstractGUI\showQuestionViewable(), ilTestPlayerCommands\SUBMIT_INTERMEDIATE_SOLUTION, and ilTestPlayerAbstractGUI\unregisterForcedFeedbackNavUrl().

+ Here is the call graph for this function:

◆ skipQuestionCmd()

ilTestOutputGUI::skipQuestionCmd ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 544 of file class.ilTestOutputGUI.php.

545 {
546 $curSequenceElement = $this->getCurrentSequenceElement();
547 $nextSequenceElement = $this->testSequence->getNextSequence($curSequenceElement);
548
549 if (!$this->isValidSequenceElement($nextSequenceElement)) {
550 $nextSequenceElement = $this->testSequence->getFirstSequence();
551 }
552
553 if ($this->object->isPostponingEnabled()) {
554 $this->testSequence->postponeSequence($curSequenceElement);
555 $this->testSequence->saveToDb();
556 }
557
558 $this->ctrl->setParameter($this, 'sequence', $nextSequenceElement);
559 $this->ctrl->setParameter($this, 'pmode', '');
560
561 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
562 }

References ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\getCurrentSequenceElement(), isValidSequenceElement(), ILIAS\Repository\object(), and ilTestPlayerCommands\SHOW_QUESTION.

+ Here is the call graph for this function:

◆ startTestCmd()

ilTestOutputGUI::startTestCmd ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 186 of file class.ilTestOutputGUI.php.

187 {
188 global $DIC;
189 $ilUser = $DIC['ilUser'];
190
191 ilSession::set('tst_pass_finish', 0);
192
193 // ensure existing test session
194 $this->testSession->setUserId($ilUser->getId());
195 $access_code = ilSession::get('tst_access_code');
196 if ($access_code != null && isset($access_code[$this->object->getTestId()])) {
197 $this->testSession->setAnonymousId((int) $access_code[$this->object->getTestId()]);
198 }
199 if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) {
200 $this->testSession->setObjectiveOrientedContainerId($this->getObjectiveOrientedContainer()->getObjId());
201 }
202 $this->testSession->saveToDb();
203
204 $active_id = $this->testSession->getActiveId();
205 $this->ctrl->setParameter($this, "active_id", $active_id);
206
207 $shuffle = $this->object->getShuffleQuestions();
208 if ($this->object->isRandomTest()) {
210
211 $this->object->loadQuestions();
212 $shuffle = false; // shuffle is already done during the creation of the random questions
213 }
214
215 assQuestion::_updateTestPassResults(
216 $active_id,
217 $this->testSession->getPass(),
218 $this->object->areObligationsEnabled(),
219 null,
220 $this->object->getId()
221 );
222
223 // ensure existing test sequence
224 if (!$this->testSequence->hasSequence()) {
225 $this->testSequence->createNewSequence($this->object->getQuestionCount(), $shuffle);
226 $this->testSequence->saveToDb();
227 }
228
229 $this->testSequence->loadFromDb();
230 $this->testSequence->loadQuestions();
231
232 if ($this->testSession->isObjectiveOriented()) {
233 $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($this->testSession);
234
235 $objectivesAdapter->notifyTestStart($this->testSession, $this->object->getId());
236 $objectivesAdapter->prepareTestPass($this->testSession, $this->testSequence);
237
238 $objectivesAdapter->buildQuestionRelatedObjectiveList(
239 $this->testSequence,
240 $this->questionRelatedObjectivesList
241 );
242
243 if ($this->testSequence->hasOptionalQuestions()) {
245
246 $this->testSequence->reorderOptionalQuestionsToSequenceEnd();
247 $this->testSequence->saveToDb();
248 }
249 }
250
251 $active_time_id = $this->object->startWorkingTime(
252 $this->testSession->getActiveId(),
253 $this->testSession->getPass()
254 );
255 ilSession::set("active_time_id", $active_time_id);
256
258
259 $sequenceElement = $this->testSequence->getFirstSequence();
260
261 $this->ctrl->setParameter($this, 'sequence', $sequenceElement);
262 $this->ctrl->setParameter($this, 'pmode', '');
263
264 if ($this->object->getListOfQuestionsStart()) {
265 $this->ctrl->redirect($this, ilTestPlayerCommands::QUESTION_SUMMARY);
266 }
267
268 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
269 }

References $DIC, $ilUser, adoptUserSolutionsFromPreviousPass(), ILIAS\Repository\ctrl(), generateRandomTestPassForActiveUser(), ilSession\get(), ilLOTestQuestionAdapter\getInstance(), ilTestServiceGUI\getObjectiveOrientedContainer(), ILIAS\Repository\object(), ilTestPlayerCommands\QUESTION_SUMMARY, ilSession\set(), ilTestPlayerCommands\SHOW_QUESTION, and updateLearningProgressOnTestStart().

+ Here is the call graph for this function:

◆ submitSolutionAndNextCmd()

ilTestOutputGUI::submitSolutionAndNextCmd ( )
protected

Definition at line 450 of file class.ilTestOutputGUI.php.

451 {
452 if ($this->object->isForceInstantFeedbackEnabled()) {
453 $this->submitSolutionCmd();
454 return;
455 }
456
457 if ($this->saveQuestionSolution(true, false)) {
458 $questionId = $this->testSequence->getQuestionForSequence(
460 );
461
463
464 $nextSequenceElement = $this->testSequence->getNextSequence($this->getCurrentSequenceElement());
465
466 if (!$this->isValidSequenceElement($nextSequenceElement)) {
467 $nextSequenceElement = $this->testSequence->getFirstSequence();
468 }
469
470 $this->testSession->setLastSequence($nextSequenceElement);
471 $this->testSession->saveToDb();
472
473 $this->ctrl->setParameter($this, 'sequence', $nextSequenceElement);
474 $this->ctrl->setParameter($this, 'pmode', '');
475 }
476
477 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
478 }

References ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\getCurrentSequenceElement(), isValidSequenceElement(), ILIAS\Repository\object(), ilTestPlayerAbstractGUI\removeIntermediateSolution(), saveQuestionSolution(), ilTestPlayerCommands\SHOW_QUESTION, and submitSolutionCmd().

+ Here is the call graph for this function:

◆ submitSolutionCmd()

ilTestOutputGUI::submitSolutionCmd ( )
protected

Reimplemented from ilTestPlayerAbstractGUI.

Definition at line 480 of file class.ilTestOutputGUI.php.

481 {
482 if ($this->saveQuestionSolution(true, false)) {
483 $questionId = $this->testSequence->getQuestionForSequence(
485 );
486
488
489 if ($this->object->isForceInstantFeedbackEnabled()) {
490 $this->ctrl->setParameter($this, 'instresp', 1);
491
492 $this->testSequence->setQuestionChecked($questionId);
493 $this->testSequence->saveToDb();
494 }
495
496 if ($this->getNextCommandParameter()) {
497 if ($this->getNextSequenceParameter()) {
498 $this->ctrl->setParameter($this, 'sequence', $this->getNextSequenceParameter());
499 $this->ctrl->setParameter($this, 'pmode', '');
500 }
501
502 $this->ctrl->redirect($this, $this->getNextCommandParameter());
503 }
504
505 $this->ctrl->setParameter($this, 'pmode', ilTestPlayerAbstractGUI::PRESENTATION_MODE_VIEW);
506 } else {
507 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
508 }
509
510 // fau: testNav - remember to prevent the navigation confirmation
512 // fau.
513
514 // fau: testNav - handle navigation after saving
515 if ($this->getNavigationUrlParameter()) {
517 } else {
518 $this->ctrl->saveParameter($this, 'sequence');
519 }
520 // fau.
521 $this->ctrl->redirect($this, ilTestPlayerCommands::SHOW_QUESTION);
522 }
static redirect(string $a_script)

References ILIAS\Repository\ctrl(), ilTestPlayerAbstractGUI\getCurrentSequenceElement(), ilTestPlayerAbstractGUI\getNavigationUrlParameter(), ilTestPlayerAbstractGUI\getNextCommandParameter(), ilTestPlayerAbstractGUI\getNextSequenceParameter(), ILIAS\Repository\object(), ilTestPlayerAbstractGUI\PRESENTATION_MODE_VIEW, ilUtil\redirect(), ilTestPlayerAbstractGUI\removeIntermediateSolution(), ilTestPlayerAbstractGUI\saveNavigationPreventConfirmation(), saveQuestionSolution(), and ilTestPlayerCommands\SHOW_QUESTION.

Referenced by submitSolutionAndNextCmd().

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

◆ updateLearningProgressOnTestStart()

ilTestOutputGUI::updateLearningProgressOnTestStart ( )
protected

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

272 {
273 global $DIC;
274 $ilUser = $DIC['ilUser'];
275
276 ilLPStatusWrapper::_updateStatus($this->object->getId(), $ilUser->getId());
277 }
static _updateStatus(int $a_obj_id, int $a_usr_id, ?object $a_obj=null, bool $a_percentage=false, bool $a_force_raise=false)

References $DIC, $ilUser, ilLPStatusWrapper\_updateStatus(), and ILIAS\Repository\object().

Referenced by startTestCmd().

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

Field Documentation

◆ $questionRelatedObjectivesList

ilTestOutputGUI::$questionRelatedObjectivesList
protected

Definition at line 38 of file class.ilTestOutputGUI.php.


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