ILIAS  release_7 Revision v7.30-3-g800a261c036
ilAssQuestionPreviewGUI Class Reference
+ Collaboration diagram for ilAssQuestionPreviewGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilTabsGUI $tabs, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilDBInterface $db, ilObjUser $user, RBACServices $rbac_services)
 
 initQuestion ($questionId, $parentObjId)
 
 initPreviewSettings ($parentRefId)
 
 initPreviewSession ($userId, $questionId)
 
 initHintTracking ()
 
 initStyleSheets ()
 
 executeCommand ()
 
 saveQuestionSolution ()
 
 gatewayConfirmHintRequestCmd ()
 
 gatewayShowHintListCmd ()
 

Data Fields

const CMD_SHOW = 'show'
 
const CMD_RESET = 'reset'
 
const CMD_STATISTICS = 'assessment'
 
const CMD_INSTANT_RESPONSE = 'instantResponse'
 
const CMD_HANDLE_QUESTION_ACTION = 'handleQuestionAction'
 
const CMD_GATEWAY_CONFIRM_HINT_REQUEST = 'gatewayConfirmHintRequest'
 
const CMD_GATEWAY_SHOW_HINT_LIST = 'gatewayShowHintList'
 
const TAB_ID_QUESTION = 'question'
 
const FEEDBACK_FOCUS_ANCHOR = 'focus'
 

Protected Member Functions

 buildPreviewFormAction ()
 
 isCommentingRequired ()
 
 handleInstantResponseRendering (ilTemplate $tpl)
 
 populateReachedPointsOutput (ilTemplate $tpl)
 
 populateInstantResponseHeader (ilTemplate $tpl, $withFocusAnchor)
 
 populateInstantResponseMessage (ilTemplate $tpl, string $a_message)
 
 populateNotesPanel (ilTemplate $tpl, $notesPanelHTML)
 

Protected Attributes

 $ctrl
 
 $tabs
 
 $tpl
 
 $lng
 
 $db
 
 $user
 
 $questionGUI
 
 $questionOBJ
 
 $previewSettings
 
 $previewSession
 
 $hintTracking
 

Private Member Functions

 showCmd ($notesPanelHTML='')
 
 assessmentCmd ()
 
 resetCmd ()
 
 instantResponseCmd ()
 
 handleQuestionActionCmd ()
 
 populatePreviewToolbar (ilTemplate $tpl)
 
 populateQuestionOutput (ilTemplate $tpl)
 
 populateSolutionOutput (ilTemplate $tpl)
 
 getQuestionNavigationHtml ()
 
 populateGenericQuestionFeedback (ilTemplate $tpl)
 Populate the block for an instant generic feedback. More...
 
 populateSpecificQuestionFeedback (ilTemplate $tpl)
 Populate the block for an instant specific feedback. More...
 
 isShowBestSolutionRequired ()
 
 isShowGenericQuestionFeedbackRequired ()
 
 isShowSpecificQuestionFeedbackRequired ()
 
 isShowReachedPointsRequired ()
 
 getQuestionAnswerShuffler ()
 

Private Attributes

 $rbac_services
 

Detailed Description

Definition at line 33 of file class.ilAssQuestionPreviewGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionPreviewGUI::__construct ( ilCtrl  $ctrl,
ilTabsGUI  $tabs,
ilGlobalTemplateInterface  $tpl,
ilLanguage  $lng,
ilDBInterface  $db,
ilObjUser  $user,
RBACServices  $rbac_services 
)

Definition at line 107 of file class.ilAssQuestionPreviewGUI.php.

115 {
116 $this->ctrl = $ctrl;
117 $this->tabs = $tabs;
118 $this->tpl = $tpl;
119 $this->lng = $lng;
120 $this->db = $db;
121 $this->user = $user;
122 $this->rbac_services = $rbac_services;
123
124 $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
125 $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
126 }
user()
Definition: user.php:4
static getSyntaxStylePath()
get syntax style path
static getContentStylePath($a_style_id, $add_random=true, $add_token=true)
get content style path

