ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAssQuestionPreviewGUI Class Reference
+ Collaboration diagram for ilAssQuestionPreviewGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilRbacSystem $rbac_system, ilTabsGUI $tabs, ilGlobalTemplateInterface $tpl, ilLanguage $lng, ilDBInterface $db, ilObjUser $user, RandomGroup $randomGroup, int $parent_ref_id, RBACServices $rbac_services)
 
 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)
 
 populateNotesPanel (ilTemplate $tpl, $notesPanelHTML)
 

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

RBACServices $rbac_services
 
ilCtrlInterface $ctrl
 
ilRbacSystem $rbac_system
 
ilTabsGUI $tabs
 
ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilDBInterface $db
 
ilObjUser $user
 
assQuestionGUI $questionGUI
 
assQuestion $questionOBJ
 
ilAssQuestionPreviewSettings $previewSettings = null
 
ilAssQuestionPreviewSession $previewSession = null
 
ilAssQuestionPreviewHintTracking $hintTracking = null
 
RandomGroup $randomGroup
 
int $parent_ref_id
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionPreviewGUI::__construct ( ilCtrl  $ctrl,
ilRbacSystem  $rbac_system,
ilTabsGUI  $tabs,
ilGlobalTemplateInterface  $tpl,
ilLanguage  $lng,
ilDBInterface  $db,
ilObjUser  $user,
RandomGroup  $randomGroup,
int  $parent_ref_id,
RBACServices  $rbac_services 
)

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

References $ctrl, $db, $lng, $parent_ref_id, $randomGroup, $rbac_services, $rbac_system, $tabs, $tpl, $user, ILIAS\Repository\ctrl(), ilObjStyleSheet\getContentStylePath(), ilObjStyleSheet\getSyntaxStylePath(), ILIAS\Repository\lng(), ILIAS\Repository\tabs(), and ILIAS\Repository\user().

81  {
82  $this->ctrl = $ctrl;
83  $this->rbac_system = $rbac_system;
84  $this->tabs = $tabs;
85  $this->tpl = $tpl;
86  $this->lng = $lng;
87  $this->db = $db;
88  $this->user = $user;
89  $this->randomGroup = $randomGroup;
90  $this->rbac_services = $rbac_services;
91  $this->parent_ref_id = $parent_ref_id;
92 
93  $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
94  $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
95  }
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 274 of file class.ilAssQuestionPreviewGUI.php.

References ILIAS\Repository\tabs().

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

◆ buildPreviewFormAction()

ilAssQuestionPreviewGUI::buildPreviewFormAction ( )
protected
Returns
string

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

References ILIAS\Repository\ctrl().

Referenced by showCmd().

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

◆ executeCommand()

ilAssQuestionPreviewGUI::executeCommand ( )

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

References $DIC, ILIAS\Repository\ctrl(), ilNoteGUI\enablePublicNotes(), ILIAS\Repository\lng(), showCmd(), and ILIAS\Repository\tabs().

206  : void
207  {
208  global $DIC;
209  $ilHelp = $DIC['ilHelp'];
210  $ilHelp->setScreenIdComponent('qpl');
211 
212  $this->tabs->setTabActive(self::TAB_ID_QUESTION);
213 
214  $this->lng->loadLanguageModule('content');
215 
216  $nextClass = $this->ctrl->getNextClass($this);
217 
218  switch ($nextClass) {
219  case 'ilassquestionhintrequestgui':
220  $gui = new ilAssQuestionHintRequestGUI($this, self::CMD_SHOW, $this->questionGUI, $this->hintTracking);
221  $this->ctrl->forwardCommand($gui);
222  break;
223  case 'ilassspecfeedbackpagegui':
224  case 'ilassgenfeedbackpagegui':
225  $forwarder = new ilAssQuestionFeedbackPageObjectCommandForwarder($this->questionOBJ, $this->ctrl, $this->tabs, $this->lng);
226  $forwarder->forward();
227  break;
228  case 'ilnotegui':
229  $notesGUI = new ilNoteGUI($this->questionOBJ->getObjId(), $this->questionOBJ->getId(), 'quest');
230  $notesGUI->enablePublicNotes(true);
231  $notesGUI->enablePublicNotesDeletion(true);
232  $notesPanelHTML = $this->ctrl->forwardCommand($notesGUI);
233  $this->showCmd($notesPanelHTML);
234  break;
235  default:
236  $cmd = $this->ctrl->getCmd(self::CMD_SHOW) . 'Cmd';
237  $this->$cmd();
238  }
239  }
Notes GUI class.
global $DIC
Definition: feed.php:28
enablePublicNotes(bool $a_enable=true)
+ Here is the call graph for this function:

◆ gatewayConfirmHintRequestCmd()

ilAssQuestionPreviewGUI::gatewayConfirmHintRequestCmd ( )

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

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

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

◆ gatewayShowHintListCmd()

ilAssQuestionPreviewGUI::gatewayShowHintListCmd ( )

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

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

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

◆ getObject()

ilAssQuestionPreviewGUI::getObject ( )

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

References $questionOBJ.

171  : assQuestion
172  {
173  return $this->questionOBJ;
174  }
Abstract basic class which is to be extended by the concrete assessment question type classes...

◆ getQuestionAnswerShuffler()

ilAssQuestionPreviewGUI::getQuestionAnswerShuffler ( )
private
Returns
Transformation

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

Referenced by populateQuestionOutput().

627  {
628  if (!$this->previewSession->randomizerSeedExists()) {
629  $this->previewSession->setRandomizerSeed((new RandomSeed())->createSeed());
630  }
631  return $this->randomGroup->shuffleArray(new GivenSeed((int) $this->previewSession->getRandomizerSeed()));
632  }
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 474 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by populateQuestionOutput().

474  : string
475  {
476  $navGUI = new ilAssQuestionRelatedNavigationBarGUI($this->ctrl, $this->lng);
477 
478  $navGUI->setInstantResponseCmd(self::CMD_INSTANT_RESPONSE);
479  $navGUI->setHintRequestCmd(self::CMD_GATEWAY_CONFIRM_HINT_REQUEST);
480  $navGUI->setHintListCmd(self::CMD_GATEWAY_SHOW_HINT_LIST);
481 
482  $navGUI->setInstantResponseEnabled($this->previewSettings->isInstantFeedbackNavigationRequired());
483  $navGUI->setHintProvidingEnabled($this->previewSettings->isHintProvidingEnabled());
484 
485  $navGUI->setHintRequestsPossible($this->hintTracking->requestsPossible());
486  $navGUI->setHintRequestsExist($this->hintTracking->requestsExist());
487 
488  return $this->ctrl->getHTML($navGUI);
489  }
+ 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 280 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by showCmd().

280  : void
281  {
282  $response_required = false;
283  $response_available = false;
284  $jump_to_response = false;
285 
286  if ($this->isShowReachedPointsRequired()) {
287  $this->populateReachedPointsOutput($tpl);
288  $response_required = true;
289  $response_available = true;
290  $jump_to_response = true;
291  }
292 
293  if ($this->isShowBestSolutionRequired()) {
294  $this->populateSolutionOutput($tpl);
295  $response_required = true;
296  $response_available = true;
297  $jump_to_response = true;
298  }
299 
301  $response_required = true;
302  if ($this->populateGenericQuestionFeedback($tpl)) {
303  $response_available = true;
304  $jump_to_response = true;
305  }
306  }
307 
309  $response_required = true;
310 
311  if ($this->questionGUI->hasInlineFeedback()) {
312  // Don't jump to the feedback below the question if some feedback is shown within the question
313  $jump_to_response = false;
314  } else {
315  if ($this->populateSpecificQuestionFeedback($tpl)) {
316  $response_available = true;
317  $jump_to_response = true;
318  }
319  }
320  }
321 
322  if ($response_required) {
323  $this->populateInstantResponseHeader($tpl, $jump_to_response);
324  if (!$response_available) {
325  if ($this->questionGUI->hasInlineFeedback()) {
327  $tpl,
328  $this->lng->txt('tst_feedback_is_given_inline')
329  );
330  } else {
332  $tpl,
333  $this->lng->txt('tst_feedback_not_available_for_answer')
334  );
335  }
336  }
337  }
338  }
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 363 of file class.ilAssQuestionPreviewGUI.php.

References ILIAS\Repository\ctrl().

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

◆ initHintTracking()

ilAssQuestionPreviewGUI::initHintTracking ( )

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

