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');
185 $notesGUI->enablePublicNotesDeletion(
true);
186 $notesPanelHTML = $this->ctrl->forwardCommand($notesGUI);
187 $this->
showCmd($notesPanelHTML);
193 $cmd = $this->ctrl->getCmd(self::CMD_SHOW) .
'Cmd';
204 return $this->ctrl->getFormAction($this, self::CMD_SHOW) .
'#' . self::FEEDBACK_FOCUS_ANCHOR;
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");
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"),
371 $tpl->
setVariable(
"REACHED_POINTS_FEEDBACK", $scoreInformation);
378 $this->ctrl->setReturnByClass(
'ilAssQuestionPageGUI',
'view');
379 $this->ctrl->setReturnByClass(
'ilObjQuestionPoolGUI',
'questions');
381 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
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);
407 $tpl->
setVariable(
'TXT_CORRECT_SOLUTION', $this->lng->txt(
'tst_best_solution_is'));
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)) {
450 $fb = $this->questionGUI->getSpecificFeedbackOutput(
451 (array) $this->previewSession->getParticipantsSolution()
461 if ($withFocusAnchor) {
463 $tpl->
setVariable(
'INSTANT_RESPONSE_FOCUS_ID', self::FEEDBACK_FOCUS_ANCHOR);
468 $tpl->
setVariable(
'INSTANT_RESPONSE_HEADER', $this->lng->txt(
'tst_feedback'));
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();
const CMD_HANDLE_QUESTION_ACTION
populateNotesPanel(ilTemplate $tpl, $notesPanelHTML)
populateQuestionOutput(ilTemplate $tpl)
This class provides processing control methods.
const CMD_CONFIRM_REQUEST
showCmd($notesPanelHTML='')
setEditPreview($a_editpreview)
Set Display first Edit tab, then Preview tab, instead of Page and Edit.
__construct(ilCtrl $ctrl, ilTabsGUI $tabs, ilTemplate $tpl, ilLanguage $lng, ilDBInterface $db, ilObjUser $user)
const CMD_INSTANT_RESPONSE
initPreviewSettings($parentRefId)
const CSS_CLASS_FEEDBACK_CORRECT
enablePublicNotes($a_enable=true)
enable public notes
isShowReachedPointsRequired()
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
isShowSpecificQuestionFeedbackRequired()
getQuestionAnswerShuffler()
handleQuestionActionCmd()
setVariable($variable, $value='')
Sets a variable value.
const FEEDBACK_FOCUS_ANCHOR
populateReachedPointsOutput(ilTemplate $tpl)
special template class to simplify handling of ITX/PEAR
populatePreviewToolbar(ilTemplate $tpl)
populateGenericQuestionFeedback(ilTemplate $tpl)
const RENDER_PURPOSE_DEMOPLAY
setRenderPageContainer($a_val)
Set render page container.
populateInstantResponseHeader(ilTemplate $tpl, $withFocusAnchor)
static getSyntaxStylePath()
get syntax style path
const CSS_CLASS_FEEDBACK_WRONG
static getContentStylePath($a_style_id, $add_random=true)
get content style path
setCurrentBlock($part="DEFAULT")
Überladene Funktion, die sich hier lokal noch den aktuellen Block merkt.
isShowBestSolutionRequired()
handleInstantResponseRendering(ilTemplate $tpl)
gatewayConfirmHintRequestCmd()
const CMD_SHOW_LIST
command constants
populateSolutionOutput(ilTemplate $tpl)
initQuestion($questionId, $parentObjId)
initPreviewSession($userId, $questionId)
isShowGenericQuestionFeedbackRequired()
getQuestionNavigationHtml()
const CMD_GATEWAY_SHOW_HINT_LIST
parseCurrentBlock($part="DEFAULT")
Überladene Funktion, die auf den aktuelle Block vorher noch ein replace ausführt public...
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.
const TAB_ID_QUESTION_PREVIEW
const CMD_GATEWAY_CONFIRM_HINT_REQUEST
populateSpecificQuestionFeedback(ilTemplate $tpl)