References $ctrl, $db, $lng, $rbac_services, $tabs, $tpl, $user, ilObjStyleSheet\getContentStylePath(), ilObjStyleSheet\getSyntaxStylePath(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ assessmentCmd()

ilAssQuestionPreviewGUI::assessmentCmd ( )
private

Definition at line 331 of file class.ilAssQuestionPreviewGUI.php.

332 {
333 $this->tabs->activateTab('statistics');
334 $this->questionGUI->assessment();
335 }

◆ buildPreviewFormAction()

ilAssQuestionPreviewGUI::buildPreviewFormAction ( )
protected
Returns
string

Definition at line 299 of file class.ilAssQuestionPreviewGUI.php.

300 {
301 return $this->ctrl->getFormAction($this, self::CMD_SHOW) . '#' . self::FEEDBACK_FOCUS_ANCHOR;
302 }

References FEEDBACK_FOCUS_ANCHOR.

Referenced by showCmd().

+ Here is the caller graph for this function:

◆ executeCommand()

ilAssQuestionPreviewGUI::executeCommand ( )

Definition at line 244 of file class.ilAssQuestionPreviewGUI.php.

245 {
246 global $DIC; /* @var \ILIAS\DI\Container $DIC */
247 $ilHelp = $DIC['ilHelp']; /* @var ilHelpGUI $ilHelp */
248 $ilHelp->setScreenIdComponent('qpl');
249
250 $this->tabs->setTabActive(self::TAB_ID_QUESTION);
251
252 $this->lng->loadLanguageModule('content');
253
254 $nextClass = $this->ctrl->getNextClass($this);
255
256 switch ($nextClass) {
257 case 'ilassquestionhintrequestgui':
258 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
259 $gui = new ilAssQuestionHintRequestGUI($this, self::CMD_SHOW, $this->questionGUI, $this->hintTracking);
260
261 $this->ctrl->forwardCommand($gui);
262
263 break;
264
265 case 'ilassspecfeedbackpagegui':
266 case 'ilassgenfeedbackpagegui':
267 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackPageObjectCommandForwarder.php';
268 $forwarder = new ilAssQuestionFeedbackPageObjectCommandForwarder($this->questionOBJ, $this->ctrl, $this->tabs, $this->lng);
269 $forwarder->forward();
270 break;
271
272 case 'ilnotegui':
273 $notesGUI = new ilNoteGUI(
274 $this->questionOBJ->getObjId(),
275 $this->questionOBJ->getId(),
276 'quest',
277 false,
278 0,
279 false
280 );
281 $notesGUI->enablePublicNotes(true);
282 $notesGUI->enablePublicNotesDeletion(true);
283 $notesPanelHTML = $this->ctrl->forwardCommand($notesGUI);
284 $this->showCmd($notesPanelHTML);
285 break;
286
287
288 default:
289
290 $cmd = $this->ctrl->getCmd(self::CMD_SHOW) . 'Cmd';
291
292 $this->$cmd();
293 }
294 }
Notes GUI class.
global $DIC
Definition: goto.php:24

References $DIC, and showCmd().

+ Here is the call graph for this function:

◆ gatewayConfirmHintRequestCmd()

ilAssQuestionPreviewGUI::gatewayConfirmHintRequestCmd ( )

Definition at line 665 of file class.ilAssQuestionPreviewGUI.php.

666 {
667 if (!$this->saveQuestionSolution()) {
668 $this->previewSession->setInstantResponseActive(false);
669 $this->showCmd();
670 return;
671 }
672
673 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
674
675 $this->ctrl->redirectByClass(
676 'ilAssQuestionHintRequestGUI',
678 );
679 }

References ilAssQuestionHintRequestGUI\CMD_CONFIRM_REQUEST, saveQuestionSolution(), and showCmd().

+ Here is the call graph for this function:

◆ gatewayShowHintListCmd()

ilAssQuestionPreviewGUI::gatewayShowHintListCmd ( )

Definition at line 681 of file class.ilAssQuestionPreviewGUI.php.

682 {
683 if (!$this->saveQuestionSolution()) {
684 $this->previewSession->setInstantResponseActive(false);
685 $this->showCmd();
686 return;
687 }
688
689 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintRequestGUI.php';
690
691 $this->ctrl->redirectByClass(
692 'ilAssQuestionHintRequestGUI',
694 );
695 }

References ilAssQuestionHintRequestGUI\CMD_SHOW_LIST, saveQuestionSolution(), and showCmd().

+ Here is the call graph for this function:

◆ getQuestionAnswerShuffler()

ilAssQuestionPreviewGUI::getQuestionAnswerShuffler ( )
private
Returns
ilArrayElementShuffler

Definition at line 700 of file class.ilAssQuestionPreviewGUI.php.

701 {
702 require_once 'Services/Randomization/classes/class.ilArrayElementShuffler.php';
703 $shuffler = new ilArrayElementShuffler();
704
705 if (!$this->previewSession->randomizerSeedExists()) {
706 $this->previewSession->setRandomizerSeed($shuffler->buildRandomSeed());
707 }
708
709 $shuffler->setSeed($this->previewSession->getRandomizerSeed());
710
711 return $shuffler;
712 }

Referenced by populateQuestionOutput().

+ Here is the caller graph for this function:

◆ getQuestionNavigationHtml()

ilAssQuestionPreviewGUI::getQuestionNavigationHtml ( )
private

Definition at line 543 of file class.ilAssQuestionPreviewGUI.php.

544 {
545 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionRelatedNavigationBarGUI.php';
546 $navGUI = new ilAssQuestionRelatedNavigationBarGUI($this->ctrl, $this->lng);
547
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);
551
552 $navGUI->setInstantResponseEnabled($this->previewSettings->isInstantFeedbackNavigationRequired());
553 $navGUI->setHintProvidingEnabled($this->previewSettings->isHintProvidingEnabled());
554
555 $navGUI->setHintRequestsPossible($this->hintTracking->requestsPossible());
556 $navGUI->setHintRequestsExist($this->hintTracking->requestsExist());
557
558 return $this->ctrl->getHTML($navGUI);
559 }