190  : void
191  {
192  $this->hintTracking = new ilAssQuestionPreviewHintTracking($this->db, $this->previewSession);
193  }

◆ initPreviewSession()

ilAssQuestionPreviewGUI::initPreviewSession (   $userId,
  $questionId 
)

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

183  : void
184  {
185  $this->previewSession = new ilAssQuestionPreviewSession($userId, $questionId);
186 
187  $this->previewSession->init();
188  }

◆ initPreviewSettings()

ilAssQuestionPreviewGUI::initPreviewSettings (   $parentRefId)

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

176  : void
177  {
178  $this->previewSettings = new ilAssQuestionPreviewSettings($parentRefId);
179 
180  $this->previewSettings->init();
181  }

◆ initQuestion()

ilAssQuestionPreviewGUI::initQuestion (   $questionId,
  $parentObjId 
)

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

References $_GET, $ref_id, ilLink\_getLink(), ILIAS\Repository\ctrl(), ilObjectFactory\getInstanceByRefId(), ilTestExpressPage\getReturnToPageLink(), assQuestion\instantiateQuestionGUI(), ILIAS\Repository\int(), ILIAS\Repository\lng(), OUTPUT_JAVASCRIPT, assQuestionGUI\RENDER_PURPOSE_DEMOPLAY, and ILIAS\Repository\tabs().

Referenced by ilObjTestGUI\executeCommand(), and ilObjQuestionPoolGUI\getQueryParamInt().

97  : void
98  {
99  $this->questionGUI = assQuestion::instantiateQuestionGUI($questionId);
100  $this->questionOBJ = $this->questionGUI->object;
101 
102  $this->questionOBJ->setObjId($parentObjId);
103 
104  if ($this->ctrl->getCmd() === 'editQuestion') {
105  $this->questionGUI->setQuestionTabs();
106  } else {
107  if ($_GET["q_id"]) {
108  $this->tabs->clearTargets();
109  $this->tabs->addTarget(
110  self::TAB_ID_QUESTION,
111  $this->ctrl->getLinkTargetByClass('ilAssQuestionPreviewGUI', self::CMD_SHOW),
112  '',
113  [strtolower(__CLASS__)]
114  );
115  // Assessment of questions sub menu entry
116  $q_type = $this->questionOBJ->getQuestionType();
117  $classname = $q_type . "GUI";
118  $this->tabs->addTarget(
119  "statistics",
120  $this->ctrl->getLinkTargetByClass('ilAssQuestionPreviewGUI', "assessment"),
121  array("assessment"),
122  $classname,
123  ""
124  );
125  if ((isset($_GET['calling_test']) && strlen($_GET['calling_test']) !== 0) ||
126  (isset($_GET['test_ref_id']) && strlen($_GET['test_ref_id']) !== 0)) {
127  $ref_id = $_GET['calling_test'];
128  if (strlen($ref_id) !== 0 && !is_numeric($ref_id)) {
129  $ref_id_array = explode('_', $ref_id);
130  $ref_id = array_pop($ref_id_array);
131  }
132 
133  if (strlen($ref_id) === 0) {
134  $ref_id = $_GET['test_ref_id'];
135  }
136 
138  $this->tabs->setBackTarget(
139  $this->lng->txt("backtocallingtest"),
140  "ilias.php?baseClass=ilObjTestGUI&cmd=questions&ref_id=$ref_id"
141  );
142  } elseif (isset($_GET['calling_consumer']) && (int) $_GET['calling_consumer']) {
143  $ref_id = (int) $_GET['calling_consumer'];
145  if ($consumer instanceof ilQuestionEditingFormConsumer) {
146  $this->tabs->setBackTarget(
147  $consumer->getQuestionEditingFormBackTargetLabel(),
148  $consumer->getQuestionEditingFormBackTarget($_GET['consumer_context'])
149  );
150  } else {
151  $this->tabs->setBackTarget($this->lng->txt("qpl"), ilLink::_getLink($ref_id));
152  }
153  } else {
154  $this->ctrl->clearParameterByClass(ilObjQuestionPoolGUI::class, 'q_id');
155  $this->tabs->setBackTarget($this->lng->txt("backtocallingpool"), $this->ctrl->getLinkTargetByClass(ilObjQuestionPoolGUI::class, "questions"));
156  $this->ctrl->setParameterByClass(ilObjQuestionPoolGUI::class, 'q_id', $questionId);
157  }
158  }
159  }
160  $this->questionGUI->outAdditionalOutput();
161 
162  $this->questionGUI->populateJavascriptFilesRequiredForWorkForm($this->tpl);
163  $this->questionOBJ->setOutputType(OUTPUT_JAVASCRIPT); // TODO: remove including depending stuff
164 
165  $this->questionGUI->setTargetGui($this);
166  $this->questionGUI->setQuestionActionCmd(self::CMD_HANDLE_QUESTION_ACTION);
167 
168  $this->questionGUI->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_DEMOPLAY);
169  }
const OUTPUT_JAVASCRIPT
static instantiateQuestionGUI(int $a_question_id)
$ref_id
Definition: ltiauth.php:67
static getReturnToPageLink($q_id=null)
$_GET['client_id']
Definition: saml1-acs.php:21
static getInstanceByRefId(int $ref_id, bool $stop_on_error=true)
get an instance of an Ilias object by reference id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initStyleSheets()

