4 require_once
'./Modules/Test/classes/class.ilTestPlayerAbstractGUI.php';
34 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
36 $ilTabs = $DIC[
'ilTabs'];
40 $ilTabs->clearTargets();
42 $cmd = $this->ctrl->getCmd();
43 $next_class = $this->ctrl->getNextClass($this);
45 $this->ctrl->saveParameter($this,
"sequence");
46 $this->ctrl->saveParameter($this,
"pmode");
47 $this->ctrl->saveParameter($this,
"active_id");
60 $this->testSequence = $testSequenceFactory->getSequenceByTestSession($this->testSession);
61 $this->testSequence->loadFromDb();
62 $this->testSequence->loadQuestions();
64 require_once
'Modules/Test/classes/class.ilTestQuestionRelatedObjectivesList.php';
67 include_once
'Services/jQuery/classes/class.iljQueryUtil.php';
69 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
76 switch ($next_class) {
77 case 'ilassquestionpagegui':
83 require_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
85 $ret = $this->ctrl->forwardCommand($page_gui);
88 case 'iltestsubmissionreviewgui':
92 require_once
'./Modules/Test/classes/class.ilTestSubmissionReviewGUI.php';
95 $ret = $this->ctrl->forwardCommand($gui);
98 case 'ilassquestionhintrequestgui':
102 $questionGUI = $this->
object->createQuestionGUI(
104 $this->testSequence->getQuestionForSequence($this->getCurrentSequenceElement())
107 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
109 $questionGUI->object->getId(),
110 $this->testSession->getActiveId(),
111 $this->testSession->getPass()
114 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
120 $ret = $this->ctrl->forwardCommand($gui);
124 case 'iltestsignaturegui':
128 require_once
'./Modules/Test/classes/class.ilTestSignatureGUI.php';
130 $ret = $this->ctrl->forwardCommand($gui);
133 case 'iltestpasswordprotectiongui':
137 require_once
'Modules/Test/classes/class.ilTestPasswordProtectionGUI.php';
139 $ret = $this->ctrl->forwardCommand($gui);
149 $ret = &$this->$cmd();
163 $this->testSession->setUserId(
$ilUser->getId());
164 $this->testSession->setAnonymousId(
$_SESSION[
"tst_access_code"][$this->object->getTestId()]);
166 $this->testSession->saveToDb();
168 $active_id = $this->testSession->getActiveId();
169 $this->ctrl->setParameter($this,
"active_id", $active_id);
171 $shuffle = $this->
object->getShuffleQuestions();
172 if ($this->object->isRandomTest()) {
175 $this->
object->loadQuestions();
179 assQuestion::_updateTestPassResults(
181 $this->testSession->getPass(),
182 $this->
object->areObligationsEnabled(),
188 if (!$this->testSequence->hasSequence()) {
189 $this->testSequence->createNewSequence($this->object->getQuestionCount(), $shuffle);
190 $this->testSequence->saveToDb();
193 $this->testSequence->loadFromDb();
194 $this->testSequence->loadQuestions();
196 if ($this->testSession->isObjectiveOriented()) {
197 require_once
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
200 $objectivesAdapter->notifyTestStart($this->testSession, $this->object->getId());
201 $objectivesAdapter->prepareTestPass($this->testSession, $this->testSequence);
203 $objectivesAdapter->buildQuestionRelatedObjectiveList(
205 $this->questionRelatedObjectivesList
208 if ($this->testSequence->hasOptionalQuestions()) {
211 $this->testSequence->reorderOptionalQuestionsToSequenceEnd();
212 $this->testSequence->saveToDb();
216 $active_time_id = $this->
object->startWorkingTime(
217 $this->testSession->getActiveId(),
218 $this->testSession->getPass()
220 $_SESSION[
"active_time_id"] = $active_time_id;
224 $sequenceElement = $this->testSequence->getFirstSequence();
226 $this->ctrl->setParameter($this,
'sequence', $sequenceElement);
227 $this->ctrl->setParameter($this,
'pmode',
'');
229 if ($this->object->getListOfQuestionsStart()) {
241 require_once(
'./Modules/Test/classes/class.ilObjTestAccess.php');
242 require_once(
'./Services/Tracking/classes/class.ilLPStatusWrapper.php');
248 if ($sequenceElement ===
false) {
252 if ($sequenceElement < 1) {
256 if (!$this->testSequence->getPositionOfSequence($sequenceElement)) {
267 $_SESSION[
"active_time_id"] = $this->
object->startWorkingTime(
268 $this->testSession->getActiveId(),
269 $this->testSession->getPass()
275 $sequenceElement = $this->testSequence->getFirstSequence();
278 $this->testSession->setLastSequence($sequenceElement);
279 $this->testSession->saveToDb();
282 $questionId = $this->testSequence->getQuestionForSequence($sequenceElement);
284 if (!(
int) $questionId && $this->testSession->isObjectiveOriented()) {
288 if (!$this->testSequence->isQuestionPresented($questionId)) {
289 $this->testSequence->setQuestionPresented($questionId);
290 $this->testSequence->saveToDb();
294 $this->testSession->getActiveId(),
296 $this->testSession->getPass()
302 $instantResponse =
true;
315 $questionGui->setSequenceNumber($this->testSequence->getPositionOfSequence($sequenceElement));
316 $questionGui->setQuestionCount($this->testSequence->getUserQuestionCount());
318 require_once
'Modules/Test/classes/class.ilTestQuestionHeaderBlockBuilder.php';
320 $headerBlockBuilder->setHeaderMode($this->object->getTitleOutput());
321 $headerBlockBuilder->setQuestionTitle($questionGui->object->getTitle());
322 $headerBlockBuilder->setQuestionPoints($questionGui->object->getPoints());
323 $headerBlockBuilder->setQuestionPosition($this->testSequence->getPositionOfSequence($sequenceElement));
324 $headerBlockBuilder->setQuestionCount($this->testSequence->getUserQuestionCount());
325 $headerBlockBuilder->setQuestionPostponed($this->testSequence->isPostponedQuestion($questionId));
326 $headerBlockBuilder->setQuestionObligatory(
329 if ($this->testSession->isObjectiveOriented()) {
330 require_once
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
332 $objectivesAdapter->buildQuestionRelatedObjectiveList($this->testSequence, $this->questionRelatedObjectivesList);
333 $this->questionRelatedObjectivesList->loadObjectivesTitles();
335 $objectivesString = $this->questionRelatedObjectivesList->getQuestionRelatedObjectiveTitles($questionId);
336 $headerBlockBuilder->setQuestionRelatedObjectives($objectivesString);
338 $questionGui->setQuestionHeaderBlockBuilder($headerBlockBuilder);
340 $this->
prepareTestPage($presentationMode, $sequenceElement, $questionId);
343 $navigationToolbarGUI->setFinishTestButtonEnabled(
true);
347 $this->ctrl->setParameter($this,
'sequence', $sequenceElement);
348 $this->ctrl->setParameter($this,
'pmode', $presentationMode);
351 switch ($presentationMode) {
355 $navigationToolbarGUI->setDisabledStateEnabled(
false);
357 $this->
showQuestionEditable($questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse);
363 if ($this->testSequence->isQuestionOptional($questionGui->object->getId())) {
367 $this->
showQuestionViewable($questionGui, $formAction, $isQuestionWorkedThrough, $instantResponse);
373 require_once
'Modules/Test/exceptions/class.ilTestException.php';
377 $navigationToolbarGUI->build();
384 if ($instantResponse) {
409 if ($this->object->isForceInstantFeedbackEnabled()) {
414 $questionId = $this->testSequence->getQuestionForSequence(
423 $nextSequenceElement = $this->testSequence->getFirstSequence();
426 $this->testSession->setLastSequence($nextSequenceElement);
427 $this->testSession->saveToDb();
429 $this->ctrl->setParameter($this,
'sequence', $nextSequenceElement);
430 $this->ctrl->setParameter($this,
'pmode',
'');
439 $questionId = $this->testSequence->getQuestionForSequence(
445 if ($this->object->isForceInstantFeedbackEnabled()) {
446 $this->ctrl->setParameter($this,
'instresp', 1);
448 $this->testSequence->setQuestionChecked($questionId);
449 $this->testSequence->saveToDb();
455 $this->ctrl->setParameter($this,
'pmode',
'');
474 $this->ctrl->saveParameter($this,
'sequence');
485 $this->testSequence->getQuestionForSequence($currentSequenceElement)
488 $currentQuestionOBJ->resetUsersAnswer(
489 $this->testSession->getActiveId(),
490 $this->testSession->getPass()
493 $this->ctrl->saveParameter($this,
'sequence');
503 $nextSequenceElement = $this->testSequence->getNextSequence($curSequenceElement);
506 $nextSequenceElement = $this->testSequence->getFirstSequence();
509 if ($this->object->isPostponingEnabled()) {
510 $this->testSequence->postponeSequence($curSequenceElement);
511 $this->testSequence->saveToDb();
514 $this->ctrl->setParameter($this,
'sequence', $nextSequenceElement);
515 $this->ctrl->setParameter($this,
'pmode',
'');
522 $questionId = $this->testSequence->getQuestionForSequence($sequenceElement);
525 $this->testSession->getActiveId(),
527 $this->testSession->getPass()
530 if (!$isQuestionWorkedThrough) {
531 $this->testSequence->postponeQuestion($questionId);
532 $this->testSequence->saveToDb();
539 $nextSequenceElement = $this->testSequence->getNextSequence($lastSequenceElement);
541 if ($this->object->isPostponingEnabled()) {
546 $nextSequenceElement = $this->testSequence->getFirstSequence();
549 $this->ctrl->setParameter($this,
'sequence', $nextSequenceElement);
550 $this->ctrl->setParameter($this,
'pmode',
'');
557 $sequenceElement = $this->testSequence->getPreviousSequence(
562 $sequenceElement = $this->testSequence->getLastSequence();
565 $this->ctrl->setParameter($this,
'sequence', $sequenceElement);
566 $this->ctrl->setParameter($this,
'pmode',
'');
573 return $sequenceElement == $this->testSequence->getFirstSequence();
578 return $sequenceElement == $this->testSequence->getLastSequence();
596 return $this->testSequence->getQuestionForSequence(
$_GET[
"sequence"]);
605 $this->saveResult =
false;
607 $formtimestamp =
$_POST[
"formtimestamp"];
608 if (strlen($formtimestamp) == 0) {
609 $formtimestamp =
$_GET[
"formtimestamp"];
611 if ($formtimestamp !=
$_SESSION[
"formtimestamp"]) {
612 $_SESSION[
"formtimestamp"] = $formtimestamp;
620 $q_id = $this->testSequence->getQuestionForSequence(
$_GET[
"sequence"]);
627 if (is_numeric($q_id) && (
int) $q_id) {
630 $active_id = $this->testSession->getActiveId();
631 if ($this->object->isRandomTest()) {
634 $this->saveResult = $questionOBJ->persistWorkingState(
637 $this->object->areObligationsEnabled(),
641 if ($authorized && $this->testSession->isObjectiveOriented()) {
642 require_once
'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php';
644 $objectivesAdapter->updateQuestionResult($this->testSession, $questionOBJ);
647 if ($authorized && $this->object->isSkillServiceToBeConsidered()) {
653 if ($this->saveResult ==
false || (!$questionOBJ->validateSolutionSubmit() && $questionOBJ->savePartial()) ) {
654 $this->ctrl->setParameter($this,
"save_error",
"1");
663 $questionId = $this->testSequence->getQuestionForSequence(
674 $this->testSequence->setQuestionChecked($questionId);
675 $this->testSequence->saveToDb();
678 $this->ctrl->setParameter($this,
'instresp', 1);
691 $questionId = $this->testSequence->getQuestionForSequence(
708 if ($this->testSession->getActiveId() > 0) {
709 if ($this->testSequence->hasRandomQuestionsForPass($this->testSession->getActiveId(), $this->testSession->getPass()) > 0) {
718 __METHOD__ .
' Random Questions allready exists for user ' .
719 $ilUser->getId() .
' in test ' . $this->
object->getTestId()
731 $ilLog->write(__METHOD__ .
' ' . sprintf(
732 $this->lng->txt(
"error_random_question_generation"),
734 $this->
object->getTestId()
746 $tree = $DIC[
'tree'];
747 $ilDB = $DIC[
'ilDB'];
748 $ilPluginAdmin = $DIC[
'ilPluginAdmin'];
750 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetConfig.php';
752 $questionSetConfig->loadFromDb();
754 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
757 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
759 $sourcePoolDefinitionList->loadDefinitions();
761 $this->processLocker->executeRandomPassBuildOperation(
function () use (
$ilDB, $ilPluginAdmin, $questionSetConfig, $sourcePoolDefinitionList) {
763 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestionList.php';
766 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilder.php';
769 $questionSetBuilder->performBuild($this->testSession);
771 }, $sourcePoolDefinitionList->hasTaxonomyFilters());
781 $active_id = $this->testSession->getActiveId();
782 $this->ctrl->setParameter($this,
"active_id", $active_id);
784 $active_time_id = $this->
object->startWorkingTime($active_id, $this->testSession->getPass());
785 $_SESSION[
"active_time_id"] = $active_time_id;
788 if ($this->object->isRandomTest()) {
789 if (!$this->testSequence->hasRandomQuestionsForPass($active_id, $this->testSession->getPass())) {
795 $shuffle = $this->
object->getShuffleQuestions();
796 if ($this->object->isRandomTest()) {
800 assQuestion::_updateTestPassResults(
802 $this->testSession->getPass(),
803 $this->
object->areObligationsEnabled(),
809 if (!$this->testSequence->hasSequence()) {
810 $this->testSequence->createNewSequence($this->object->getQuestionCount(), $shuffle);
811 $this->testSequence->saveToDb();
814 if ($this->object->getListOfQuestionsStart()) {
818 $this->ctrl->setParameter($this,
'sequence', $this->testSession->getLastSequence());
819 $this->ctrl->setParameter($this,
'pmode',
'');
825 return $this->testSequence->isPostponedQuestion($questionId);
831 $ilDB = $DIC[
'ilDB'];
836 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
839 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionUserSolutionAdopter.php';
842 $userSolutionAdopter->setUserId(
$ilUser->getId());
843 $userSolutionAdopter->setActiveId($this->testSession->getActiveId());
844 $userSolutionAdopter->setTargetPass($this->testSequence->getPass());
845 $userSolutionAdopter->setQuestionIds($this->testSequence->getOptionalQuestions());
847 $userSolutionAdopter->perform();
854 if ($this->testSequence->isAnsweringOptionalQuestionsConfirmed()) {
858 $questionId = $this->testSequence->getQuestionForSequence($sequenceKey);
860 if (!$this->testSequence->isQuestionOptional($questionId)) {
874 ilUtil::sendFailure(sprintf($this->lng->txt(
'tst_objective_oriented_test_pass_without_questions'), $this->
object->getTitle()),
true);
884 $isNextPrimary =
true;
886 if ($this->object->isForceInstantFeedbackEnabled()) {
887 $isNextPrimary =
false;
891 $this->testSession->getActiveId(),
892 $this->testSession->getPass(),
893 $this->testSequence->getOrderedSequenceQuestions()
896 if (!count($questionsMissingResult)) {
898 $isNextPrimary =
false;
899 } elseif (count($questionsMissingResult) == 1) {
900 $lastOpenQuestion = current($questionsMissingResult);
902 if ($currentQuestionId == $lastOpenQuestion) {
904 $isNextPrimary =
false;
908 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()
$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.