Referenced by populateQuestionOutput().

+ Here is the caller graph for this function:

◆ handleInstantResponseRendering()

ilAssQuestionPreviewGUI::handleInstantResponseRendering ( ilTemplate  $tpl)
protected
See also
ilTestPlayerAbstractGUI::populateInstantResponseBlocks()

Definition at line 340 of file class.ilAssQuestionPreviewGUI.php.

341 {
342 $response_required = false;
343 $response_available = false;
344 $jump_to_response = false;
345
346 if ($this->isShowReachedPointsRequired()) {
347 $this->populateReachedPointsOutput($tpl);
348 $response_required = true;
349 $response_available = true;
350 $jump_to_response = true;
351 }
352
353 if ($this->isShowBestSolutionRequired()) {
354 $this->populateSolutionOutput($tpl);
355 $response_required = true;
356 $response_available = true;
357 $jump_to_response = true;
358 }
359
361 $response_required = true;
362 if ($this->populateGenericQuestionFeedback($tpl)) {
363 $response_available = true;
364 $jump_to_response = true;
365 }
366 }
367
369 $response_required = true;
370
371 if ($this->questionGUI->hasInlineFeedback()) {
372 // Don't jump to the feedback below the question if some feedback is shown within the question
373 $jump_to_response = false;
374 } else {
375 if ($this->populateSpecificQuestionFeedback($tpl)) {
376 $response_available = true;
377 $jump_to_response = true;
378 }
379 }
380 }
381
382 if ($response_required) {
383 $this->populateInstantResponseHeader($tpl, $jump_to_response);
384 if (!$response_available) {
385 if ($this->questionGUI->hasInlineFeedback()) {
387 $tpl,
388 $this->lng->txt('tst_feedback_is_given_inline')
389 );
390 } else {
392 $tpl,
393 $this->lng->txt('tst_feedback_not_available_for_answer')
394 );
395 }
396 }
397 }
398 }
populateInstantResponseHeader(ilTemplate $tpl, $withFocusAnchor)
populateSpecificQuestionFeedback(ilTemplate $tpl)
Populate the block for an instant specific feedback.
populateInstantResponseMessage(ilTemplate $tpl, string $a_message)
populateGenericQuestionFeedback(ilTemplate $tpl)
Populate the block for an instant generic feedback.

References isShowBestSolutionRequired(), isShowGenericQuestionFeedbackRequired(), isShowReachedPointsRequired(), isShowSpecificQuestionFeedbackRequired(), populateGenericQuestionFeedback(), populateInstantResponseHeader(), populateInstantResponseMessage(), populateReachedPointsOutput(), populateSolutionOutput(), and populateSpecificQuestionFeedback().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleQuestionActionCmd()

ilAssQuestionPreviewGUI::handleQuestionActionCmd ( )
private

Definition at line 423 of file class.ilAssQuestionPreviewGUI.php.

424 {
425 $this->questionOBJ->persistPreviewState($this->previewSession);
426 $this->ctrl->redirect($this, self::CMD_SHOW);
427 }

◆ initHintTracking()

ilAssQuestionPreviewGUI::initHintTracking ( )

Definition at line 225 of file class.ilAssQuestionPreviewGUI.php.

226 {
227 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewHintTracking.php';
228 $this->hintTracking = new ilAssQuestionPreviewHintTracking($this->db, $this->previewSession);
229 }

◆ initPreviewSession()

ilAssQuestionPreviewGUI::initPreviewSession (   $userId,
  $questionId 
)

Definition at line 217 of file class.ilAssQuestionPreviewGUI.php.

218 {
219 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewSession.php';
220 $this->previewSession = new ilAssQuestionPreviewSession($userId, $questionId);
221
222 $this->previewSession->init();
223 }

◆ initPreviewSettings()

ilAssQuestionPreviewGUI::initPreviewSettings (   $parentRefId)

Definition at line 209 of file class.ilAssQuestionPreviewGUI.php.

210 {
211 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewSettings.php';
212 $this->previewSettings = new ilAssQuestionPreviewSettings($parentRefId);
213
214 $this->previewSettings->init();
215 }

