ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilAssQuestionPreviewGUI Class Reference
+ Collaboration diagram for ilAssQuestionPreviewGUI:

Public Member Functions

 __construct (private ilCtrl $ctrl, private ilRbacSystem $rbac_system, private ilTabsGUI $tabs, private ilGlobalTemplateInterface $tpl, private ilLanguage $lng, private ilDBInterface $db, private ilObjUser $user, private RandomGroup $randomGroup, private GlobalScreen $global_screen, private HTTPServices $http, private Refinery $refinery)
 
 initQuestion ($questionId, $parentObjId)
 
 getObject ()
 
 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)
 
 populateCommentsPanel (ilTemplate $tpl, string $comments_panel_html)
 

Private Member Functions

 showCmd (string $notes_panel_html='')
 
 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

assQuestionGUI $questionGUI
 
assQuestion $questionOBJ
 
ilAssQuestionPreviewSettings $previewSettings = null
 
ilAssQuestionPreviewSession $previewSession = null
 
ilAssQuestionPreviewHintTracking $hintTracking = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionPreviewGUI::__construct ( private ilCtrl  $ctrl,
private ilRbacSystem  $rbac_system,
private ilTabsGUI  $tabs,
private ilGlobalTemplateInterface  $tpl,
private ilLanguage  $lng,
private ilDBInterface  $db,
private ilObjUser  $user,
private RandomGroup  $randomGroup,
private GlobalScreen  $global_screen,
private HTTPServices  $http,
private Refinery  $refinery 
)

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

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

72  {
73  $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
74  $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
75  }
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
+ Here is the call graph for this function:

Member Function Documentation

◆ assessmentCmd()

ilAssQuestionPreviewGUI::assessmentCmd ( )
private

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

References ILIAS\Repository\tabs().

276  {
277  $this->tabs->activateTab('statistics');
278  $this->questionGUI->assessment();
279  }
+ Here is the call graph for this function:

◆ buildPreviewFormAction()

ilAssQuestionPreviewGUI::buildPreviewFormAction ( )
protected
Returns
string

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

References ILIAS\Repository\ctrl().

Referenced by showCmd().

241  : string
242  {
243  return $this->ctrl->getFormAction($this, self::CMD_SHOW) . '#' . self::FEEDBACK_FOCUS_ANCHOR;
244  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilAssQuestionPreviewGUI::executeCommand ( )

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

References $DIC, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), showCmd(), and ILIAS\Repository\tabs().

173  : void
174  {
175  global $DIC;
176  $ilHelp = $DIC['ilHelp'];
177  $ilHelp->setScreenIdComponent('qpl');
178 
179  $this->tabs->setTabActive(self::TAB_ID_QUESTION);
180 
181  $this->lng->loadLanguageModule('content');
182 
183  $nextClass = $this->ctrl->getNextClass($this);
184 
185  switch ($nextClass) {
186  case 'ilassquestionhintrequestgui':
187  $gui = new ilAssQuestionHintRequestGUI(
188  $this,
189  self::CMD_SHOW,
190  $this->questionGUI,
191  $this->hintTracking,
192  $this->ctrl,
193  $this->lng,
194  $this->tpl,
195  $this->tabs,
196  $this->global_screen
197  );
198  $this->ctrl->forwardCommand($gui);
199  break;
200  case 'ilassspecfeedbackpagegui':
201  case 'ilassgenfeedbackpagegui':
202  $page_id = $this->http->wrapper()->query()->retrieve(
203  'pg_id',
204  $this->refinery->byTrying([
205  $this->refinery->kindlyTo()->int(),
206  $this->refinery->always(null)
207  ])
208  );
209 
210  if ($this->ctrl->getCmd() === 'displayMediaFullscreen'
211  && $page_id !== null) {
212 
213  (new ilPageObjectGUI(
214  $nextClass === 'ilassgenfeedbackpagegui' ? 'qfbg' : 'qfbs',
215  $page_id
216  ))->displayMediaFullscreen();
217  break;
218  }
219 
221  $this->questionOBJ,
222  $this->ctrl,
223  $this->tabs,
224  $this->lng
225  ))->forward();
226  break;
227  case 'ilcommentgui':
228  $comment_gui = new ilCommentGUI($this->questionOBJ->getObjId(), $this->questionOBJ->getId(), 'quest');
229  $comments_panel_html = $this->ctrl->forwardCommand($comment_gui);
230  $this->showCmd($comments_panel_html);
231  break;
232  default:
233  $cmd = $this->ctrl->getCmd(self::CMD_SHOW) . 'Cmd';
234  $this->$cmd();
235  }
236  }
Class ilPageObjectGUI.
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
Comment GUI.
showCmd(string $notes_panel_html='')
+ Here is the call graph for this function:

