4 require_once
'./Modules/Test/classes/class.ilTestPlayerAbstractGUI.php';
31 global
$ilUser, $ilDB, $ilPluginAdmin,
$lng, $ilTabs;
33 $ilTabs->clearTargets();
35 $cmd = $this->ctrl->getCmd();
36 $next_class = $this->ctrl->getNextClass($this);
38 $this->ctrl->saveParameter($this,
"sequence");
39 $this->ctrl->saveParameter($this,
"active_id");
41 if (preg_match(
"/^gotoquestion_(\\d+)$/",
$cmd, $matches))
43 $cmd =
"gotoquestion";
44 if (strlen($matches[1]))
46 $this->ctrl->setParameter($this,
'gotosequence', $matches[1]);
58 $this->testSequence = $testSequenceFactory->getSequence($this->testSession);
59 $this->testSequence->loadFromDb();
60 $this->testSequence->loadQuestions();
62 include_once
'Services/jQuery/classes/class.iljQueryUtil.php';
64 include_once
"./Services/YUI/classes/class.ilYuiUtil.php";
71 case 'ilassquestionpagegui':
73 $questionId = $this->testSequence->getQuestionForSequence( $this->
calculateSequence() );
75 require_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
77 $ret = $this->ctrl->forwardCommand($page_gui);
80 case 'iltestsubmissionreviewgui':
81 require_once
'./Modules/Test/classes/class.ilTestSubmissionReviewGUI.php';
83 $ret = $this->ctrl->forwardCommand($gui);
86 case 'ilassquestionhintrequestgui':
88 $questionGUI = $this->
object->createQuestionGUI(
89 "", $this->testSequence->getQuestionForSequence( $this->calculateSequence() )
92 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
95 $ret = $this->ctrl->forwardCommand($gui);
99 case 'iltestsignaturegui':
100 require_once
'./Modules/Test/classes/class.ilTestSignatureGUI.php';
102 $ret = $this->ctrl->forwardCommand($gui);
116 $_GET[
'activecommand'] =
'start';
126 $this->ctrl->setParameter($this,
"activecommand",
"next");
127 $this->ctrl->redirect($this,
"redirectQuestion");
136 $this->ctrl->setParameter($this,
"activecommand",
"previous");
137 $this->ctrl->redirect($this,
"redirectQuestion");
154 $executable = $this->
object->isExecutable($this->testSession, $ilUser->getId());
155 if (!$executable[
"executable"])
158 $this->ctrl->redirectByClass(
"ilobjtestgui",
"infoScreen");
160 switch (
$_GET[
"activecommand"])
164 if ($this->sequence === FALSE)
166 if ($this->object->getListOfQuestionsEnd())
170 $this->testSession->getTestId(),
171 $this->testSession->getActiveId(),
172 $this->testSession->getPass()
175 if( $this->object->areObligationsEnabled() && !$allObligationsAnswered )
177 $this->ctrl->redirect($this,
"outQuestionSummaryWithObligationsInfo");
184 $this->ctrl->redirect($this,
"finishTest");
189 $this->testSession->setLastSequence($this->sequence);
190 $this->testSession->saveToDb();
196 $this->testSession->setLastSequence($this->sequence);
197 $this->testSession->saveToDb();
198 if ($this->sequence === FALSE)
200 $this->ctrl->redirect($this,
"outIntroductionPage");
209 $nextSequence = $this->testSequence->getNextSequence($this->sequence);
210 $this->testSequence->postponeSequence($this->sequence);
211 $this->testSequence->saveToDb();
212 $this->testSession->setLastSequence($nextSequence);
213 $this->testSession->saveToDb();
214 $this->sequence = $nextSequence;
219 $this->testSession->setLastSequence($this->sequence);
220 $this->testSession->saveToDb();
221 $q_id = $this->testSequence->getQuestionForSequence(
$_GET[
"sequence"]);
222 $this->
object->setQuestionSetSolved(1, $q_id, $ilUser->getId());
227 $this->testSession->setLastSequence($this->sequence);
228 $this->testSession->saveToDb();
229 $q_id = $this->testSequence->getQuestionForSequence(
$_GET[
"sequence"]);
230 $this->
object->setQuestionSetSolved(0, $q_id, $ilUser->getId());
233 case "directfeedback":
235 $this->testSession->setLastSequence($this->sequence);
236 $this->testSession->saveToDb();
239 case "handleQuestionAction":
241 $this->testSession->setLastSequence($this->sequence);
242 $this->testSession->saveToDb();
246 $this->ctrl->redirect($this,
"outQuestionSummary");
248 case "summary_obligations":
249 $this->ctrl->redirect($this,
"outQuestionSummaryWithObligationsInfo");
251 case "summary_obligations_only":
252 $this->ctrl->redirect($this,
"outObligationsOnlySummary");
258 $this->testSession->setUserId($ilUser->getId());
259 $this->testSession->setAnonymousId(
$_SESSION[
"tst_access_code"][$this->object->getTestId()]);
260 $this->testSession->saveToDb();
262 $active_id = $this->testSession->getActiveId();
263 $this->ctrl->setParameter($this,
"active_id", $active_id);
264 $shuffle = $this->
object->getShuffleQuestions();
265 if ($this->object->isRandomTest())
269 $this->
object->loadQuestions();
273 assQuestion::_updateTestPassResults(
274 $active_id, $this->testSession->getPass(), $this->
object->areObligationsEnabled()
278 if( !$this->testSequence->hasSequence() )
280 $this->testSequence->createNewSequence($this->object->getQuestionCount(), $shuffle);
281 $this->testSequence->saveToDb();
284 $active_time_id = $this->
object->startWorkingTime($this->testSession->getActiveId(), $this->testSession->getPass());
285 $_SESSION[
"active_time_id"] = $active_time_id;
286 if ($this->object->getListOfQuestionsStart())
288 $this->ctrl->setParameter($this,
"activecommand",
"summary");
289 $this->ctrl->redirect($this,
"redirectQuestion");
293 $this->ctrl->setParameter($this,
"sequence", $this->sequence);
294 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
295 $this->ctrl->saveParameter($this,
"tst_javascript");
296 $this->ctrl->redirect($this,
"redirectQuestion");
301 $active_id = $this->testSession->getActiveId();
302 $this->ctrl->setParameter($this,
"active_id", $active_id);
304 if ($this->object->isRandomTest())
306 if (!$this->testSequence->hasRandomQuestionsForPass($active_id, $this->testSession->getPass()))
312 $shuffle = $this->
object->getShuffleQuestions();
313 if ($this->object->isRandomTest())
318 assQuestion::_updateTestPassResults(
319 $active_id, $this->testSession->getPass(), $this->
object->areObligationsEnabled()
323 if( !$this->testSequence->hasSequence() )
325 $this->testSequence->createNewSequence($this->object->getQuestionCount(), $shuffle);
326 $this->testSequence->saveToDb();
329 $this->sequence = $this->testSession->getLastSequence();
330 $active_time_id = $this->
object->startWorkingTime($active_id, $this->testSession->getPass());
331 $_SESSION[
"active_time_id"] = $active_time_id;
332 if ($this->object->getListOfQuestionsStart())
334 $this->ctrl->setParameter($this,
"activecommand",
"summary");
335 $this->ctrl->redirect($this,
"redirectQuestion");
339 $this->ctrl->setParameter($this,
"sequence", $this->sequence);
340 $this->ctrl->setParameter($this,
"activecommand",
"gotoquestion");
341 $this->ctrl->saveParameter($this,
"tst_javascript");
342 $this->ctrl->redirect($this,
"redirectQuestion");
346 case 'test_submission_overview':
347 require_once
'./Modules/Test/classes/class.ilTestSubmissionReviewGUI.php';
355 if (array_key_exists(
"tst_javascript",
$_GET))
357 $ilUser->writePref(
"tst_javascript",
$_GET[
"tst_javascript"]);
360 if (strlen(
$_GET[
'gotosequence'])) $this->sequence =
$_GET[
'gotosequence'];
361 $this->testSession->setLastSequence($this->sequence);
362 $this->testSession->saveToDb();
370 if( $sequenceElement < 1 )
375 if( !$this->testSequence->getPositionOfSequence($sequenceElement) )
392 $sequence = $this->testSequence->getFirstSequence();
395 $_SESSION[
"active_time_id"]= $this->
object->startWorkingTime($this->testSession->getActiveId(),
396 $this->testSession->getPass()
402 if ($this->object->getListOfQuestions())
407 $questionId = $this->testSequence->getQuestionForSequence(
$sequence);
408 $question_gui = $this->
object->createQuestionGUI(
"", $questionId);
410 if( !is_object($question_gui) )
415 "INV SEQ: active={$this->testSession->getActiveId()} qId=$questionId seq=$sequence " 416 .serialize($this->testSequence)
419 $ilLog->logStack(
'INV SEQ');
421 $this->ctrl->setParameter($this,
'gotosequence', $this->testSequence->getFirstSequence());
422 $this->ctrl->setParameter($this,
'activecommand',
'gotoquestion');
423 $this->ctrl->redirect($this,
'redirectQuestion');
426 $question_gui->setTargetGui($this);
428 if ($this->object->getJavaScriptOutput())
433 $is_postponed = $this->testSequence->isPostponedQuestion($question_gui->object->getId());
434 $this->ctrl->setParameter($this,
"sequence",
"$sequence");
435 $formaction = $this->ctrl->getFormAction($this,
"gotoQuestion");
437 $question_gui->setSequenceNumber($this->testSequence->getPositionOfSequence(
$sequence));
438 $question_gui->setQuestionCount($this->testSequence->getUserQuestionCount());
442 $user_post_solution = FALSE;
443 if (array_key_exists(
"previouspost",
$_SESSION))
445 $user_post_solution =
$_SESSION[
"previouspost"];
452 $answer_feedback = FALSE;
453 if (($directfeedback) && ($this->object->getSpecificAnswerFeedback()))
455 $answer_feedback = TRUE;
460 $question_gui->outQuestionForTest(
461 $formaction, #form_action
462 $this->testSession->getActiveId(), #active_id
464 $is_postponed, #is_postponed
465 $user_post_solution, #user_post_solution
466 $answer_feedback #answer_feedback == inline_specific_feedback
479 if ($this->object->getInstantFeedbackSolution())
484 $solutionoutput = $question_gui->getSolutionOutput(
485 $this->testSession->getActiveId(), #active_id
487 FALSE, #graphical_output
488 $show_question_inline_score, #result_output
489 FALSE, #show_question_only
490 FALSE, #show_feedback
491 TRUE, #show_correct_solution
492 FALSE, #show_manual_scoring
493 FALSE #show_question_text
500 if ($this->object->getAnswerFeedbackPoints())
502 $reachedPoints = $question_gui->object->getAdjustedReachedPoints($this->testSession->getActiveId(), NULL);
503 $maxPoints = $question_gui->object->getMaximumPoints();
510 if ($this->object->getGenericAnswerFeedback())
517 if ($this->object->getSpecificAnswerFeedback())
525 if ($postpone_allowed && !$is_postponed)
530 if ($this->object->getListOfQuestions())
535 if ($this->object->getShowCancel())
542 if ($this->object->getListOfQuestionsEnd())
556 if ($this->object->getShowMarker())
558 include_once
"./Modules/Test/classes/class.ilObjTest.php";
562 if (count ($solved_array) > 0)
564 $solved = array_pop($solved_array);
565 $solved = $solved[
"solved"];
580 if ($this->object->getJavaScriptOutput())
583 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"disable_javascript"));
584 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"disable_javascript"));
585 $this->ctrl->setParameter($this,
"tst_javascript",
"0");
586 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
591 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_ALT", $this->lng->txt(
"enable_javascript"));
592 $this->tpl->setVariable(
"JAVASCRIPT_IMAGE_TITLE", $this->lng->txt(
"enable_javascript"));
593 $this->ctrl->setParameter($this,
"tst_javascript",
"1");
594 $this->tpl->setVariable(
"JAVASCRIPT_URL", $this->ctrl->getLinkTarget($this,
"gotoQuestion"));
597 if ($question_gui->object->requiresJsSwitch() && !$this->
object->getForceJS())
599 $this->tpl->touchBlock(
"jsswitch");
604 $this->tpl->setVariable(
"AUTOSAVE_URL", $this->ctrl->getFormAction($this,
"autosave",
"",
true));
606 if ($question_gui->isAutosaveable()&& $this->
object->getAutosave())
608 $this->tpl->touchBlock(
'autosave');
612 $this->tpl->setVariable(
"AUTOSAVEFORMACTION", str_replace(
"&",
"&", $this->ctrl->getLinkTarget($this,
"autosave")));
613 $this->tpl->setVariable(
"AUTOSAVEINTERVAL", $this->object->getAutosaveIval());
618 $this->tpl->touchBlock(
'question_obligatory');
619 $this->tpl->setVariable(
'QUESTION_OBLIGATORY', $this->lng->txt(
'required_field'));
625 return $sequence == $this->testSequence->getFirstSequence();
630 return $this->testSequence->getQuestionForSequence($this->testSequence->getLastSequence()) == $question_gui->object->getId();
649 $this->saveResult = FALSE;
652 $formtimestamp =
$_POST[
"formtimestamp"];
653 if (strlen($formtimestamp) == 0) $formtimestamp =
$_GET[
"formtimestamp"];
654 if ($formtimestamp !=
$_SESSION[
"formtimestamp"])
656 $_SESSION[
"formtimestamp"] = $formtimestamp;
667 $q_id = $this->testSequence->getQuestionForSequence(
$_GET[
"sequence"]);
668 if (is_numeric($q_id) && (
int)$q_id)
672 $question_gui = $this->
object->createQuestionGUI(
"", $q_id);
673 if ($this->object->getJavaScriptOutput())
678 $active_id = $this->testSession->getActiveId();
679 if ($this->object->isRandomTest())
681 $pass = $this->
object->_getPass($active_id);
683 $this->saveResult = $question_gui->object->persistWorkingState(
684 $active_id,
$pass, $this->object->areObligationsEnabled()
692 if ($this->saveResult == FALSE)
694 $this->ctrl->setParameter($this,
"save_error",
"1");
703 $this->ctrl->setParameter($this,
"activecommand",
"directfeedback");
704 $this->ctrl->redirect($this,
"redirectQuestion");
710 if ($this->saveResult == FALSE)
712 $this->ctrl->setParameter($this,
"activecommand",
"");
713 $this->ctrl->redirect($this,
"redirectQuestion");
717 $this->ctrl->setParameter($this,
"activecommand",
"summary");
718 $this->ctrl->redirect($this,
"redirectQuestion");
724 $this->ctrl->setParameter($this,
"activecommand",
"summary");
725 $this->ctrl->redirect($this,
"redirectQuestion");
736 $this->ctrl->setParameter($this,
"activecommand",
"postpone");
737 $this->ctrl->redirect($this,
"redirectQuestion");
746 $this->ctrl->setParameter($this,
'activecommand',
'handleQuestionAction');
747 $this->ctrl->redirect($this,
'redirectQuestion');
752 if ($this->testSession->getActiveId() > 0)
754 if ($this->testSequence->hasRandomQuestionsForPass($this->testSession->getActiveId(), $this->testSession->getPass()) > 0)
762 __METHOD__.
' Random Questions allready exists for user '.
763 $ilUser->getId().
' in test '.$this->
object->getTestId()
775 $ilLog->write(__METHOD__.
' '.sprintf(
776 $this->lng->txt(
"error_random_question_generation"), $ilUser->getId(), $this->
object->getTestId()
787 global
$tree, $ilDB, $ilPluginAdmin;
789 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetConfig.php';
791 $questionSetConfig->loadFromDb();
793 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
796 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
798 $sourcePoolDefinitionList->loadDefinitions();
800 $this->processLocker->requestRandomPassBuildLock($sourcePoolDefinitionList->hasTaxonomyFilters());
804 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetStagingPoolQuestionList.php';
807 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilder.php';
810 $questionSetBuilder->performBuild($this->testSession);
813 $this->processLocker->releaseRandomPassBuildLock();
populateNextButtonsLeadingToSummary()
isValidSequenceElement($sequenceElement)
populateSyntaxStyleBlock()
static allObligationsAnswered($test_id, $active_id, $pass)
checks wether all questions marked as obligatory were answered within the test pass with given testId...
outTestPage($directfeedback)
Outputs the question of the active sequence.
populateSpecificFeedbackBlock($question_gui)
populateContentStyleBlock()
populateNextButtonsLeadingToEndOfTest()
static getInstance(ilDB $db, ilObjTest $testOBJ, ilTestRandomQuestionSetConfig $questionSetConfig, ilTestRandomQuestionSetSourcePoolDefinitionList $sourcePoolDefinitionList, ilTestRandomQuestionSetStagingPoolQuestionList $stagingPoolQuestionList)
Output class for assessment test execution.
updateWorkingTime()
updates working time and stores state saveresult to see if question has to be stored or not ...
previousQuestionCmd()
Go to the previous question.
populatePostponeButtons()
isLastQuestionInSequence(assQuestionGUI $question_gui)
executeCommand()
Execute Command.
handleQuestionActionCmd()
_getSolvedQuestions($active_id, $question_fi=null)
get solved questions
saveQuestionSolution($force=FALSE)
saves the user input of a question
calculateSequence()
Calculates the sequence to determine the next question.
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
isNrOfTriesReached()
nr of tries exceeded
ensureExistingTestSession(ilTestSession $testSession)
fillQuestionRelatedNavigation(assQuestionGUI $questionGUI)
renders the elements for the question related navigation
Class ilTestSubmissionReviewGUI.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static getJSLocation($a_js_name, $a_js_location="", $add_version=FALSE)
get full javascript file name (path inclusive) of current user
getCommand($cmd)
Retrieves the ilCtrl command.
postponeQuestionCmd()
Postpone a question to the end of the test.
nextQuestionCmd()
Go to the next question.
populateQuestionMarkingBlockAsMarked()
isFirstPageInSequence($sequence)
populatePreviousButtons($sequence)
Basic GUI class for assessment questions.
populateNextButtonsLeadingToQuestion()
initProcessLocker($activeId)
redirectQuestionCmd()
Called when a user answered a question to perform a redirect after POST.
outQuestionSummaryCmd($fullpage=true, $contextFinishTest=false, $obligationsNotAnswered=false, $obligationsFilter=false)
Output of a summary of all test questions for test participants.
performTearsAndAngerBrokenConfessionChecks()
generateRandomTestPassForActiveUser()
determineInlineScoreDisplay()
showQuestionListWithoutSavingCmd()
populateQuestionMarkingBlockAsUnmarked()
static initjQuery($a_tpl=null)
Init jQuery.
populateGenericFeedbackBlock($question_gui)
isMaxProcessingTimeReached()
Checks wheather the maximum processing time is reached or not.
populateCancelButtonBlock()
static initConnectionWithAnimation()
Init YUI Connection module.
canSaveResult()
Returns TRUE if the answers of the current user could be saved.
populateSolutionBlock($solutionoutput)
populateScoreBlock($reachedPoints, $maxPoints)
outWorkingForm($sequence="", $test_id, $postpone_allowed, $directfeedback=false)
Creates the learners output of a question.
Output class for assessment test execution.