◆ initQuestion()

ilAssQuestionPreviewGUI::initQuestion (   $questionId,
  $parentObjId 
)

Definition at line 128 of file class.ilAssQuestionPreviewGUI.php.

129 {
130 require_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
131
132 $this->questionGUI = assQuestion::instantiateQuestionGUI($questionId);
133 $this->questionOBJ = $this->questionGUI->object;
134
135 $this->questionOBJ->setObjId($parentObjId);
136
137 if ($this->ctrl->getCmd() == 'editQuestion') {
138 $this->questionGUI->setQuestionTabs();
139 } else {
140 if ($_GET["q_id"]) {
141 $this->tabs->clearTargets();
142 $this->tabs->addTarget(
144 $this->ctrl->getLinkTargetByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW),
145 array(),
146 array('ilAssQuestionPreviewGUI')
147 );
148 // Assessment of questions sub menu entry
149 $q_type = $this->questionOBJ->getQuestionType();
150 $classname = $q_type . "GUI";
151 $this->tabs->addTarget(
152 "statistics",
153 $this->ctrl->getLinkTargetByClass('ilAssQuestionPreviewGUI', "assessment"),
154 array("assessment"),
155 $classname,
156 ""
157 );
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"];
162 }
163
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"
168 );
169 //BACK FROM Question Page to Test
170 } else {
172 //$this->tabs->setBackTarget($this->lng->txt("backtocallingtest"), $link);
173 $this->tabs->setBackTarget(
174 $this->lng->txt("backtocallingtest"),
175 "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id"
176 );
177 }
178 } elseif (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) {
179 $ref_id = (int) $_GET['calling_consumer'];
180 $consumer = ilObjectFactory::getInstanceByRefId($ref_id);
181 if ($consumer instanceof ilQuestionEditingFormConsumer) {
182 $this->tabs->setBackTarget(
183 $consumer->getQuestionEditingFormBackTargetLabel(),
184 $consumer->getQuestionEditingFormBackTarget($_GET['consumer_context'])
185 );
186 } else {
187 require_once 'Services/Link/classes/class.ilLink.php';
188 $this->tabs->setBackTarget($this->lng->txt("qpl"), ilLink::_getLink($ref_id));
189 }
190 //} elseif (true) {
191 // We're in the underworld and want to go back to the question page
192 } else {
193 $this->tabs->setBackTarget($this->lng->txt("backtocallingpool"), $this->ctrl->getLinkTargetByClass("ilobjquestionpoolgui", "questions"));
194 //BACK FROM Question Page to Pool
195 }
196 }
197 }
198 $this->questionGUI->outAdditionalOutput();
199
200 $this->questionGUI->populateJavascriptFilesRequiredForWorkForm($this->tpl);
201 $this->questionOBJ->setOutputType(OUTPUT_JAVASCRIPT); // TODO: remove including depending stuff
202
203 $this->questionGUI->setTargetGui($this);
204 $this->questionGUI->setQuestionActionCmd(self::CMD_HANDLE_QUESTION_ACTION);
205
206 $this->questionGUI->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_DEMOPLAY);
207 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_GET["client_id"]
static instantiateQuestionGUI($a_question_id)
Creates an instance of a question gui with a given question id.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getReturnToPageLink($q_id=null)
const OUTPUT_JAVASCRIPT

References $_GET, $GLOBALS, ilLink\_getLink(), CMD_SHOW, ilObjectFactory\getInstanceByRefId(), ilTestExpressPage\getReturnToPageLink(), assQuestion\instantiateQuestionGUI(), OUTPUT_JAVASCRIPT, assQuestionGUI\RENDER_PURPOSE_DEMOPLAY, and TAB_ID_QUESTION.

+ Here is the call graph for this function:

◆ initStyleSheets()

ilAssQuestionPreviewGUI::initStyleSheets ( )

Definition at line 231 of file class.ilAssQuestionPreviewGUI.php.

232 {
233 include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
234
235 $this->tpl->setCurrentBlock("ContentStyle");
236 $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
237 $this->tpl->parseCurrentBlock();
238
239 $this->tpl->setCurrentBlock("SyntaxStyle");
240 $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
241 $this->tpl->parseCurrentBlock();
242 }

References ilObjStyleSheet\getContentStylePath(), and ilObjStyleSheet\getSyntaxStylePath().

+ Here is the call graph for this function:

◆ instantResponseCmd()

ilAssQuestionPreviewGUI::instantResponseCmd ( )
private

Definition at line 412 of file class.ilAssQuestionPreviewGUI.php.

413 {
414 if ($this->saveQuestionSolution()) {
415 $this->previewSession->setInstantResponseActive(true);
416 } else {
417 $this->previewSession->setInstantResponseActive(false);
418 }
419
420 $this->ctrl->redirect($this, self::CMD_SHOW);
421 }