◆ gatewayConfirmHintRequestCmd()

ilAssQuestionPreviewGUI::gatewayConfirmHintRequestCmd ( )

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

References ilAssQuestionHintRequestGUI\CMD_CONFIRM_REQUEST, ILIAS\Repository\ctrl(), saveQuestionSolution(), and showCmd().

596  : void
597  {
598  if (!$this->saveQuestionSolution()) {
599  $this->previewSession->setInstantResponseActive(false);
600  $this->showCmd();
601  return;
602  }
603 
604  $this->ctrl->redirectByClass(
605  'ilAssQuestionHintRequestGUI',
607  );
608  }
showCmd(string $notes_panel_html='')
+ Here is the call graph for this function:

◆ gatewayShowHintListCmd()

ilAssQuestionPreviewGUI::gatewayShowHintListCmd ( )

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

References ilAssQuestionHintRequestGUI\CMD_SHOW_LIST, ILIAS\Repository\ctrl(), saveQuestionSolution(), and showCmd().

610  : void
611  {
612  if (!$this->saveQuestionSolution()) {
613  $this->previewSession->setInstantResponseActive(false);
614  $this->showCmd();
615  return;
616  }
617 
618  $this->ctrl->redirectByClass(
619  'ilAssQuestionHintRequestGUI',
621  );
622  }
showCmd(string $notes_panel_html='')
+ Here is the call graph for this function:

◆ getObject()

ilAssQuestionPreviewGUI::getObject ( )

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

References $questionOBJ.

138  : assQuestion
139  {
140  return $this->questionOBJ;
141  }
Abstract basic class which is to be extended by the concrete assessment question type classes...

◆ getQuestionAnswerShuffler()

ilAssQuestionPreviewGUI::getQuestionAnswerShuffler ( )
private
Returns
Transformation

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

Referenced by populateQuestionOutput().

628  {
629  if (!$this->previewSession->randomizerSeedExists()) {
630  $this->previewSession->setRandomizerSeed((new RandomSeed())->createSeed());
631  }
632  return $this->randomGroup->shuffleArray(new GivenSeed((int) $this->previewSession->getRandomizerSeed()));
633  }
A transformation is a function from one datatype to another.
+ Here is the caller graph for this function:

◆ getQuestionNavigationHtml()

ilAssQuestionPreviewGUI::getQuestionNavigationHtml ( )
private

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by populateQuestionOutput().

475  : string
476  {
477  $navGUI = new ilAssQuestionRelatedNavigationBarGUI($this->ctrl, $this->lng);
478 
479  $navGUI->setInstantResponseCmd(self::CMD_INSTANT_RESPONSE);
480  $navGUI->setHintRequestCmd(self::CMD_GATEWAY_CONFIRM_HINT_REQUEST);
481  $navGUI->setHintListCmd(self::CMD_GATEWAY_SHOW_HINT_LIST);
482 
483  $navGUI->setInstantResponseEnabled($this->previewSettings->isInstantFeedbackNavigationRequired());
484  $navGUI->setHintProvidingEnabled($this->previewSettings->isHintProvidingEnabled());
485 
486  $navGUI->setHintRequestsPossible($this->hintTracking->requestsPossible());
487  $navGUI->setHintRequestsExist($this->hintTracking->requestsExist());
488 
489  return $this->ctrl->getHTML($navGUI);
490  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleInstantResponseRendering()

ilAssQuestionPreviewGUI::handleInstantResponseRendering ( ilTemplate  $tpl)
protected

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

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

Referenced by showCmd().

281  : void
282  {
283  $response_required = false;
284  $response_available = false;
285  $jump_to_response = false;
286 
287  if ($this->isShowReachedPointsRequired()) {
288  $this->populateReachedPointsOutput($tpl);
289  $response_required = true;
290  $response_available = true;
291  $jump_to_response = true;
292  }
293 
294  if ($this->isShowBestSolutionRequired()) {
295  $this->populateSolutionOutput($tpl);
296  $response_required = true;
297  $response_available = true;
298  $jump_to_response = true;
299  }
300 
302  $response_required = true;
303  if ($this->populateGenericQuestionFeedback($tpl)) {
304  $response_available = true;
305  $jump_to_response = true;
306  }
307  }
308 
310  $response_required = true;
311 
312  if ($this->questionGUI->hasInlineFeedback()) {
313  // Don't jump to the feedback below the question if some feedback is shown within the question
314  $jump_to_response = false;
315  } else {
316  if ($this->populateSpecificQuestionFeedback($tpl)) {
317  $response_available = true;
318  $jump_to_response = true;
319  }
320  }
321  }
322 
323  if ($response_required) {
324  $this->populateInstantResponseHeader($tpl, $jump_to_response);
325  if (!$response_available) {
326  if ($this->questionGUI->hasInlineFeedback()) {
328  $tpl,
329  $this->lng->txt('tst_feedback_is_given_inline')
330  );
331  } else {
333  $tpl,
334  $this->lng->txt('tst_feedback_not_available_for_answer')
335  );
336  }
337  }
338  }
339  }
populateGenericQuestionFeedback(ilTemplate $tpl)
Populate the block for an instant generic feedback.
populateInstantResponseHeader(ilTemplate $tpl, $withFocusAnchor)
populateInstantResponseMessage(ilTemplate $tpl, string $a_message)
populateSpecificQuestionFeedback(ilTemplate $tpl)
Populate the block for an instant specific feedback.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleQuestionActionCmd()

