4 require_once
'./Modules/Test/classes/class.ilTestPlayerAbstractGUI.php';
32 global
$ilDB, $ilPluginAdmin,
$lng, $ilTabs;
36 $ilTabs->clearTargets();
38 $cmd = $this->ctrl->getCmd();
39 $next_class = $this->ctrl->getNextClass($this);
41 $this->ctrl->saveParameter($this,
"sequence");
42 $this->ctrl->saveParameter($this,
"pmode");
43 $this->ctrl->saveParameter($this,
"active_id");
56 $this->testSequence = $testSequenceFactory->getSequenceByTestSession($this->testSession);
57 $this->testSequence->loadFromDb();
58 $this->testSequence->loadQuestions();
60 require_once
'Modules/Test/classes/class.ilTestQuestionRelatedObjectivesList.php';
63 include_once
'Services/jQuery/classes/class.iljQueryUtil.php';
65 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
72 switch ($next_class) {
73 case 'ilassquestionpagegui':
79 require_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
81 $ret = $this->ctrl->forwardCommand($page_gui);
84 case 'iltestsubmissionreviewgui':
88 require_once
'./Modules/Test/classes/class.ilTestSubmissionReviewGUI.php';
91 $ret = $this->ctrl->forwardCommand($gui);
94 case 'ilassquestionhintrequestgui':
98 $questionGUI = $this->
object->createQuestionGUI(
100 $this->testSequence->getQuestionForSequence($this->getCurrentSequenceElement())
103 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
105 $questionGUI->object->getId(),
106 $this->testSession->getActiveId(),
107 $this->testSession->getPass()
110 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
116 $ret = $this->ctrl->forwardCommand($gui);
120 case 'iltestsignaturegui':
124 require_once
'./Modules/Test/classes/class.ilTestSignatureGUI.php';
126 $ret = $this->ctrl->forwardCommand($gui);
129 case 'iltestpasswordprotectiongui':
133 require_once
'Modules/Test/classes/class.ilTestPasswordProtectionGUI.php';
135 $ret = $this->ctrl->forwardCommand($gui);
145 $ret =&$this->$cmd();
158 $this->testSession->setUserId($ilUser->getId());
159 $this->testSession->setAnonymousId(
$_SESSION[
"tst_access_code"][$this->
object->getTestId()]);
161 $this->testSession->saveToDb();
163 $active_id = $this->testSession->getActiveId();
164 $this->ctrl->setParameter($this,
"active_id", $active_id);
166 $shuffle = $this->
object->getShuffleQuestions();
167 if ($this->
object->isRandomTest()) {
170 $this->
object->loadQuestions();
174 assQuestion::_updateTestPassResults(
176 $this->testSession->getPass(),
177 $this->
object->areObligationsEnabled(),
183 if (!$this->testSequence->hasSequence()) {
184 $this->testSequence->createNewSequence($this->
object->getQuestionCount(), $shuffle);
185 $this->testSequence->saveToDb();
188 $this->testSequence->loadFromDb();
189 $this->testSequence->loadQuestions();
191 if ($this->testSession->isObjectiveOriented()) {
192 require_once
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
195 $objectivesAdapter->notifyTestStart($this->testSession, $this->
object->getId());
196 $objectivesAdapter->prepareTestPass($this->testSession, $this->testSequence);
198 $objectivesAdapter->buildQuestionRelatedObjectiveList(
200 $this->questionRelatedObjectivesList
203 if ($this->testSequence->hasOptionalQuestions()) {
206 $this->testSequence->reorderOptionalQuestionsToSequenceEnd();
207 $this->testSequence->saveToDb();
211 $active_time_id = $this->
object->startWorkingTime(
212 $this->testSession->getActiveId(),
213 $this->testSession->getPass()
215 $_SESSION[
"active_time_id"] = $active_time_id;
219 $sequenceElement = $this->testSequence->getFirstSequence();
221 $this->ctrl->setParameter($this,
'sequence', $sequenceElement);
222 $this->ctrl->setParameter($this,
'pmode',
'');
224 if ($this->
object->getListOfQuestionsStart()) {
235 require_once(
'./Modules/Test/classes/class.ilObjTestAccess.php');
236 require_once(
'./Services/Tracking/classes/class.ilLPStatusWrapper.php');
242 if ($sequenceElement ===
false) {
246 if ($sequenceElement < 1) {
250 if (!$this->testSequence->getPositionOfSequence($sequenceElement)) {
261 $_SESSION[
"active_time_id"]= $this->
object->startWorkingTime(
262 $this->testSession->getActiveId(),
263 $this->testSession->getPass()
269 $sequenceElement = $this->testSequence->getFirstSequence();
272 $this->testSession->setLastSequence($sequenceElement);
273 $this->testSession->saveToDb();
276 $questionId = $this->testSequence->getQuestionForSequence($sequenceElement);
278 if (!(
int) $questionId && $this->testSession->isObjectiveOriented()) {
283 $this->testSession->getActiveId(),
285 $this->testSession->getPass()
291 $instantResponse =
true;
304 $questionGui->setSequenceNumber($this->testSequence->getPositionOfSequence($sequenceElement));
305 $questionGui->setQuestionCount($this->testSequence->getUserQuestionCount());
307 require_once
'Modules/Test/classes/class.ilTestQuestionHeaderBlockBuilder.php';
309 $headerBlockBuilder->setHeaderMode($this->
object->getTitleOutput());
310 $headerBlockBuilder->setQuestionTitle($questionGui->object->getTitle());
311 $headerBlockBuilder->setQuestionPoints($questionGui->object->getPoints());
312 $headerBlockBuilder->setQuestionPosition($this->testSequence->getPositionOfSequence($sequenceElement));
313 $headerBlockBuilder->setQuestionCount($this->testSequence->getUserQuestionCount());
314 $headerBlockBuilder->setQuestionPostponed($this->testSequence->isPostponedQuestion($questionId));
315 $headerBlockBuilder->setQuestionObligatory(
318 if ($this->testSession->isObjectiveOriented()) {
319 require_once
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
321 $objectivesAdapter->buildQuestionRelatedObjectiveList($this->testSequence, $this->questionRelatedObjectivesList);
322 $this->questionRelatedObjectivesList->loadObjectivesTitles();
324 $objectivesString = $this->questionRelatedObjectivesList->getQuestionRelatedObjectiveTitles($questionId);
325 $headerBlockBuilder->setQuestionRelatedObjectives($objectivesString);
327 $questionGui->setQuestionHeaderBlockBuilder($headerBlockBuilder);
329 $this->
prepareTestPage($presentationMode, $sequenceElement, $questionId);
332 $navigationToolbarGUI->setFinishTestButtonEnabled(
true);
336 $this->ctrl->setParameter($this,
'sequence', $sequenceElement);
337 $this->ctrl->setParameter($this,
'pmode', $presentationMode);
340 switch ($presentationMode) {
344 $navigationToolbarGUI->setDisabledStateEnabled(
false);
346 $this->
showQuestionEditable($questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse);
352 if ($this->testSequence->isQuestionOptional($questionGui->object->getId())) {
356 $this->
showQuestionViewable($questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse);
362 require_once
'Modules/Test/exceptions/class.ilTestException.php';
366 $navigationToolbarGUI->build();
373 if ($instantResponse) {
398 if ($this->
object->isForceInstantFeedbackEnabled()) {
403 $questionId = $this->testSequence->getQuestionForSequence(
412 $nextSequenceElement = $this->testSequence->getFirstSequence();
415 $this->testSession->setLastSequence($nextSequenceElement);
416 $this->testSession->saveToDb();
418 $this->ctrl->setParameter($this,
'sequence', $nextSequenceElement);
419 $this->ctrl->setParameter($this,
'pmode',
'');
428 $questionId = $this->testSequence->getQuestionForSequence(
434 if ($this->
object->isForceInstantFeedbackEnabled()) {
435 $this->ctrl->setParameter($this,
'instresp', 1);
437 $this->testSequence->setQuestionChecked($questionId);
438 $this->testSequence->saveToDb();
444 $this->ctrl->setParameter($this,
'pmode',
'');
463 $this->ctrl->saveParameter($this,
'sequence');
474 $this->testSequence->getQuestionForSequence($currentSequenceElement)
477 $currentQuestionOBJ->resetUsersAnswer(
478 $this->testSession->getActiveId(),
479 $this->testSession->getPass()
482 $this->ctrl->saveParameter($this,
'sequence');
492 $nextSequenceElement = $this->testSequence->getNextSequence($curSequenceElement);
495 $nextSequenceElement = $this->testSequence->getFirstSequence();
498 if ($this->
object->isPostponingEnabled()) {
499 $this->testSequence->postponeSequence($curSequenceElement);
500 $this->testSequence->saveToDb();
503 $this->ctrl->setParameter($this,
'sequence', $nextSequenceElement);
504 $this->ctrl->setParameter($this,
'pmode',
'');
511 $questionId = $this->testSequence->getQuestionForSequence($sequenceElement);
514 $this->testSession->getActiveId(),
516 $this->testSession->getPass()
519 if (!$isQuestionWorkedThrough) {
520 $this->testSequence->postponeQuestion($questionId);
521 $this->testSequence->saveToDb();
528 $nextSequenceElement = $this->testSequence->getNextSequence($lastSequenceElement);
530 if ($this->
object->isPostponingEnabled()) {
535 $nextSequenceElement = $this->testSequence->getFirstSequence();
538 $this->ctrl->setParameter($this,
'sequence', $nextSequenceElement);
539 $this->ctrl->setParameter($this,
'pmode',
'');
546 $sequenceElement = $this->testSequence->getPreviousSequence(
551 $sequenceElement = $this->testSequence->getLastSequence();
554 $this->ctrl->setParameter($this,
'sequence', $sequenceElement);
555 $this->ctrl->setParameter($this,
'pmode',
'');
562 return $sequenceElement == $this->testSequence->getFirstSequence();
567 return $sequenceElement == $this->testSequence->getLastSequence();
585 return $this->testSequence->getQuestionForSequence(
$_GET[
"sequence"]);
594 $this->saveResult =
false;
596 $formtimestamp =
$_POST[
"formtimestamp"];
597 if (strlen($formtimestamp) == 0) {
598 $formtimestamp =
$_GET[
"formtimestamp"];
600 if ($formtimestamp !=
$_SESSION[
"formtimestamp"]) {
601 $_SESSION[
"formtimestamp"] = $formtimestamp;
609 $q_id = $this->testSequence->getQuestionForSequence(
$_GET[
"sequence"]);
610 if (is_numeric($q_id) && (
int) $q_id) {
613 $active_id = $this->testSession->getActiveId();
614 if ($this->
object->isRandomTest()) {
617 $this->saveResult = $questionOBJ->persistWorkingState(
620 $this->
object->areObligationsEnabled(),
624 if ($authorized && $this->testSession->isObjectiveOriented()) {
625 require_once
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
627 $objectivesAdapter->updateQuestionResult($this->testSession, $questionOBJ);
630 if ($authorized && $this->
object->isSkillServiceToBeConsidered()) {
636 if ($this->saveResult ==
false) {
637 $this->ctrl->setParameter($this,
"save_error",
"1");
646 $questionId = $this->testSequence->getQuestionForSequence(
657 $this->testSequence->setQuestionChecked($questionId);
658 $this->testSequence->saveToDb();
661 $this->ctrl->setParameter($this,
'instresp', 1);
674 $questionId = $this->testSequence->getQuestionForSequence(
691 if ($this->testSession->getActiveId() > 0) {
692 if ($this->testSequence->hasRandomQuestionsForPass($this->testSession->getActiveId(), $this->testSession->getPass()) > 0) {
699 __METHOD__ .
' Random Questions allready exists for user ' .
700 $ilUser->getId() .
' in test ' . $this->
object->getTestId()
710 $ilLog->write(__METHOD__ .
' ' . sprintf(
711 $this->lng->txt(
"error_random_question_generation"),
713 $this->
object->getTestId()
726 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetConfig.php';
728 $questionSetConfig->loadFromDb();
730 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
733 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
735 $sourcePoolDefinitionList->loadDefinitions();
737 $this->processLocker->executeRandomPassBuildOperation(
function () use ($ilDB, $ilPluginAdmin, $questionSetConfig, $sourcePoolDefinitionList) {
739 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestionList.php';
742 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilder.php';
745 $questionSetBuilder->performBuild($this->testSession);
747 }, $sourcePoolDefinitionList->hasTaxonomyFilters());
757 $active_id = $this->testSession->getActiveId();
758 $this->ctrl->setParameter($this,
"active_id", $active_id);
760 $active_time_id = $this->
object->startWorkingTime($active_id, $this->testSession->getPass());
761 $_SESSION[
"active_time_id"] = $active_time_id;
764 if ($this->
object->isRandomTest()) {
765 if (!$this->testSequence->hasRandomQuestionsForPass($active_id, $this->testSession->getPass())) {
771 $shuffle = $this->
object->getShuffleQuestions();
772 if ($this->
object->isRandomTest()) {
776 assQuestion::_updateTestPassResults(
778 $this->testSession->getPass(),
779 $this->
object->areObligationsEnabled(),
785 if (!$this->testSequence->hasSequence()) {
786 $this->testSequence->createNewSequence($this->
object->getQuestionCount(), $shuffle);
787 $this->testSequence->saveToDb();
790 if ($this->
object->getListOfQuestionsStart()) {
794 $this->ctrl->setParameter($this,
'sequence', $this->testSession->getLastSequence());
795 $this->ctrl->setParameter($this,
'pmode',
'');
801 return $this->testSequence->isPostponedQuestion($questionId);
810 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
813 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionUserSolutionAdopter.php';
816 $userSolutionAdopter->setUserId($ilUser->getId());
817 $userSolutionAdopter->setActiveId($this->testSession->getActiveId());
818 $userSolutionAdopter->setTargetPass($this->testSequence->getPass());
819 $userSolutionAdopter->setQuestionIds($this->testSequence->getOptionalQuestions());
821 $userSolutionAdopter->perform();
828 if ($this->testSequence->isAnsweringOptionalQuestionsConfirmed()) {
832 $questionId = $this->testSequence->getQuestionForSequence($sequenceKey);
834 if (!$this->testSequence->isQuestionOptional($questionId)) {
848 ilUtil::sendFailure(sprintf($this->lng->txt(
'tst_objective_oriented_test_pass_without_questions'), $this->
object->getTitle()),
true);
858 $isNextPrimary =
true;
860 if ($this->
object->isForceInstantFeedbackEnabled()) {
861 $isNextPrimary =
false;
865 $this->testSession->getActiveId(),
866 $this->testSession->getPass(),
867 $this->testSequence->getOrderedSequenceQuestions()
870 if (!count($questionsMissingResult)) {
872 $isNextPrimary =
false;
873 } elseif (count($questionsMissingResult) == 1) {
874 $lastOpenQuestion = current($questionsMissingResult);
876 if ($currentQuestionId == $lastOpenQuestion) {
878 $isNextPrimary =
false;
882 return $isNextPrimary;
isShowingPostponeStatusReguired($questionId)
checkTestSessionUser(ilTestSession $testSession)
isValidSequenceElement($sequenceElement)
isQuestionSummaryFinishTestButtonRequired()
removeIntermediateSolution()
remove an auto-saved solution of the current question
populateQuestionOptionalMessage()
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
setAnswerChangedParameter($changed=true)
Set the 'answer changed' url parameter for generated links.
static getQuestionsMissingResultRecord($activeId, $pass, $questionIds)
showQuestionEditable(assQuestionGUI $questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse)
getObjectiveOrientedContainer()
Output class for assessment test execution.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
updateWorkingTime()
updates working time and stores state saveresult to see if question has to be stored or not ...
handleTearsAndAngerNoObjectiveOrientedQuestion()
submitSolutionAndNextCmd()
getNextCommandParameter()
isLastQuestionInSequence($sequenceElement)
isFirstQuestionInSequence($sequenceElement)
executeCommand()
Execute Command.
handleQuestionActionCmd()
resumePlayerCmd()
Resume a test at the last position.
handleUserSettings()
Handles some form parameters on starting and resuming a test.
Base Exception for all Exceptions relating to Modules/Test.
prepareTestPage($presentationMode, $sequenceElement, $questionId)
unregisterForcedFeedbackNavUrl()
populateInstantResponseBlocks(assQuestionGUI $questionGui, $authorizedSolution)
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
isNrOfTriesReached()
nr of tries exceeded
ensureExistingTestSession(ilTestSession $testSession)
populateQuestionNavigation($sequenceElement, $disabled, $primaryNext)
static getInstance(ilTestSession $a_test_session)
isForcedFeedbackNavUrlRegistered()
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
getInstantResponseParameter()
isOptionalQuestionAnsweringConfirmationRequired($sequenceKey)
static _isWorkedThrough($active_id, $question_id, $pass=null)
Returns true if the question was worked through in the given pass Worked through means that the user ...
handleSkillTriggering(ilTestSession $testSession)
Class ilTestSubmissionReviewGUI.
handleQuestionPostponing($sequenceElement)
getRegisteredForcedFeedbackNavUrl()
getCommand($cmd)
Retrieves the ilCtrl command.
const PRESENTATION_MODE_EDIT
saveNavigationPreventConfirmation()
Save the save the switch to prevent the navigation confirmation.
populateTestNavigationToolbar(ilTestNavigationToolbarGUI $toolbarGUI)
static getInstance(ilDBInterface $db, ilObjTest $testOBJ, ilTestRandomQuestionSetConfig $questionSetConfig, ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList, ilTestRandomQuestionSetStagingPoolQuestionList $stagingPoolQuestionList)
handlePrimaryButton(ilTestNavigationToolbarGUI $navigationToolbarGUI, $currentQuestionId)
getAnswerChangedParameter()
Get the 'answer changed' status from the current request It may be set by ilTestPlayerNavigationContr...
Basic GUI class for assessment questions.
const PRESENTATION_MODE_VIEW
const SUBMIT_INTERMEDIATE_SOLUTION
initProcessLocker($activeId)
updateLearningProgressOnTestStart()
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
handlePasswordProtectionRedirect()
registerForcedFeedbackNavUrl($forcedFeedbackNavUrl)
saveQuestionSolution($authorized=true, $force=false)
saves the user input of a question
showQuestionViewable(assQuestionGUI $questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse)
performTearsAndAngerBrokenConfessionChecks()
Create new PHPExcel object
obj_idprivate
$questionRelatedObjectivesList
generateRandomTestPassForActiveUser()
populateInstantResponseModal(assQuestionGUI $questionGui, $navUrl)
getNextSequenceParameter()
getNavigationUrlParameter()
getQuestionGuiInstance($questionId, $fromCache=true)
static initjQuery($a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
getQuestionInstance($questionId, $fromCache=true)
handleTearsAndAngerQuestionIsNull($questionId, $sequenceElement)
isMaxProcessingTimeReached()
Checks wheather the maximum processing time is reached or not.
getCurrentSequenceElement()
static redirect($a_script)
getTestNavigationToolbarGUI()
static initConnectionWithAnimation()
Init YUI Connection module.
canSaveResult()
Returns TRUE if the answers of the current user could be saved.
adoptUserSolutionsFromPreviousPass()
static isTestExecutionCommand($cmd)
isParticipantsAnswerFixed($questionId)
Output class for assessment test execution.