References saveQuestionSolution().

+ Here is the call graph for this function:

◆ isCommentingRequired()

ilAssQuestionPreviewGUI::isCommentingRequired ( )
protected

Definition at line 304 of file class.ilAssQuestionPreviewGUI.php.

305 {
306 if ($this->previewSettings->isTestRefId()) {
307 return false;
308 }
309 return (bool) $this->rbac_services->system()->checkAccess('write', (int) $_GET['ref_id']);
310 }

References $_GET.

Referenced by showCmd().

+ Here is the caller graph for this function:

◆ isShowBestSolutionRequired()

ilAssQuestionPreviewGUI::isShowBestSolutionRequired ( )
private

Definition at line 624 of file class.ilAssQuestionPreviewGUI.php.

625 {
626 if (!$this->previewSettings->isBestSolutionEnabled()) {
627 return false;
628 }
629
630 return $this->previewSession->isInstantResponseActive();
631 }

Referenced by handleInstantResponseRendering().

+ Here is the caller graph for this function:

◆ isShowGenericQuestionFeedbackRequired()

ilAssQuestionPreviewGUI::isShowGenericQuestionFeedbackRequired ( )
private

Definition at line 633 of file class.ilAssQuestionPreviewGUI.php.

634 {
635 if (!$this->previewSettings->isGenericFeedbackEnabled()) {
636 return false;
637 }
638
639 return $this->previewSession->isInstantResponseActive();
640 }

Referenced by handleInstantResponseRendering().

+ Here is the caller graph for this function:

◆ isShowReachedPointsRequired()

ilAssQuestionPreviewGUI::isShowReachedPointsRequired ( )
private

Definition at line 651 of file class.ilAssQuestionPreviewGUI.php.

652 {
653 if (!$this->previewSettings->isReachedPointsEnabled()) {
654 return false;
655 }
656
657 return $this->previewSession->isInstantResponseActive();
658 }

Referenced by handleInstantResponseRendering().

+ Here is the caller graph for this function:

◆ isShowSpecificQuestionFeedbackRequired()

ilAssQuestionPreviewGUI::isShowSpecificQuestionFeedbackRequired ( )
private

Definition at line 642 of file class.ilAssQuestionPreviewGUI.php.

643 {
644 if (!$this->previewSettings->isSpecificFeedbackEnabled()) {
645 return false;
646 }
647
648 return $this->previewSession->isInstantResponseActive();
649 }

Referenced by handleInstantResponseRendering(), and populateQuestionOutput().

+ Here is the caller graph for this function:

◆ populateGenericQuestionFeedback()

ilAssQuestionPreviewGUI::populateGenericQuestionFeedback ( ilTemplate  $tpl)
private

Populate the block for an instant generic feedback.

Returns
bool true, if there is some feedback populated

Definition at line 565 of file class.ilAssQuestionPreviewGUI.php.

565 : bool
566 {
567 if ($this->questionOBJ->isPreviewSolutionCorrect($this->previewSession)) {
568 $feedback = $this->questionGUI->getGenericFeedbackOutputForCorrectSolution();
570 } else {
571 $feedback = $this->questionGUI->getGenericFeedbackOutputForIncorrectSolution();
573 }
574
575 if (strlen($feedback)) {
576 $tpl->setCurrentBlock('instant_feedback_generic');
577 $tpl->setVariable('GENERIC_FEEDBACK', $feedback);
578 $tpl->setVariable('ILC_FB_CSS_CLASS', $cssClass);
579 $tpl->parseCurrentBlock();
580 return true;
581 }
582 return false;
583 }

References $tpl, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, and ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG.

Referenced by handleInstantResponseRendering().

+ Here is the caller graph for this function:

◆ populateInstantResponseHeader()

ilAssQuestionPreviewGUI::populateInstantResponseHeader ( ilTemplate  $tpl,
  $withFocusAnchor 
)
protected

Definition at line 604 of file class.ilAssQuestionPreviewGUI.php.

605 {
606 if ($withFocusAnchor) {
607 $tpl->setCurrentBlock('inst_resp_id');
608 $tpl->setVariable('INSTANT_RESPONSE_FOCUS_ID', self::FEEDBACK_FOCUS_ANCHOR);
609 $tpl->parseCurrentBlock();
610 }
611
612 $tpl->setCurrentBlock('instant_response_header');
613 $tpl->setVariable('INSTANT_RESPONSE_HEADER', $this->lng->txt('tst_feedback'));
614 $tpl->parseCurrentBlock();
615 }

References $tpl.

Referenced by handleInstantResponseRendering().

+ Here is the caller graph for this function:

◆ populateInstantResponseMessage()