ilAssQuestionPreviewGUI::handleQuestionActionCmd ( )
private

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

References ILIAS\Repository\ctrl().

364  : void
365  {
366  $this->questionOBJ->persistPreviewState($this->previewSession);
367  $this->ctrl->redirect($this, self::CMD_SHOW);
368  }
+ Here is the call graph for this function:

◆ initHintTracking()

ilAssQuestionPreviewGUI::initHintTracking ( )

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

157  : void
158  {
159  $this->hintTracking = new ilAssQuestionPreviewHintTracking($this->db, $this->previewSession);
160  }

◆ initPreviewSession()

ilAssQuestionPreviewGUI::initPreviewSession (   $userId,
  $questionId 
)

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

150  : void
151  {
152  $this->previewSession = new ilAssQuestionPreviewSession($userId, $questionId);
153 
154  $this->previewSession->init();
155  }

◆ initPreviewSettings()

ilAssQuestionPreviewGUI::initPreviewSettings (   $parentRefId)

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

143  : void
144  {
145  $this->previewSettings = new ilAssQuestionPreviewSettings($parentRefId);
146 
147  $this->previewSettings->init();
148  }

◆ initQuestion()

ilAssQuestionPreviewGUI::initQuestion (   $questionId,
  $parentObjId 
)

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

References $_GET, $ref_id, ILIAS\Repository\ctrl(), ilTestExpressPage\getReturnToPageLink(), assQuestion\instantiateQuestionGUI(), ILIAS\Repository\lng(), assQuestionGUI\RENDER_PURPOSE_DEMOPLAY, and ILIAS\Repository\tabs().

Referenced by ilObjTestGUI\executeCommand().

