98 require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php';
101 $this->questionOBJ = $this->questionGUI->object;
103 $this->questionOBJ->setObjId($parentObjId);
105 $this->questionGUI->setQuestionTabs();
106 $this->questionGUI->outAdditionalOutput();
108 $this->questionGUI->populateJavascriptFilesRequiredForWorkForm($this->tpl);
111 $this->questionGUI->setTargetGui($this);
112 $this->questionGUI->setQuestionActionCmd(self::CMD_HANDLE_QUESTION_ACTION);
119 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewSettings.php';
122 $this->previewSettings->init();
127 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewSession.php';
130 $this->previewSession->init();
135 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewHintTracking.php';
141 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
143 $this->tpl->setCurrentBlock(
"ContentStyle");
145 $this->tpl->parseCurrentBlock();
147 $this->tpl->setCurrentBlock(
"SyntaxStyle");
149 $this->tpl->parseCurrentBlock();
155 $ilHelp =
$DIC[
'ilHelp'];
156 $ilHelp->setScreenIdComponent(
'qpl');
158 $this->tabs->setTabActive(self::TAB_ID_QUESTION_PREVIEW);
160 $this->lng->loadLanguageModule(
'content');
162 $nextClass = $this->ctrl->getNextClass($this);
164 switch ($nextClass) {
165 case 'ilassquestionhintrequestgui':
167 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
170 $this->ctrl->forwardCommand($gui);
174 case 'ilassspecfeedbackpagegui':
175 case 'ilassgenfeedbackpagegui':
176 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackPageObjectCommandForwarder.php';
178 $forwarder->forward();
183 $notesGUI =
new ilNoteGUI($this->questionOBJ->getObjId(), $this->questionOBJ->getId(),
'quest');
184 $notesGUI->enablePublicNotes(
true);
185 $notesGUI->enablePublicNotesDeletion(
true);
186 $notesPanelHTML = $this->ctrl->forwardCommand($notesGUI);
187 $this->
showCmd($notesPanelHTML);
193 $cmd = $this->ctrl->getCmd(self::CMD_SHOW) .
'Cmd';
211 if ($this->previewSettings->isTestRefId()) {
215 return (
bool)
$DIC->rbac()->system()->checkAccess(
'write', (
int)
$_GET[
'ref_id']);
218 private function showCmd($notesPanelHTML =
'')
220 $tpl =
new ilTemplate(
'tpl.qpl_question_preview.html',
true,
true,
'Modules/TestQuestionPool');
231 $this->questionGUI->addHeaderAction();
235 $this->tpl->setContent(
$tpl->get());
240 $renderHeader =
false;
241 $renderAnchor =
false;
245 $renderAnchor =
true;
246 $renderHeader =
true;
251 $renderAnchor =
true;
252 $renderHeader =
true;
257 $renderAnchor =
true;
258 $renderHeader =
true;
262 $renderHeader =
true;
264 if ($this->questionGUI->hasInlineFeedback()) {
265 $renderAnchor =
false;
268 $renderAnchor =
true;
279 $this->previewSession->setRandomizerSeed(
null);
280 $this->previewSession->setParticipantsSolution(
null);
281 $this->previewSession->resetRequestedHints();
282 $this->previewSession->setInstantResponseActive(
false);
286 $this->ctrl->redirect($this, self::CMD_SHOW);
292 $this->previewSession->setInstantResponseActive(
true);
294 $this->previewSession->setInstantResponseActive(
false);
297 $this->ctrl->redirect($this, self::CMD_SHOW);
302 $this->questionOBJ->persistPreviewState($this->previewSession);
303 $this->ctrl->redirect($this, self::CMD_SHOW);
308 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewToolbarGUI.php';
311 $toolbarGUI->setFormAction($this->ctrl->getFormAction($this, self::CMD_SHOW));
312 $toolbarGUI->setResetPreviewCmd(self::CMD_RESET);
314 $toolbarGUI->build();
316 $tpl->setVariable(
'PREVIEW_TOOLBAR', $this->ctrl->getHTML($toolbarGUI));
322 $this->ctrl->setReturnByClass(
'ilAssQuestionPageGUI',
'view');
323 $this->ctrl->setReturnByClass(
'ilObjQuestionPoolGUI',
'questions');
325 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
327 $pageGUI->setRenderPageContainer(
false);
328 $pageGUI->setEditPreview(
true);
329 $pageGUI->setEnabledTabs(
false);
332 if (strlen($this->ctrl->getCmd()) == 0 && !isset(
$_POST[
'editImagemapForward_x'])) {
333 $this->ctrl->setCmdClass(get_class($pageGUI));
334 $this->ctrl->setCmd(
'preview');
337 $this->questionGUI->setPreviewSession($this->previewSession);
341 $this->questionGUI->magicAfterTestOutput();
344 $questionHtml = $this->questionGUI->buildFocusAnchorHtml() . $questionHtml;
349 $pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $questionHtml));
352 $pageGUI->setPresentationTitle($this->questionOBJ->getTitle());
356 $tpl->setVariable(
'QUESTION_OUTPUT', $pageGUI->preview());
361 $reachedPoints = $this->questionOBJ->calculateReachedPointsFromPreviewSession($this->previewSession);
362 $maxPoints = $this->questionOBJ->getMaximumPoints();
364 $scoreInformation = sprintf(
365 $this->lng->txt(
"you_received_a_of_b_points"),
370 $tpl->setCurrentBlock(
"reached_points_feedback");
371 $tpl->setVariable(
"REACHED_POINTS_FEEDBACK", $scoreInformation);
372 $tpl->parseCurrentBlock();
378 $this->ctrl->setReturnByClass(
'ilAssQuestionPageGUI',
'view');
379 $this->ctrl->setReturnByClass(
'ilObjQuestionPoolGUI',
'questions');
381 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
384 $pageGUI->setEditPreview(
true);
385 $pageGUI->setEnabledTabs(
false);
388 if (strlen($this->ctrl->getCmd()) == 0 && !isset(
$_POST[
'editImagemapForward_x'])) {
389 $this->ctrl->setCmdClass(get_class($pageGUI));
390 $this->ctrl->setCmd(
'preview');
393 $this->questionGUI->setPreviewSession($this->previewSession);
395 $pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $this->questionGUI->getSolutionOutput(0,
null,
false,
false,
true,
false,
true,
false,
false)));
402 $output = $this->questionGUI->getSolutionOutput(0,
null,
false,
false,
true,
false,
true,
false,
false);
406 $tpl->setCurrentBlock(
'solution_output');
407 $tpl->setVariable(
'TXT_CORRECT_SOLUTION', $this->lng->txt(
'tst_best_solution_is'));
409 $tpl->parseCurrentBlock();
414 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionRelatedNavigationBarGUI.php';
417 $navGUI->setInstantResponseCmd(self::CMD_INSTANT_RESPONSE);
418 $navGUI->setHintRequestCmd(self::CMD_GATEWAY_CONFIRM_HINT_REQUEST);
419 $navGUI->setHintListCmd(self::CMD_GATEWAY_SHOW_HINT_LIST);
421 $navGUI->setInstantResponseEnabled($this->previewSettings->isInstantFeedbackNavigationRequired());
422 $navGUI->setHintProvidingEnabled($this->previewSettings->isHintProvidingEnabled());
424 $navGUI->setHintRequestsPossible($this->hintTracking->requestsPossible());
425 $navGUI->setHintRequestsExist($this->hintTracking->requestsExist());
427 return $this->ctrl->getHTML($navGUI);
432 if ($this->questionOBJ->isPreviewSolutionCorrect($this->previewSession)) {
433 $feedback = $this->questionGUI->getGenericFeedbackOutputForCorrectSolution();
436 $feedback = $this->questionGUI->getGenericFeedbackOutputForIncorrectSolution();
440 if (strlen($feedback)) {
441 $tpl->setCurrentBlock(
'instant_feedback_generic');
442 $tpl->setVariable(
'GENERIC_FEEDBACK', $feedback);
443 $tpl->setVariable(
'ILC_FB_CSS_CLASS', $cssClass);
444 $tpl->parseCurrentBlock();
450 $fb = $this->questionGUI->getSpecificFeedbackOutput(
451 (array) $this->previewSession->getParticipantsSolution()
454 $tpl->setCurrentBlock(
'instant_feedback_specific');
455 $tpl->setVariable(
'ANSWER_FEEDBACK', $fb);
456 $tpl->parseCurrentBlock();
461 if ($withFocusAnchor) {
462 $tpl->setCurrentBlock(
'inst_resp_id');
463 $tpl->setVariable(
'INSTANT_RESPONSE_FOCUS_ID', self::FEEDBACK_FOCUS_ANCHOR);
464 $tpl->parseCurrentBlock();
467 $tpl->setCurrentBlock(
'instant_response_header');
468 $tpl->setVariable(
'INSTANT_RESPONSE_HEADER', $this->lng->txt(
'tst_feedback'));
469 $tpl->parseCurrentBlock();
474 if (!$this->previewSettings->isBestSolutionEnabled()) {
478 return $this->previewSession->isInstantResponseActive();
483 if (!$this->previewSettings->isGenericFeedbackEnabled()) {
487 return $this->previewSession->isInstantResponseActive();
492 if (!$this->previewSettings->isSpecificFeedbackEnabled()) {
496 return $this->previewSession->isInstantResponseActive();
501 if (!$this->previewSettings->isReachedPointsEnabled()) {
505 return $this->previewSession->isInstantResponseActive();
510 return $this->questionOBJ->persistPreviewState($this->previewSession);
516 $this->previewSession->setInstantResponseActive(
false);
521 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
523 $this->ctrl->redirectByClass(
524 'ilAssQuestionHintRequestGUI',
532 $this->previewSession->setInstantResponseActive(
false);
537 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
539 $this->ctrl->redirectByClass(
540 'ilAssQuestionHintRequestGUI',
550 require_once
'Services/Randomization/classes/class.ilArrayElementShuffler.php';
553 if (!$this->previewSession->randomizerSeedExists()) {
554 $this->previewSession->setRandomizerSeed($shuffler->buildRandomSeed());
557 $shuffler->setSeed($this->previewSession->getRandomizerSeed());
564 if (!strlen($notesPanelHTML)) {
565 $notesPanelHTML = $this->questionGUI->getNotesHTML();
568 $tpl->setCurrentBlock(
'notes_panel');
569 $tpl->setVariable(
'NOTES_PANEL', $notesPanelHTML);
570 $tpl->parseCurrentBlock();
An exception for terminatinating execution or to throw for unit testing.
const RENDER_PURPOSE_DEMOPLAY
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.
const CSS_CLASS_FEEDBACK_WRONG
const CSS_CLASS_FEEDBACK_CORRECT
const CMD_CONFIRM_REQUEST
const CMD_SHOW_LIST
command constants
const CMD_GATEWAY_CONFIRM_HINT_REQUEST
isShowBestSolutionRequired()
getQuestionNavigationHtml()
populateInstantResponseHeader(ilTemplate $tpl, $withFocusAnchor)
const CMD_GATEWAY_SHOW_HINT_LIST
populateQuestionOutput(ilTemplate $tpl)
showCmd($notesPanelHTML='')
populateSpecificQuestionFeedback(ilTemplate $tpl)
const TAB_ID_QUESTION_PREVIEW
populateGenericQuestionFeedback(ilTemplate $tpl)
handleInstantResponseRendering(ilTemplate $tpl)
handleQuestionActionCmd()
isShowReachedPointsRequired()
populatePreviewToolbar(ilTemplate $tpl)
initQuestion($questionId, $parentObjId)
const FEEDBACK_FOCUS_ANCHOR
gatewayConfirmHintRequestCmd()
initPreviewSession($userId, $questionId)
getQuestionAnswerShuffler()
const CMD_HANDLE_QUESTION_ACTION
const CMD_INSTANT_RESPONSE
populateSolutionOutput(ilTemplate $tpl)
isShowGenericQuestionFeedbackRequired()
isShowSpecificQuestionFeedbackRequired()
__construct(ilCtrl $ctrl, ilTabsGUI $tabs, ilTemplate $tpl, ilLanguage $lng, ilDBInterface $db, ilObjUser $user)
populateReachedPointsOutput(ilTemplate $tpl)
initPreviewSettings($parentRefId)
populateNotesPanel(ilTemplate $tpl, $notesPanelHTML)
This class provides processing control methods.
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true)
get content style path
special template class to simplify handling of ITX/PEAR
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.