ilAssQuestionPreviewGUI::populateInstantResponseMessage ( ilTemplate  $tpl,
string  $a_message 
)
protected

Definition at line 617 of file class.ilAssQuestionPreviewGUI.php.

618 {
619 $tpl->setCurrentBlock('instant_response_message');
620 $tpl->setVariable('INSTANT_RESPONSE_MESSAGE', $a_message);
621 $tpl->parseCurrentBlock();
622 }

References $tpl.

Referenced by handleInstantResponseRendering().

+ Here is the caller graph for this function:

◆ populateNotesPanel()

ilAssQuestionPreviewGUI::populateNotesPanel ( ilTemplate  $tpl,
  $notesPanelHTML 
)
protected

Definition at line 714 of file class.ilAssQuestionPreviewGUI.php.

715 {
716 if (!strlen($notesPanelHTML)) {
717 $notesPanelHTML = $this->questionGUI->getNotesHTML();
718 }
719
720 $tpl->setCurrentBlock('notes_panel');
721 $tpl->setVariable('NOTES_PANEL', $notesPanelHTML);
722 $tpl->parseCurrentBlock();
723 }

References $tpl.

Referenced by showCmd().

+ Here is the caller graph for this function:

◆ populatePreviewToolbar()

ilAssQuestionPreviewGUI::populatePreviewToolbar ( ilTemplate  $tpl)
private

Definition at line 429 of file class.ilAssQuestionPreviewGUI.php.

430 {
431 $toolbarGUI = new ilAssQuestionPreviewToolbarGUI($this->lng);
432
433 $toolbarGUI->setFormAction($this->ctrl->getFormAction($this, self::CMD_SHOW));
434 $toolbarGUI->setResetPreviewCmd(self::CMD_RESET);
435
436 // Check Permissions first, some Toolbar Actions are only available for write access
437 if ($this->rbac_services->system()->checkAccess('write', (int) $_GET['ref_id'])) {
438 $toolbarGUI->setEditPageCmd(
439 $this->ctrl->getLinkTargetByClass('ilAssQuestionPageGUI', 'edit')
440 );
441
442 $toolbarGUI->setEditQuestionCmd(
443 $this->ctrl->getLinkTargetByClass(
444 array('ilrepositorygui','ilobjquestionpoolgui', get_class($this->questionGUI)),
445 'editQuestion'
446 )
447 );
448 }
449 $toolbarGUI->build();
450
451 $tpl->setVariable('PREVIEW_TOOLBAR', $this->ctrl->getHTML($toolbarGUI));
452 }

References $_GET, and $tpl.

Referenced by showCmd().

+ Here is the caller graph for this function:

◆ populateQuestionOutput()

ilAssQuestionPreviewGUI::populateQuestionOutput ( ilTemplate  $tpl)
private

Definition at line 454 of file class.ilAssQuestionPreviewGUI.php.

455 {
456 // FOR WHAT EXACTLY IS THIS USEFUL?
457 $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
458 $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
459
460 include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
461 $pageGUI = new ilAssQuestionPageGUI($this->questionOBJ->getId());
462 $pageGUI->setRenderPageContainer(false);
463 $pageGUI->setEditPreview(true);
464 $pageGUI->setEnabledTabs(false);
465
466 // FOR WHICH SITUATION IS THIS WORKAROUND NECCESSARY? (sure .. imagemaps, but where this can be done?)
467 if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST['editImagemapForward_x'])) { // workaround for page edit imagemaps, keep in mind
468 $this->ctrl->setCmdClass(get_class($pageGUI));
469 $this->ctrl->setCmd('preview');
470 }
471
472 $this->questionGUI->setPreviewSession($this->previewSession);
473 $this->questionGUI->object->setShuffler($this->getQuestionAnswerShuffler());
474
475 $questionHtml = $this->questionGUI->getPreview(true, $this->isShowSpecificQuestionFeedbackRequired());
476 $this->questionGUI->magicAfterTestOutput();
477
478 $questionHtml .= $this->getQuestionNavigationHtml();
479
480 $pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $questionHtml));
481
482 //$pageGUI->setHeader($this->questionOBJ->getTitle()); // NO ADDITIONAL HEADER
483 $pageGUI->setPresentationTitle($this->questionOBJ->getTitle());
484
485 //$pageGUI->setTemplateTargetVar("ADM_CONTENT"); // NOT REQUIRED, OR IS?
486
487 $tpl->setVariable('QUESTION_OUTPUT', $pageGUI->preview());
488 }
$_POST["username"]
Question page GUI class.

References $_POST, $tpl, getQuestionAnswerShuffler(), getQuestionNavigationHtml(), and isShowSpecificQuestionFeedbackRequired().

Referenced by showCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateReachedPointsOutput()