77  : void
78  {
79  $this->questionGUI = assQuestion::instantiateQuestionGUI($questionId);
80  $this->questionOBJ = $this->questionGUI->object;
81 
82  $this->questionOBJ->setObjId($parentObjId);
83 
84  if ($this->ctrl->getCmd() === 'editQuestion') {
85  $this->questionGUI->setQuestionTabs();
86  } else {
87  if ($_GET["q_id"]) {
88  $this->tabs->clearTargets();
89  $this->tabs->addTarget(
90  self::TAB_ID_QUESTION,
91  $this->ctrl->getLinkTargetByClass('ilAssQuestionPreviewGUI', self::CMD_SHOW),
92  '',
93  [strtolower(__CLASS__)]
94  );
95  // Assessment of questions sub menu entry
96  $q_type = $this->questionOBJ->getQuestionType();
97  $classname = $q_type . "GUI";
98  $this->tabs->addTarget(
99  "statistics",
100  $this->ctrl->getLinkTargetByClass('ilAssQuestionPreviewGUI', "assessment"),
101  ["assessment"],
102  $classname,
103  ""
104  );
105  if ((isset($_GET['calling_test']) && strlen($_GET['calling_test']) !== 0) ||
106  (isset($_GET['test_ref_id']) && strlen($_GET['test_ref_id']) !== 0)) {
107  $ref_id = $_GET['calling_test'];
108  if (strlen($ref_id) !== 0 && !is_numeric($ref_id)) {
109  $ref_id_array = explode('_', $ref_id);
110  $ref_id = array_pop($ref_id_array);
111  }
112 
113  if (strlen($ref_id) === 0) {
114  $ref_id = $_GET['test_ref_id'];
115  }
116 
118  $this->tabs->setBackTarget(
119  $this->lng->txt("backtocallingtest"),
120  "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id"
121  );
122  } else {
123  $this->ctrl->clearParameterByClass(ilObjQuestionPoolGUI::class, 'q_id');
124  $this->tabs->setBackTarget($this->lng->txt("backtocallingpool"), $this->ctrl->getLinkTargetByClass(ilObjQuestionPoolGUI::class, "questions"));
125  $this->ctrl->setParameterByClass(ilObjQuestionPoolGUI::class, 'q_id', $questionId);
126  }
127  }
128  }
129  $this->questionGUI->outAdditionalOutput();
130 
131  $this->questionGUI->populateJavascriptFilesRequiredForWorkForm($this->tpl);
132  $this->questionGUI->setTargetGui($this);
133  $this->questionGUI->setQuestionActionCmd(self::CMD_HANDLE_QUESTION_ACTION);
134 
135  $this->questionGUI->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_DEMOPLAY);
136  }
$_GET["client_id"]
Definition: webdav.php:30
static instantiateQuestionGUI(int $a_question_id)
$ref_id
Definition: ltiauth.php:67
static getReturnToPageLink($q_id=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initStyleSheets()

ilAssQuestionPreviewGUI::initStyleSheets ( )

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

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

162  : void
163  {
164  $this->tpl->setCurrentBlock("ContentStyle");
165  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
166  $this->tpl->parseCurrentBlock();
167 
168  $this->tpl->setCurrentBlock("SyntaxStyle");
169  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
170  $this->tpl->parseCurrentBlock();
171  }
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
+ Here is the call graph for this function:

◆ instantResponseCmd()

ilAssQuestionPreviewGUI::instantResponseCmd ( )
private

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

References ILIAS\Repository\ctrl(), and saveQuestionSolution().

353  : void
354  {
355  if ($this->saveQuestionSolution()) {
356  $this->previewSession->setInstantResponseActive(true);
357  } else {
358  $this->previewSession->setInstantResponseActive(false);
359  }
360 
361  $this->ctrl->redirect($this, self::CMD_SHOW);
362  }
+ Here is the call graph for this function:

◆ isCommentingRequired()

ilAssQuestionPreviewGUI::isCommentingRequired ( )
protected

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

References $ref_id, ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by showCmd().

246  : bool
247  {
248  $ref_id = $this->http->wrapper()->query()->retrieve(
249  'ref_id',
250  $this->refinery->byTrying([
251  $this->refinery->kindlyTo()->int(),
252  $this->refinery->always(0)
253  ])
254  );
255 
256  return !$this->previewSettings->isTestRefId() && $this->rbac_system->checkAccess('read', (int) $ref_id);
257  }
static http()
Fetches the global http state from ILIAS.
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isShowBestSolutionRequired()

ilAssQuestionPreviewGUI::isShowBestSolutionRequired ( )
private

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

Referenced by handleInstantResponseRendering().

556  {
557  if (!$this->previewSettings->isBestSolutionEnabled()) {
558  return false;
559  }
560 
561  return $this->previewSession->isInstantResponseActive();
562  }
+ Here is the caller graph for this function:

◆ isShowGenericQuestionFeedbackRequired()

ilAssQuestionPreviewGUI::isShowGenericQuestionFeedbackRequired ( )
private

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

Referenced by handleInstantResponseRendering().

565  {
566  if (!$this->previewSettings->isGenericFeedbackEnabled()) {
567  return false;
568  }
569 
570  return $this->previewSession->isInstantResponseActive();
571  }
+ Here is the caller graph for this function:

◆ isShowReachedPointsRequired()

ilAssQuestionPreviewGUI::isShowReachedPointsRequired ( )
private

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

Referenced by handleInstantResponseRendering().

583  {
584  if (!$this->previewSettings->isReachedPointsEnabled()) {
585  return false;
586  }
587 
588  return $this->previewSession->isInstantResponseActive();
589  }
+ Here is the caller graph for this function:

◆ isShowSpecificQuestionFeedbackRequired()

ilAssQuestionPreviewGUI::isShowSpecificQuestionFeedbackRequired ( )
private

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

Referenced by handleInstantResponseRendering(), and populateQuestionOutput().

574  {
575  if (!$this->previewSettings->isSpecificFeedbackEnabled()) {
576  return false;
577  }
578 
579  return $this->previewSession->isInstantResponseActive();
580  }
+ Here is the caller graph for this function:

◆ populateCommentsPanel()

ilAssQuestionPreviewGUI::populateCommentsPanel ( ilTemplate  $tpl,
string  $comments_panel_html 
)
protected

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

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by showCmd().

635  : void
636  {
637  if ($comments_panel_html === '') {
638  $comments_panel_html = $this->questionGUI->geCommentsPanelHTML();
639  }
640 
641  $tpl->setCurrentBlock('notes_panel');
642  $tpl->setVariable('NOTES_PANEL', $comments_panel_html);
643  $tpl->parseCurrentBlock();
644  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:
+ 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 496 of file class.ilAssQuestionPreviewGUI.php.

References ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_CORRECT, ilAssQuestionFeedback\CSS_CLASS_FEEDBACK_WRONG, ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by handleInstantResponseRendering().

496  : bool
497  {
498  if ($this->questionOBJ->isPreviewSolutionCorrect($this->previewSession)) {
499  $feedback = $this->questionGUI->getGenericFeedbackOutputForCorrectSolution();
501  } else {
502  $feedback = $this->questionGUI->getGenericFeedbackOutputForIncorrectSolution();
504  }
505 
506  if ($feedback !== '') {
507  $tpl->setCurrentBlock('instant_feedback_generic');
508  $tpl->setVariable('GENERIC_FEEDBACK', $feedback);
509  $tpl->setVariable('ILC_FB_CSS_CLASS', $cssClass);
510  $tpl->parseCurrentBlock();
511  return true;
512  }
513  return false;
514  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateInstantResponseHeader()

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

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

References ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by handleInstantResponseRendering().

535  : void
536  {
537  if ($withFocusAnchor) {
538  $tpl->setCurrentBlock('inst_resp_id');
539  $tpl->setVariable('INSTANT_RESPONSE_FOCUS_ID', self::FEEDBACK_FOCUS_ANCHOR);
540  $tpl->parseCurrentBlock();
541  }
542 
543  $tpl->setCurrentBlock('instant_response_header');
544  $tpl->setVariable('INSTANT_RESPONSE_HEADER', $this->lng->txt('tst_feedback'));
545  $tpl->parseCurrentBlock();
546  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateInstantResponseMessage()

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

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

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by handleInstantResponseRendering().

549  {
550  $tpl->setCurrentBlock('instant_response_message');
551  $tpl->setVariable('INSTANT_RESPONSE_MESSAGE', $a_message);
552  $tpl->parseCurrentBlock();
553  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populatePreviewToolbar()

ilAssQuestionPreviewGUI::populatePreviewToolbar ( ilTemplate  $tpl)
private

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

References $_GET, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and HTML_Template_IT\setVariable().

Referenced by showCmd().

370  : void
371  {
372  $toolbarGUI = new ilAssQuestionPreviewToolbarGUI($this->lng);
373 
374  $toolbarGUI->setFormAction($this->ctrl->getFormAction($this, self::CMD_SHOW));
375  $toolbarGUI->setResetPreviewCmd(self::CMD_RESET);
376 
377  // Check Permissions first, some Toolbar Actions are only available for write access
378  if ($this->rbac_system->checkAccess('write', (int) $_GET['ref_id'])) {
379  $toolbarGUI->setEditPageCmd(
380  $this->ctrl->getLinkTargetByClass('ilAssQuestionPageGUI', 'edit')
381  );
382 
383  $toolbarGUI->setEditQuestionCmd(
384  $this->ctrl->getLinkTargetByClass(
385  ['ilrepositorygui','ilobjquestionpoolgui', get_class($this->questionGUI)],
386  'editQuestion'
387  )
388  );
389  }
390 
391  $toolbarGUI->build();
392 
393  $tpl->setVariable('PREVIEW_TOOLBAR', $this->ctrl->getHTML($toolbarGUI));
394  }
$_GET["client_id"]
Definition: webdav.php:30
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateQuestionOutput()

ilAssQuestionPreviewGUI::populateQuestionOutput ( ilTemplate  $tpl)
private

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

References ILIAS\Repository\ctrl(), getQuestionAnswerShuffler(), getQuestionNavigationHtml(), isShowSpecificQuestionFeedbackRequired(), ilPageObjectGUI\setRenderPageContainer(), HTML_Template_IT\setVariable(), and ILIAS\Repository\tabs().

Referenced by showCmd().

396  : void
397  {
398  // FOR WHAT EXACTLY IS THIS USEFUL?
399  $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
400  $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
401 
402  $pageGUI = new ilAssQuestionPageGUI($this->questionOBJ->getId());
403  $pageGUI->setRenderPageContainer(false);
404  $pageGUI->setEditPreview(true);
405  $pageGUI->setEnabledTabs(false);
406 
407  // FOR WHICH SITUATION IS THIS WORKAROUND NECCESSARY? (sure .. imagemaps, but where this can be done?)
408  if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST['editImagemapForward_x'])) { // workaround for page edit imagemaps, keep in mind
409  $this->ctrl->setCmdClass(get_class($pageGUI));
410  $this->ctrl->setCmd('preview');
411  }
412 
413  $this->questionGUI->setPreviewSession($this->previewSession);
414  $this->questionGUI->object->setShuffler($this->getQuestionAnswerShuffler());
415 
416  $questionHtml = $this->questionGUI->getPreview(true, $this->isShowSpecificQuestionFeedbackRequired());
417  $this->questionGUI->magicAfterTestOutput();
418 
419  $questionHtml .= $this->getQuestionNavigationHtml();
420 
421  $pageGUI->setQuestionHTML([$this->questionOBJ->getId() => $questionHtml]);
422 
423  $pageGUI->setPresentationTitle($this->questionOBJ->getTitleForHTMLOutput());
424 
425  $tpl->setVariable('QUESTION_OUTPUT', $pageGUI->preview());
426  // \ilPageObjectGUI::preview sets an undefined tab, so the "question" tab has to be activated again
427  $this->tabs->setTabActive(self::TAB_ID_QUESTION);
428  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
setRenderPageContainer(bool $a_val)
+ 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 430 of file class.ilAssQuestionPreviewGUI.php.

References ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by handleInstantResponseRendering().

430  : void
431  {
432  $reachedPoints = $this->questionOBJ->calculateReachedPointsFromPreviewSession($this->previewSession);
433  $maxPoints = $this->questionOBJ->getMaximumPoints();
434 
435  $scoreInformation = sprintf(
436  $this->lng->txt("you_received_a_of_b_points"),
437  $reachedPoints,
438  $maxPoints
439  );
440 
441  $tpl->setCurrentBlock("reached_points_feedback");
442  $tpl->setVariable("REACHED_POINTS_FEEDBACK", $scoreInformation);
443  $tpl->parseCurrentBlock();
444  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateSolutionOutput()

ilAssQuestionPreviewGUI::populateSolutionOutput ( ilTemplate  $tpl)
private

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

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), ilPageObjectGUI\setEditPreview(), and HTML_Template_IT\setVariable().

Referenced by handleInstantResponseRendering().

446  : void
447  {
448  // FOR WHAT EXACTLY IS THIS USEFUL?
449  $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
450  $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
451 
452  $pageGUI = new ilAssQuestionPageGUI($this->questionOBJ->getId());
453 
454  $pageGUI->setEditPreview(true);
455  $pageGUI->setEnabledTabs(false);
456 
457  // FOR WHICH SITUATION IS THIS WORKAROUND NECCESSARY? (sure .. imagemaps, but where this can be done?)
458  if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST['editImagemapForward_x'])) { // workaround for page edit imagemaps, keep in mind
459  $this->ctrl->setCmdClass(get_class($pageGUI));
460  $this->ctrl->setCmd('preview');
461  }
462 
463  $this->questionGUI->setPreviewSession($this->previewSession);
464 
465  $pageGUI->setQuestionHTML([$this->questionOBJ->getId() => $this->questionGUI->getSolutionOutput(0, null, false, false, true, false, true, false, false)]);
466 
467  $output = $this->questionGUI->getSolutionOutput(0, null, false, false, true, false, true, false, false);
468 
469  $tpl->setCurrentBlock('solution_output');
470  $tpl->setVariable('TXT_CORRECT_SOLUTION', $this->lng->txt('tst_best_solution_is'));
471  $tpl->setVariable('SOLUTION_OUTPUT', $output);
472  $tpl->parseCurrentBlock();
473  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setEditPreview(bool $a_editpreview)
Set Display first Edit tab, then Preview tab, instead of Page and Edit.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:
+ 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 520 of file class.ilAssQuestionPreviewGUI.php.

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

Referenced by handleInstantResponseRendering().

520  : bool
521  {
522  $fb = $this->questionGUI->getSpecificFeedbackOutput(
523  (array) $this->previewSession->getParticipantsSolution()
524  );
525 
526  if (!empty($fb)) {
527  $tpl->setCurrentBlock('instant_feedback_specific');
528  $tpl->setVariable('ANSWER_FEEDBACK', $fb);
529  $tpl->parseCurrentBlock();
530  return true;
531  }
532  return false;
533  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:546
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetCmd()

ilAssQuestionPreviewGUI::resetCmd ( )
private

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

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

341  : void
342  {
343  $this->previewSession->setRandomizerSeed(null);
344  $this->previewSession->setParticipantsSolution(null);
345  $this->previewSession->resetRequestedHints();
346  $this->previewSession->setInstantResponseActive(false);
347 
348  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qst_preview_reset_msg'), true);
349 
350  $this->ctrl->redirect($this, self::CMD_SHOW);
351  }
+ Here is the call graph for this function:

◆ saveQuestionSolution()

ilAssQuestionPreviewGUI::saveQuestionSolution ( )

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

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

591  : bool
592  {
593  return $this->questionOBJ->persistPreviewState($this->previewSession);
594  }
+ Here is the caller graph for this function:

◆ showCmd()

ilAssQuestionPreviewGUI::showCmd ( string  $notes_panel_html = '')
private

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

References buildPreviewFormAction(), handleInstantResponseRendering(), isCommentingRequired(), populateCommentsPanel(), populatePreviewToolbar(), and populateQuestionOutput().

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

259  : void
260  {
261  $tpl = new ilTemplate('tpl.qpl_question_preview.html', true, true, 'Modules/TestQuestionPool');
262  $tpl->setVariable('PREVIEW_FORMACTION', $this->buildPreviewFormAction());
263 
264  $this->populatePreviewToolbar($tpl);
265  $this->populateQuestionOutput($tpl);
266  $this->handleInstantResponseRendering($tpl);
267 
268  if ($this->isCommentingRequired()) {
269  $this->populateCommentsPanel($tpl, $notes_panel_html);
270  }
271 
272  $this->tpl->setContent($tpl->get());
273  }
populateCommentsPanel(ilTemplate $tpl, string $comments_panel_html)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $hintTracking

ilAssQuestionPreviewHintTracking ilAssQuestionPreviewGUI::$hintTracking = null
private

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

◆ $previewSession

ilAssQuestionPreviewSession ilAssQuestionPreviewGUI::$previewSession = null
private

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

◆ $previewSettings

ilAssQuestionPreviewSettings ilAssQuestionPreviewGUI::$previewSettings = null
private

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

◆ $questionGUI

assQuestionGUI ilAssQuestionPreviewGUI::$questionGUI
private

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

◆ $questionOBJ

assQuestion ilAssQuestionPreviewGUI::$questionOBJ
private

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

Referenced by getObject().

◆ CMD_GATEWAY_CONFIRM_HINT_REQUEST

const ilAssQuestionPreviewGUI::CMD_GATEWAY_CONFIRM_HINT_REQUEST = 'gatewayConfirmHintRequest'

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

◆ CMD_GATEWAY_SHOW_HINT_LIST

const ilAssQuestionPreviewGUI::CMD_GATEWAY_SHOW_HINT_LIST = 'gatewayShowHintList'

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

◆ CMD_HANDLE_QUESTION_ACTION

const ilAssQuestionPreviewGUI::CMD_HANDLE_QUESTION_ACTION = 'handleQuestionAction'

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

◆ CMD_INSTANT_RESPONSE

const ilAssQuestionPreviewGUI::CMD_INSTANT_RESPONSE = 'instantResponse'

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

◆ CMD_RESET

const ilAssQuestionPreviewGUI::CMD_RESET = 'reset'

Definition at line 43 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 52 of file class.ilAssQuestionPreviewGUI.php.

◆ TAB_ID_QUESTION

const ilAssQuestionPreviewGUI::TAB_ID_QUESTION = 'question'

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


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