130 require_once
'Modules/TestQuestionPool/classes/class.assQuestion.php';
133 $this->questionOBJ = $this->questionGUI->object;
135 $this->questionOBJ->setObjId($parentObjId);
137 if ($this->ctrl->getCmd() ==
'editQuestion') {
138 $this->questionGUI->setQuestionTabs();
141 $this->tabs->clearTargets();
142 $this->tabs->addTarget(
146 array(
'ilAssQuestionPreviewGUI')
149 $q_type = $this->questionOBJ->getQuestionType();
150 $classname = $q_type .
"GUI";
151 $this->tabs->addTarget(
153 $this->ctrl->getLinkTargetByClass(
'ilAssQuestionPreviewGUI',
"assessment"),
158 if ((
$_GET[
"calling_test"] > 0) || (
$_GET[
"test_ref_id"] > 0)) {
159 $ref_id =
$_GET[
"calling_test"];
160 if (strlen($ref_id) == 0) {
161 $ref_id =
$_GET[
"test_ref_id"];
164 if (!
$_GET[
'test_express_mode'] && !
$GLOBALS[
'___test_express_mode']) {
165 $this->tabs->setBackTarget(
166 $this->lng->txt(
"backtocallingtest"),
167 "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id" 173 $this->tabs->setBackTarget(
174 $this->lng->txt(
"backtocallingtest"),
175 "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id" 178 } elseif (isset(
$_GET[
'calling_consumer']) && (
int)
$_GET[
'calling_consumer']) {
179 $ref_id = (int) $_GET[
'calling_consumer'];
182 $this->tabs->setBackTarget(
183 $consumer->getQuestionEditingFormBackTargetLabel(),
184 $consumer->getQuestionEditingFormBackTarget($_GET[
'consumer_context'])
187 require_once
'Services/Link/classes/class.ilLink.php';
188 $this->tabs->setBackTarget($this->lng->txt(
"qpl"),
ilLink::_getLink($ref_id));
193 $this->tabs->setBackTarget($this->lng->txt(
"backtocallingpool"), $this->ctrl->getLinkTargetByClass(
"ilobjquestionpoolgui",
"questions"));
198 $this->questionGUI->outAdditionalOutput();
200 $this->questionGUI->populateJavascriptFilesRequiredForWorkForm($this->tpl);
203 $this->questionGUI->setTargetGui($this);
204 $this->questionGUI->setQuestionActionCmd(self::CMD_HANDLE_QUESTION_ACTION);
211 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewSettings.php';
214 $this->previewSettings->init();
219 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewSession.php';
222 $this->previewSession->init();
227 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewHintTracking.php';
233 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
235 $this->tpl->setCurrentBlock(
"ContentStyle");
237 $this->tpl->parseCurrentBlock();
239 $this->tpl->setCurrentBlock(
"SyntaxStyle");
241 $this->tpl->parseCurrentBlock();
247 $ilHelp = $DIC[
'ilHelp'];
248 $ilHelp->setScreenIdComponent(
'qpl');
250 $this->tabs->setTabActive(self::TAB_ID_QUESTION);
252 $this->lng->loadLanguageModule(
'content');
254 $nextClass = $this->ctrl->getNextClass($this);
256 switch ($nextClass) {
257 case 'ilassquestionhintrequestgui':
258 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
261 $this->ctrl->forwardCommand($gui);
265 case 'ilassspecfeedbackpagegui':
266 case 'ilassgenfeedbackpagegui':
267 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackPageObjectCommandForwarder.php';
269 $forwarder->forward();
274 $this->questionOBJ->getObjId(),
275 $this->questionOBJ->getId(),
282 $notesGUI->enablePublicNotesDeletion(
true);
283 $notesPanelHTML = $this->ctrl->forwardCommand($notesGUI);
284 $this->
showCmd($notesPanelHTML);
290 $cmd = $this->ctrl->getCmd(self::CMD_SHOW) .
'Cmd';
301 return $this->ctrl->getFormAction($this, self::CMD_SHOW) .
'#' . self::FEEDBACK_FOCUS_ANCHOR;
306 if ($this->previewSettings->isTestRefId()) {
309 return (
bool) $this->rbac_services->system()->checkAccess(
'write', (
int)
$_GET[
'ref_id']);
312 private function showCmd($notesPanelHTML =
'')
314 $tpl =
new ilTemplate(
'tpl.qpl_question_preview.html',
true,
true,
'Modules/TestQuestionPool');
328 $this->tpl->setContent(
$tpl->get());
333 $this->tabs->activateTab(
'statistics');
334 $this->questionGUI->assessment();
342 $response_required =
false;
343 $response_available =
false;
344 $jump_to_response =
false;
348 $response_required =
true;
349 $response_available =
true;
350 $jump_to_response =
true;
355 $response_required =
true;
356 $response_available =
true;
357 $jump_to_response =
true;
361 $response_required =
true;
363 $response_available =
true;
364 $jump_to_response =
true;
369 $response_required =
true;
371 if ($this->questionGUI->hasInlineFeedback()) {
373 $jump_to_response =
false;
376 $response_available =
true;
377 $jump_to_response =
true;
382 if ($response_required) {
384 if (!$response_available) {
385 if ($this->questionGUI->hasInlineFeedback()) {
388 $this->lng->txt(
'tst_feedback_is_given_inline')
393 $this->lng->txt(
'tst_feedback_not_available_for_answer')
402 $this->previewSession->setRandomizerSeed(null);
403 $this->previewSession->setParticipantsSolution(null);
404 $this->previewSession->resetRequestedHints();
405 $this->previewSession->setInstantResponseActive(
false);
409 $this->ctrl->redirect($this, self::CMD_SHOW);
415 $this->previewSession->setInstantResponseActive(
true);
417 $this->previewSession->setInstantResponseActive(
false);
420 $this->ctrl->redirect($this, self::CMD_SHOW);
425 $this->questionOBJ->persistPreviewState($this->previewSession);
426 $this->ctrl->redirect($this, self::CMD_SHOW);
433 $toolbarGUI->setFormAction($this->ctrl->getFormAction($this, self::CMD_SHOW));
434 $toolbarGUI->setResetPreviewCmd(self::CMD_RESET);
437 if ($this->rbac_services->system()->checkAccess(
'write', (
int)
$_GET[
'ref_id'])) {
438 $toolbarGUI->setEditPageCmd(
439 $this->ctrl->getLinkTargetByClass(
'ilAssQuestionPageGUI',
'edit')
442 $toolbarGUI->setEditQuestionCmd(
443 $this->ctrl->getLinkTargetByClass(
444 array(
'ilrepositorygui',
'ilobjquestionpoolgui', get_class($this->questionGUI)),
449 $toolbarGUI->build();
451 $tpl->
setVariable(
'PREVIEW_TOOLBAR', $this->ctrl->getHTML($toolbarGUI));
457 $this->ctrl->setReturnByClass(
'ilAssQuestionPageGUI',
'view');
458 $this->ctrl->setReturnByClass(
'ilObjQuestionPoolGUI',
'questions');
460 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
463 $pageGUI->setEditPreview(
true);
464 $pageGUI->setEnabledTabs(
false);
467 if (strlen($this->ctrl->getCmd()) == 0 && !isset(
$_POST[
'editImagemapForward_x'])) {
468 $this->ctrl->setCmdClass(get_class($pageGUI));
469 $this->ctrl->setCmd(
'preview');
472 $this->questionGUI->setPreviewSession($this->previewSession);
476 $this->questionGUI->magicAfterTestOutput();
480 $pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $questionHtml));
483 $pageGUI->setPresentationTitle($this->questionOBJ->getTitle());
487 $tpl->
setVariable(
'QUESTION_OUTPUT', $pageGUI->preview());
492 $reachedPoints = $this->questionOBJ->calculateReachedPointsFromPreviewSession($this->previewSession);
493 $maxPoints = $this->questionOBJ->getMaximumPoints();
495 $scoreInformation = sprintf(
496 $this->lng->txt(
"you_received_a_of_b_points"),
502 $tpl->
setVariable(
"REACHED_POINTS_FEEDBACK", $scoreInformation);
509 $this->ctrl->setReturnByClass(
'ilAssQuestionPageGUI',
'view');
510 $this->ctrl->setReturnByClass(
'ilObjQuestionPoolGUI',
'questions');
512 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
516 $pageGUI->setEnabledTabs(
false);
519 if (strlen($this->ctrl->getCmd()) == 0 && !isset(
$_POST[
'editImagemapForward_x'])) {
520 $this->ctrl->setCmdClass(get_class($pageGUI));
521 $this->ctrl->setCmd(
'preview');
524 $this->questionGUI->setPreviewSession($this->previewSession);
526 $pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $this->questionGUI->getSolutionOutput(0, null,
false,
false,
true,
false,
true,
false,
false)));
533 $output = $this->questionGUI->getSolutionOutput(0, null,
false,
false,
true,
false,
true,
false,
false);
538 $tpl->
setVariable(
'TXT_CORRECT_SOLUTION', $this->lng->txt(
'tst_best_solution_is'));
545 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionRelatedNavigationBarGUI.php';
548 $navGUI->setInstantResponseCmd(self::CMD_INSTANT_RESPONSE);
549 $navGUI->setHintRequestCmd(self::CMD_GATEWAY_CONFIRM_HINT_REQUEST);
550 $navGUI->setHintListCmd(self::CMD_GATEWAY_SHOW_HINT_LIST);
552 $navGUI->setInstantResponseEnabled($this->previewSettings->isInstantFeedbackNavigationRequired());
553 $navGUI->setHintProvidingEnabled($this->previewSettings->isHintProvidingEnabled());
555 $navGUI->setHintRequestsPossible($this->hintTracking->requestsPossible());
556 $navGUI->setHintRequestsExist($this->hintTracking->requestsExist());
558 return $this->ctrl->getHTML($navGUI);
567 if ($this->questionOBJ->isPreviewSolutionCorrect($this->previewSession)) {
568 $feedback = $this->questionGUI->getGenericFeedbackOutputForCorrectSolution();
571 $feedback = $this->questionGUI->getGenericFeedbackOutputForIncorrectSolution();
575 if (strlen($feedback)) {
591 $fb = $this->questionGUI->getSpecificFeedbackOutput(
592 (array) $this->previewSession->getParticipantsSolution()
606 if ($withFocusAnchor) {
608 $tpl->
setVariable(
'INSTANT_RESPONSE_FOCUS_ID', self::FEEDBACK_FOCUS_ANCHOR);
613 $tpl->
setVariable(
'INSTANT_RESPONSE_HEADER', $this->lng->txt(
'tst_feedback'));
620 $tpl->
setVariable(
'INSTANT_RESPONSE_MESSAGE', $a_message);
626 if (!$this->previewSettings->isBestSolutionEnabled()) {
630 return $this->previewSession->isInstantResponseActive();
635 if (!$this->previewSettings->isGenericFeedbackEnabled()) {
639 return $this->previewSession->isInstantResponseActive();
644 if (!$this->previewSettings->isSpecificFeedbackEnabled()) {
648 return $this->previewSession->isInstantResponseActive();
653 if (!$this->previewSettings->isReachedPointsEnabled()) {
657 return $this->previewSession->isInstantResponseActive();
662 return $this->questionOBJ->persistPreviewState($this->previewSession);
668 $this->previewSession->setInstantResponseActive(
false);
673 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
675 $this->ctrl->redirectByClass(
676 'ilAssQuestionHintRequestGUI',
684 $this->previewSession->setInstantResponseActive(
false);
689 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
691 $this->ctrl->redirectByClass(
692 'ilAssQuestionHintRequestGUI',
702 require_once
'Services/Randomization/classes/class.ilArrayElementShuffler.php';
705 if (!$this->previewSession->randomizerSeedExists()) {
706 $this->previewSession->setRandomizerSeed($shuffler->buildRandomSeed());
709 $shuffler->setSeed($this->previewSession->getRandomizerSeed());
716 if (!strlen($notesPanelHTML)) {
717 $notesPanelHTML = $this->questionGUI->getNotesHTML();
const CMD_HANDLE_QUESTION_ACTION
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path
populateNotesPanel(ilTemplate $tpl, $notesPanelHTML)
populateQuestionOutput(ilTemplate $tpl)
__construct(ilCtrl $ctrl, ilTabsGUI $tabs, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilDBInterface $db, ilObjUser $user, RBACServices $rbac_services)
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.
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.
static getReturnToPageLink($q_id=null)
const FEEDBACK_FOCUS_ANCHOR
populateReachedPointsOutput(ilTemplate $tpl)
populatePreviewToolbar(ilTemplate $tpl)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Provides fluid interface to RBAC services.
populateGenericQuestionFeedback(ilTemplate $tpl)
Populate the block for an instant generic feedback.
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
populateInstantResponseMessage(ilTemplate $tpl, string $a_message)
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initQuestion($questionId, $parentObjId)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
initPreviewSession($userId, $questionId)
isShowGenericQuestionFeedbackRequired()
getQuestionNavigationHtml()
const CMD_GATEWAY_SHOW_HINT_LIST
static _getLink($a_ref_id, $a_type='', $a_params=array(), $append="")
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 CMD_GATEWAY_CONFIRM_HINT_REQUEST
populateSpecificQuestionFeedback(ilTemplate $tpl)
Populate the block for an instant specific feedback.