ilAssQuestionPreviewGUI::populateReachedPointsOutput ( ilTemplate  $tpl)
protected

Definition at line 490 of file class.ilAssQuestionPreviewGUI.php.

491 {
492 $reachedPoints = $this->questionOBJ->calculateReachedPointsFromPreviewSession($this->previewSession);
493 $maxPoints = $this->questionOBJ->getMaximumPoints();
494
495 $scoreInformation = sprintf(
496 $this->lng->txt("you_received_a_of_b_points"),
497 $reachedPoints,
498 $maxPoints
499 );
500
501 $tpl->setCurrentBlock("reached_points_feedback");
502 $tpl->setVariable("REACHED_POINTS_FEEDBACK", $scoreInformation);
503 $tpl->parseCurrentBlock();
504 }

References $tpl.

Referenced by handleInstantResponseRendering().

+ Here is the caller graph for this function:

◆ populateSolutionOutput()

ilAssQuestionPreviewGUI::populateSolutionOutput ( ilTemplate  $tpl)
private

Definition at line 506 of file class.ilAssQuestionPreviewGUI.php.

507 {
508 // FOR WHAT EXACTLY IS THIS USEFUL?
509 $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
510 $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
511
512 include_once("./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php");
513 $pageGUI = new ilAssQuestionPageGUI($this->questionOBJ->getId());
514
515 $pageGUI->setEditPreview(true);
516 $pageGUI->setEnabledTabs(false);
517
518 // FOR WHICH SITUATION IS THIS WORKAROUND NECCESSARY? (sure .. imagemaps, but where this can be done?)
519 if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST['editImagemapForward_x'])) { // workaround for page edit imagemaps, keep in mind
520 $this->ctrl->setCmdClass(get_class($pageGUI));
521 $this->ctrl->setCmd('preview');
522 }
523
524 $this->questionGUI->setPreviewSession($this->previewSession);
525
526 $pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $this->questionGUI->getSolutionOutput(0, null, false, false, true, false, true, false, false)));
527
528 //$pageGUI->setHeader($this->questionOBJ->getTitle()); // NO ADDITIONAL HEADER
529 //$pageGUI->setPresentationTitle($this->questionOBJ->getTitle());
530
531 //$pageGUI->setTemplateTargetVar("ADM_CONTENT"); // NOT REQUIRED, OR IS?
532
533 $output = $this->questionGUI->getSolutionOutput(0, null, false, false, true, false, true, false, false);
534 //$output = $pageGUI->preview();
535 //$output = str_replace('<h1 class="ilc_page_title_PageTitle"></h1>', '', $output);
536
537 $tpl->setCurrentBlock('solution_output');
538 $tpl->setVariable('TXT_CORRECT_SOLUTION', $this->lng->txt('tst_best_solution_is'));
539 $tpl->setVariable('SOLUTION_OUTPUT', $output);
540 $tpl->parseCurrentBlock();
541 }

References $_POST, and $tpl.

Referenced by handleInstantResponseRendering().

+ Here is the caller graph for this function:

◆ populateSpecificQuestionFeedback()

ilAssQuestionPreviewGUI::populateSpecificQuestionFeedback ( ilTemplate  $tpl)
private

Populate the block for an instant specific feedback.

Returns
bool true, if there is some feedback populated

Definition at line 589 of file class.ilAssQuestionPreviewGUI.php.

589 : bool
590 {
591 $fb = $this->questionGUI->getSpecificFeedbackOutput(
592 (array) $this->previewSession->getParticipantsSolution()
593 );
594
595 if (!empty($fb)) {
596 $tpl->setCurrentBlock('instant_feedback_specific');
597 $tpl->setVariable('ANSWER_FEEDBACK', $fb);
598 $tpl->parseCurrentBlock();
599 return true;
600 }
601 return false;
602 }

References $tpl.

Referenced by handleInstantResponseRendering().

+ Here is the caller graph for this function:

◆ resetCmd()

ilAssQuestionPreviewGUI::resetCmd ( )
private

Definition at line 400 of file class.ilAssQuestionPreviewGUI.php.