ilAssQuestionPreviewGUI::initStyleSheets ( )

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

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

195  : void
196  {
197  $this->tpl->setCurrentBlock("ContentStyle");
198  $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
199  $this->tpl->parseCurrentBlock();
200 
201  $this->tpl->setCurrentBlock("SyntaxStyle");
202  $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
203  $this->tpl->parseCurrentBlock();
204  }
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 352 of file class.ilAssQuestionPreviewGUI.php.

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

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

◆ isCommentingRequired()

ilAssQuestionPreviewGUI::isCommentingRequired ( )
protected

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

References $_GET.

Referenced by showCmd().

249  : bool
250  {
251  if ($this->previewSettings->isTestRefId()) {
252  return false;
253  }
254 
255  return (bool) $this->rbac_services->system()->checkAccess('write', (int) $_GET['ref_id']);
256  }
$_GET['client_id']
Definition: saml1-acs.php:21
+ Here is the caller graph for this function:

◆ isShowBestSolutionRequired()

ilAssQuestionPreviewGUI::isShowBestSolutionRequired ( )
private

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

Referenced by handleInstantResponseRendering().

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

◆ isShowGenericQuestionFeedbackRequired()

ilAssQuestionPreviewGUI::isShowGenericQuestionFeedbackRequired ( )
private

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

Referenced by handleInstantResponseRendering().

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

◆ isShowReachedPointsRequired()

ilAssQuestionPreviewGUI::isShowReachedPointsRequired ( )
private

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

Referenced by handleInstantResponseRendering().

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

◆ isShowSpecificQuestionFeedbackRequired()

ilAssQuestionPreviewGUI::isShowSpecificQuestionFeedbackRequired ( )
private

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

Referenced by handleInstantResponseRendering(), and populateQuestionOutput().

573  {
574  if (!$this->previewSettings->isSpecificFeedbackEnabled()) {
575  return false;
576  }
577 
578  return $this->previewSession->isInstantResponseActive();
579  }
+ 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 495 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().

495  : bool
496  {
497  if ($this->questionOBJ->isPreviewSolutionCorrect($this->previewSession)) {
498  $feedback = $this->questionGUI->getGenericFeedbackOutputForCorrectSolution();
500  } else {
501  $feedback = $this->questionGUI->getGenericFeedbackOutputForIncorrectSolution();
503  }
504 
505  if ($feedback !== '') {
506  $tpl->setCurrentBlock('instant_feedback_generic');
507  $tpl->setVariable('GENERIC_FEEDBACK', $feedback);
508  $tpl->setVariable('ILC_FB_CSS_CLASS', $cssClass);
509  $tpl->parseCurrentBlock();
510  return true;
511  }
512  return false;
513  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
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 534 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by handleInstantResponseRendering().

534  : void
535  {
536  if ($withFocusAnchor) {
537  $tpl->setCurrentBlock('inst_resp_id');
538  $tpl->setVariable('INSTANT_RESPONSE_FOCUS_ID', self::FEEDBACK_FOCUS_ANCHOR);
539  $tpl->parseCurrentBlock();
540  }
541 
542  $tpl->setCurrentBlock('instant_response_header');
543  $tpl->setVariable('INSTANT_RESPONSE_HEADER', $this->lng->txt('tst_feedback'));
544  $tpl->parseCurrentBlock();
545  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
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 547 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by handleInstantResponseRendering().

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

◆ populateNotesPanel()

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

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

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

Referenced by showCmd().

634  : void
635  {
636  if (!strlen($notesPanelHTML)) {
637  $notesPanelHTML = $this->questionGUI->getNotesHTML();
638  }
639 
640  $tpl->setCurrentBlock('notes_panel');
641  $tpl->setVariable('NOTES_PANEL', $notesPanelHTML);
642  $tpl->parseCurrentBlock();
643  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
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 369 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by showCmd().

369  : void
370  {
371  $toolbarGUI = new ilAssQuestionPreviewToolbarGUI($this->lng);
372 
373  $toolbarGUI->setFormAction($this->ctrl->getFormAction($this, self::CMD_SHOW));
374  $toolbarGUI->setResetPreviewCmd(self::CMD_RESET);
375 
376  // Check Permissions first, some Toolbar Actions are only available for write access
377  if ($this->rbac_services->system()->checkAccess('write', (int) $_GET['ref_id'])) {
378  $toolbarGUI->setEditPageCmd(
379  $this->ctrl->getLinkTargetByClass('ilAssQuestionPageGUI', 'edit')
380  );
381 
382  $toolbarGUI->setEditQuestionCmd(
383  $this->ctrl->getLinkTargetByClass(
384  array('ilrepositorygui','ilobjquestionpoolgui', get_class($this->questionGUI)),
385  'editQuestion'
386  )
387  );
388  }
389 
390  $toolbarGUI->build();
391 
392  $tpl->setVariable('PREVIEW_TOOLBAR', $this->ctrl->getHTML($toolbarGUI));
393  }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
$_GET['client_id']
Definition: saml1-acs.php:21
+ 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 395 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().

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

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

Referenced by handleInstantResponseRendering().

429  : void
430  {
431  $reachedPoints = $this->questionOBJ->calculateReachedPointsFromPreviewSession($this->previewSession);
432  $maxPoints = $this->questionOBJ->getMaximumPoints();
433 
434  $scoreInformation = sprintf(
435  $this->lng->txt("you_received_a_of_b_points"),
436  $reachedPoints,
437  $maxPoints
438  );
439 
440  $tpl->setCurrentBlock("reached_points_feedback");
441  $tpl->setVariable("REACHED_POINTS_FEEDBACK", $scoreInformation);
442  $tpl->parseCurrentBlock();
443  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
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 445 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().

445  : void
446  {
447  // FOR WHAT EXACTLY IS THIS USEFUL?
448  $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
449  $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
450 
451  $pageGUI = new ilAssQuestionPageGUI($this->questionOBJ->getId());
452 
453  $pageGUI->setEditPreview(true);
454  $pageGUI->setEnabledTabs(false);
455 
456  // FOR WHICH SITUATION IS THIS WORKAROUND NECCESSARY? (sure .. imagemaps, but where this can be done?)
457  if (strlen($this->ctrl->getCmd()) == 0 && !isset($_POST['editImagemapForward_x'])) { // workaround for page edit imagemaps, keep in mind
458  $this->ctrl->setCmdClass(get_class($pageGUI));
459  $this->ctrl->setCmd('preview');
460  }
461 
462  $this->questionGUI->setPreviewSession($this->previewSession);
463 
464  $pageGUI->setQuestionHTML(array($this->questionOBJ->getId() => $this->questionGUI->getSolutionOutput(0, null, false, false, true, false, true, false, false)));
465 
466  $output = $this->questionGUI->getSolutionOutput(0, null, false, false, true, false, true, false, false);
467 
468  $tpl->setCurrentBlock('solution_output');
469  $tpl->setVariable('TXT_CORRECT_SOLUTION', $this->lng->txt('tst_best_solution_is'));
470  $tpl->setVariable('SOLUTION_OUTPUT', $output);
471  $tpl->parseCurrentBlock();
472  }
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:514
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 519 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by handleInstantResponseRendering().

519  : bool
520  {
521  $fb = $this->questionGUI->getSpecificFeedbackOutput(
522  (array) $this->previewSession->getParticipantsSolution()
523  );
524 
525  if (!empty($fb)) {
526  $tpl->setCurrentBlock('instant_feedback_specific');
527  $tpl->setVariable('ANSWER_FEEDBACK', $fb);
528  $tpl->parseCurrentBlock();
529  return true;
530  }
531  return false;
532  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
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 340 of file class.ilAssQuestionPreviewGUI.php.

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

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

◆ saveQuestionSolution()

ilAssQuestionPreviewGUI::saveQuestionSolution ( )

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

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

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

◆ showCmd()

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

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

References buildPreviewFormAction(), ilGlobalTemplateInterface\get(), handleInstantResponseRendering(), isCommentingRequired(), populateNotesPanel(), populatePreviewToolbar(), populateQuestionOutput(), and ilGlobalTemplateInterface\setVariable().

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

258  : void
259  {
260  $tpl = new ilTemplate('tpl.qpl_question_preview.html', true, true, 'Modules/TestQuestionPool');
261  $tpl->setVariable('PREVIEW_FORMACTION', $this->buildPreviewFormAction());
262 
266 
267  if ($this->isCommentingRequired()) {
268  $this->populateNotesPanel($tpl, $notesPanelHTML);
269  }
270 
271  $this->tpl->setContent($tpl->get());
272  }
populateNotesPanel(ilTemplate $tpl, $notesPanelHTML)
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilAssQuestionPreviewGUI::$ctrl
private

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

Referenced by __construct().

◆ $db

ilDBInterface ilAssQuestionPreviewGUI::$db
private

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

Referenced by __construct().

◆ $hintTracking

ilAssQuestionPreviewHintTracking ilAssQuestionPreviewGUI::$hintTracking = null
private

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

◆ $lng

ilLanguage ilAssQuestionPreviewGUI::$lng
private

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

Referenced by __construct().

◆ $parent_ref_id

int ilAssQuestionPreviewGUI::$parent_ref_id
private

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

Referenced by __construct().

◆ $previewSession

ilAssQuestionPreviewSession ilAssQuestionPreviewGUI::$previewSession = null
private

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

◆ $previewSettings

ilAssQuestionPreviewSettings ilAssQuestionPreviewGUI::$previewSettings = null
private

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

◆ $questionGUI

assQuestionGUI ilAssQuestionPreviewGUI::$questionGUI
private

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

◆ $questionOBJ

assQuestion ilAssQuestionPreviewGUI::$questionOBJ
private

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

Referenced by getObject().

◆ $randomGroup

RandomGroup ilAssQuestionPreviewGUI::$randomGroup
private

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

Referenced by __construct().

◆ $rbac_services

RBACServices ilAssQuestionPreviewGUI::$rbac_services
private

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

Referenced by __construct().

◆ $rbac_system

ilRbacSystem ilAssQuestionPreviewGUI::$rbac_system
private

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

Referenced by __construct().

◆ $tabs

ilTabsGUI ilAssQuestionPreviewGUI::$tabs
private

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

Referenced by __construct().

◆ $tpl

ilGlobalTemplateInterface ilAssQuestionPreviewGUI::$tpl
private

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

Referenced by __construct().

◆ $user

ilObjUser ilAssQuestionPreviewGUI::$user
private

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

Referenced by __construct().

◆ CMD_GATEWAY_CONFIRM_HINT_REQUEST

const ilAssQuestionPreviewGUI::CMD_GATEWAY_CONFIRM_HINT_REQUEST = 'gatewayConfirmHintRequest'

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

◆ CMD_GATEWAY_SHOW_HINT_LIST

const ilAssQuestionPreviewGUI::CMD_GATEWAY_SHOW_HINT_LIST = 'gatewayShowHintList'

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

◆ CMD_HANDLE_QUESTION_ACTION

const ilAssQuestionPreviewGUI::CMD_HANDLE_QUESTION_ACTION = 'handleQuestionAction'

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

◆ CMD_INSTANT_RESPONSE

const ilAssQuestionPreviewGUI::CMD_INSTANT_RESPONSE = 'instantResponse'

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

◆ CMD_RESET

const ilAssQuestionPreviewGUI::CMD_RESET = 'reset'

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

◆ TAB_ID_QUESTION

const ilAssQuestionPreviewGUI::TAB_ID_QUESTION = 'question'

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


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