401 {
402 $this->previewSession->setRandomizerSeed(null);
403 $this->previewSession->setParticipantsSolution(null);
404 $this->previewSession->resetRequestedHints();
405 $this->previewSession->setInstantResponseActive(false);
406
407 ilUtil::sendInfo($this->lng->txt('qst_preview_reset_msg'), true);
408
409 $this->ctrl->redirect($this, self::CMD_SHOW);
410 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ saveQuestionSolution()

ilAssQuestionPreviewGUI::saveQuestionSolution ( )

Definition at line 660 of file class.ilAssQuestionPreviewGUI.php.

661 {
662 return $this->questionOBJ->persistPreviewState($this->previewSession);
663 }

Referenced by gatewayConfirmHintRequestCmd(), gatewayShowHintListCmd(), and instantResponseCmd().

+ Here is the caller graph for this function:

◆ showCmd()

ilAssQuestionPreviewGUI::showCmd (   $notesPanelHTML = '')
private

Definition at line 312 of file class.ilAssQuestionPreviewGUI.php.

313 {
314 $tpl = new ilTemplate('tpl.qpl_question_preview.html', true, true, 'Modules/TestQuestionPool');
315
316 $tpl->setVariable('PREVIEW_FORMACTION', $this->buildPreviewFormAction());
317
319
321
323
324 if ($this->isCommentingRequired()) {
325 $this->populateNotesPanel($tpl, $notesPanelHTML);
326 }
327
328 $this->tpl->setContent($tpl->get());
329 }
populateNotesPanel(ilTemplate $tpl, $notesPanelHTML)
special template class to simplify handling of ITX/PEAR

References $tpl, buildPreviewFormAction(), handleInstantResponseRendering(), isCommentingRequired(), populateNotesPanel(), populatePreviewToolbar(), and populateQuestionOutput().

Referenced by executeCommand(), gatewayConfirmHintRequestCmd(), and gatewayShowHintListCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilAssQuestionPreviewGUI::$ctrl
protected

Definition at line 55 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct().

◆ $db

ilAssQuestionPreviewGUI::$db
protected

Definition at line 75 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct().

◆ $hintTracking

ilAssQuestionPreviewGUI::$hintTracking
protected

Definition at line 105 of file class.ilAssQuestionPreviewGUI.php.

◆ $lng

ilAssQuestionPreviewGUI::$lng
protected

Definition at line 70 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct().

◆ $previewSession

ilAssQuestionPreviewGUI::$previewSession
protected

Definition at line 100 of file class.ilAssQuestionPreviewGUI.php.

◆ $previewSettings

ilAssQuestionPreviewGUI::$previewSettings
protected

Definition at line 95 of file class.ilAssQuestionPreviewGUI.php.

◆ $questionGUI

ilAssQuestionPreviewGUI::$questionGUI
protected

Definition at line 85 of file class.ilAssQuestionPreviewGUI.php.

◆ $questionOBJ

ilAssQuestionPreviewGUI::$questionOBJ
protected

Definition at line 90 of file class.ilAssQuestionPreviewGUI.php.

◆ $rbac_services

ilAssQuestionPreviewGUI::$rbac_services
private

Definition at line 50 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct().

◆ $tabs

ilAssQuestionPreviewGUI::$tabs
protected

Definition at line 60 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct().

◆ $tpl

◆ $user

ilAssQuestionPreviewGUI::$user
protected

Definition at line 80 of file class.ilAssQuestionPreviewGUI.php.

Referenced by __construct().

◆ CMD_GATEWAY_CONFIRM_HINT_REQUEST

const ilAssQuestionPreviewGUI::CMD_GATEWAY_CONFIRM_HINT_REQUEST = 'gatewayConfirmHintRequest'

Definition at line 40 of file class.ilAssQuestionPreviewGUI.php.

◆ CMD_GATEWAY_SHOW_HINT_LIST

const ilAssQuestionPreviewGUI::CMD_GATEWAY_SHOW_HINT_LIST = 'gatewayShowHintList'

Definition at line 41 of file class.ilAssQuestionPreviewGUI.php.

◆ CMD_HANDLE_QUESTION_ACTION

const ilAssQuestionPreviewGUI::CMD_HANDLE_QUESTION_ACTION = 'handleQuestionAction'

Definition at line 39 of file class.ilAssQuestionPreviewGUI.php.

◆ CMD_INSTANT_RESPONSE

const ilAssQuestionPreviewGUI::CMD_INSTANT_RESPONSE = 'instantResponse'

Definition at line 38 of file class.ilAssQuestionPreviewGUI.php.

◆ CMD_RESET

const ilAssQuestionPreviewGUI::CMD_RESET = 'reset'

Definition at line 36 of file class.ilAssQuestionPreviewGUI.php.

◆ CMD_SHOW

◆ CMD_STATISTICS

const ilAssQuestionPreviewGUI::CMD_STATISTICS = 'assessment'

◆ FEEDBACK_FOCUS_ANCHOR

const ilAssQuestionPreviewGUI::FEEDBACK_FOCUS_ANCHOR = 'focus'

Definition at line 45 of file class.ilAssQuestionPreviewGUI.php.

Referenced by buildPreviewFormAction().

◆ TAB_ID_QUESTION

const ilAssQuestionPreviewGUI::TAB_ID_QUESTION = 'question'

Definition at line 43 of file class.ilAssQuestionPreviewGUI.php.

Referenced by initQuestion().


The documentation for this class was generated from the following file: