ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilAssQuestionPreviewGUI Class Reference
+ Collaboration diagram for ilAssQuestionPreviewGUI:

Public Member Functions

 __construct (private readonly ilCtrl $ctrl, private readonly ilRbacSystem $rbac_system, private ilTabsGUI $tabs, private ilToolbarGUI $toolbar, private ilGlobalTemplateInterface $tpl, private readonly UIFactory $ui_factory, private readonly ilLanguage $lng, private readonly ilDBInterface $db, private readonly RandomGroup $random_group, private readonly GlobalScreen $global_screen, private readonly HTTPServices $http, private readonly Refinery $refinery, private readonly int $parent_obj_ref_id)
 
 setInfoMessage (string $message)
 
 setPrimaryCmd (string $label, string $cmd)
 
 addAdditionalCmd (string $label, string $cmd)
 
 getQuestion ()
 
 getObject ()
 
 initQuestion (assQuestionGUI $question_gui, int $parent_obj_id)
 
 initPreviewSettings (int $parent_ref_id)
 
 initPreviewSession (int $user_id, int $question_id)
 
 initHintTracking ()
 
 initStyleSheets ()
 
 executeCommand ()
 
 showCmd (string $commands_panel_html='')
 
 assessmentCmd ()
 
 handleInstantResponseRendering (ilTemplate $tpl)
 
 resetCmd ()
 
 instantResponseCmd ()
 
 handleQuestionActionCmd ()
 
 displayMediaFullscreenCmd ()
 
 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 ()
 
 populateReachedPointsOutput (ilTemplate $tpl)
 
 populateInstantResponseHeader (ilTemplate $tpl, $withFocusAnchor)
 
 populateInstantResponseMessage (ilTemplate $tpl, string $a_message)
 
 populateCommentsPanel (ilTemplate $tpl, string $comments_panel_html)
 

Protected Attributes

readonly RequestDataCollector $request_data_collector
 

Private Member Functions

 populateToolbar ()
 
 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 $question_gui = null
 
assQuestion $question_obj = null
 
ilAssQuestionPreviewSettings $preview_settings = null
 
ilAssQuestionPreviewSession $preview_session = null
 
ilAssQuestionPreviewHintTracking $hint_tracking = null
 
string $info_message = null
 
array $primary_cmd = []
 
array $additional_cmds = []
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionPreviewGUI::__construct ( private readonly ilCtrl  $ctrl,
private readonly ilRbacSystem  $rbac_system,
private ilTabsGUI  $tabs,
private ilToolbarGUI  $toolbar,
private ilGlobalTemplateInterface  $tpl,
private readonly UIFactory  $ui_factory,
private readonly ilLanguage  $lng,
private readonly ilDBInterface  $db,
private readonly RandomGroup  $random_group,
private readonly GlobalScreen  $global_screen,
private readonly HTTPServices  $http,
private readonly Refinery  $refinery,
private readonly int  $parent_obj_ref_id 
)

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

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

93  {
94  $this->tpl->addCss(ilObjStyleSheet::getContentStylePath(0));
95  $this->tpl->addCss(ilObjStyleSheet::getSyntaxStylePath());
96 
97  $local_dic = QuestionPoolDIC::dic();
98  $this->request_data_collector = $local_dic['request_data_collector'];
99  }
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

◆ addAdditionalCmd()

ilAssQuestionPreviewGUI::addAdditionalCmd ( string  $label,
string  $cmd 
)

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

Referenced by ilObjTestGUI\forwardCommandToQuestionPreview().

111  : void
112  {
113  $this->additional_cmds[$label] = $cmd;
114  }
+ Here is the caller graph for this function:

◆ assessmentCmd()

ilAssQuestionPreviewGUI::assessmentCmd ( )

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

References ILIAS\Repository\tabs().

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

◆ buildPreviewFormAction()

ilAssQuestionPreviewGUI::buildPreviewFormAction ( )
protected

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

References ILIAS\Repository\ctrl().

Referenced by showCmd().

237  : string
238  {
239  return $this->ctrl->getFormAction($this, self::CMD_SHOW) . '#' . self::FEEDBACK_FOCUS_ANCHOR;
240  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ displayMediaFullscreenCmd()

ilAssQuestionPreviewGUI::displayMediaFullscreenCmd ( )

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

References ILIAS\Repository\ctrl().

Referenced by executeCommand().

368  : void
369  {
370  $page_id = $this->request_data_collector->int('pg_id');
371  if ($page_id === 0) {
372  return;
373  }
374 
375  (new ilPageObjectGUI(
376  $this->ctrl->getCmdClass() === 'ilassgenfeedbackpagegui' ? 'qfbg' : 'qfbs',
377  $page_id
378  ))->displayMediaFullscreen();
379  }
Class ilPageObjectGUI.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilAssQuestionPreviewGUI::executeCommand ( )

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

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

187  : void
188  {
189  global $DIC;
190  $ilHelp = $DIC['ilHelp'];
191  $ilHelp->setScreenIdComponent('qpl');
192 
193  $this->tabs->setTabActive(self::TAB_ID_QUESTION);
194 
195  $this->lng->loadLanguageModule('content');
196 
197  $nextClass = $this->ctrl->getNextClass($this);
198 
199  switch ($nextClass) {
200  case 'ilassquestionhintrequestgui':
201  $gui = new ilAssQuestionHintRequestGUI(
202  $this,
203  self::CMD_SHOW,
204  $this->question_gui,
205  $this->hint_tracking,
206  $this->ctrl,
207  $this->lng,
208  $this->tpl,
209  $this->tabs,
210  $this->global_screen
211  );
212  $this->ctrl->forwardCommand($gui);
213  break;
214  case 'ilassspecfeedbackpagegui':
215  case 'ilassgenfeedbackpagegui':
216  if ($this->ctrl->getCmd() === 'displayMediaFullscreen') {
217  $this->displayMediaFullscreenCmd();
218  }
220  $this->question_obj,
221  $this->ctrl,
222  $this->tabs,
223  $this->lng
224  ))->forward();
225  break;
226  case 'ilcommentgui':
227  $comment_gui = new ilCommentGUI($this->question_obj->getObjId(), $this->question_obj->getId(), 'quest');
228  $comments_panel_html = $this->ctrl->forwardCommand($comment_gui);
229  $this->showCmd($comments_panel_html);
230  break;
231  default:
232  $cmd = $this->ctrl->getCmd(self::CMD_SHOW);
233  $this->{$cmd . 'Cmd'}();
234  }
235  }
global $DIC
Definition: shib_login.php:25
Comment GUI.
showCmd(string $commands_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->preview_session->setInstantResponseActive(false);
600  $this->showCmd();
601  return;
602  }
603 
604  $this->ctrl->redirectByClass(
605  'ilAssQuestionHintRequestGUI',
607  );
608  }
showCmd(string $commands_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->preview_session->setInstantResponseActive(false);
614  $this->showCmd();
615  return;
616  }
617 
618  $this->ctrl->redirectByClass(
619  'ilAssQuestionHintRequestGUI',
621  );
622  }
showCmd(string $commands_panel_html='')
+ Here is the call graph for this function:

◆ getObject()

ilAssQuestionPreviewGUI::getObject ( )

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

References $question_obj.

◆ getQuestion()

ilAssQuestionPreviewGUI::getQuestion ( )

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

References $question_obj.

◆ getQuestionAnswerShuffler()

ilAssQuestionPreviewGUI::getQuestionAnswerShuffler ( )
private
Returns
Transformation

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

Referenced by populateQuestionOutput().

628  {
629  if (!$this->preview_session->randomizerSeedExists()) {
630  $this->preview_session->setRandomizerSeed((new RandomSeed())->createSeed());
631  }
632  return $this->random_group->shuffleArray(new GivenSeed((int) $this->preview_session->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->preview_settings->isInstantFeedbackNavigationRequired());
484  $navGUI->setHintProvidingEnabled($this->preview_settings->isHintProvidingEnabled());
485 
486  $navGUI->setHintRequestsPossible($this->hint_tracking->requestsPossible());
487  $navGUI->setHintRequestsExist($this->hint_tracking->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)

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

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

Referenced by showCmd().

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

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

References ILIAS\Repository\ctrl().

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

◆ initHintTracking()

ilAssQuestionPreviewGUI::initHintTracking ( )

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

171  : void
172  {
173  $this->hint_tracking = new ilAssQuestionPreviewHintTracking($this->db, $this->preview_session);
174  }

◆ initPreviewSession()

ilAssQuestionPreviewGUI::initPreviewSession ( int  $user_id,
int  $question_id 
)

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

165  : void
166  {
167  $this->preview_session = new ilAssQuestionPreviewSession($user_id, $question_id);
168  $this->preview_session->init();
169  }

◆ initPreviewSettings()

ilAssQuestionPreviewGUI::initPreviewSettings ( int  $parent_ref_id)

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

158  : void
159  {
160  $this->preview_settings = new ilAssQuestionPreviewSettings($parent_ref_id);
161 
162  $this->preview_settings->init();
163  }

◆ initQuestion()

ilAssQuestionPreviewGUI::initQuestion ( assQuestionGUI  $question_gui,
int  $parent_obj_id 
)

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

References $question_gui, ILIAS\Repository\ctrl(), assQuestionGUI\getObject(), assQuestionGUI\RENDER_PURPOSE_DEMOPLAY, and ILIAS\Repository\tabs().

126  : void
127  {
128  $this->question_gui = $question_gui;
129  $this->question_obj = $this->question_gui->getObject();
130 
131  $this->question_obj->setObjId($parent_obj_id);
132 
133  $this->tabs->clearTargets();
134  $this->tabs->addTarget(
135  self::TAB_ID_QUESTION,
136  $this->ctrl->getLinkTargetByClass(self::class, self::CMD_SHOW),
137  '',
138  [strtolower(__CLASS__)]
139  );
140  // Assessment of questions sub menu entry
141  $q_type = $this->question_obj->getQuestionType();
142  $classname = $q_type . 'GUI';
143  $this->tabs->addTarget(
144  'statistics',
145  $this->ctrl->getLinkTargetByClass(self::class, 'assessment'),
146  ['assessment'],
147  $classname,
148  ''
149  );
150 
151  $this->question_gui->populateJavascriptFilesRequiredForWorkForm($this->tpl);
152  $this->question_gui->setTargetGui($this);
153  $this->question_gui->setQuestionActionCmd(self::CMD_HANDLE_QUESTION_ACTION);
154 
155  $this->question_gui->setRenderPurpose(assQuestionGUI::RENDER_PURPOSE_DEMOPLAY);
156  }
+ Here is the call graph for this function:

◆ initStyleSheets()

ilAssQuestionPreviewGUI::initStyleSheets ( )

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

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

176  : void
177  {
178  $this->tpl->setCurrentBlock('ContentStyle');
179  $this->tpl->setVariable('LOCATION_CONTENT_STYLESHEET', ilObjStyleSheet::getContentStylePath(0));
180  $this->tpl->parseCurrentBlock();
181 
182  $this->tpl->setCurrentBlock('SyntaxStyle');
183  $this->tpl->setVariable('LOCATION_SYNTAX_STYLESHEET', ilObjStyleSheet::getSyntaxStylePath());
184  $this->tpl->parseCurrentBlock();
185  }
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 ( )

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

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

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

◆ isCommentingRequired()

ilAssQuestionPreviewGUI::isCommentingRequired ( )
protected

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

Referenced by showCmd().

242  : bool
243  {
244  return !$this->preview_settings->isTestRefId() &&
245  $this->rbac_system->checkAccess('read', $this->request_data_collector->getRefId());
246  }
+ 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->preview_settings->isBestSolutionEnabled()) {
558  return false;
559  }
560 
561  return $this->preview_session->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->preview_settings->isGenericFeedbackEnabled()) {
567  return false;
568  }
569 
570  return $this->preview_session->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->preview_settings->isReachedPointsEnabled()) {
585  return false;
586  }
587 
588  return $this->preview_session->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().

573  : bool
574  {
575  if (!$this->preview_settings->isSpecificFeedbackEnabled()) {
576  return false;
577  }
578 
579  return $this->preview_session->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->question_gui->getCommentsPanelHTML();
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->question_obj->isPreviewSolutionCorrect($this->preview_session)) {
499  $feedback = $this->question_gui->getGenericFeedbackOutputForCorrectSolution();
501  } else {
502  $feedback = $this->question_gui->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:

◆ populateQuestionOutput()

ilAssQuestionPreviewGUI::populateQuestionOutput ( ilTemplate  $tpl)
private

Definition at line 406 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().

406  : void
407  {
408  // FOR WHAT EXACTLY IS THIS USEFUL?
409  $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
410  $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
411 
412  $page_gui = new ilAssQuestionPageGUI($this->question_obj->getId());
413  $page_gui->setRenderPageContainer(false);
414  $page_gui->setEditPreview(true);
415  $page_gui->setEnabledTabs(false);
416 
417  $this->question_gui->setPreviewSession($this->preview_session);
418  $question = $this->question_gui->getObject();
419  $question->setShuffler($this->getQuestionAnswerShuffler());
420  $this->question_gui->setObject($question);
421 
422  $question_html = $this->question_gui->getPreview(true, $this->isShowSpecificQuestionFeedbackRequired());
423  $this->question_gui->magicAfterTestOutput();
424 
425  $question_html .= $this->getQuestionNavigationHtml();
426 
427  $page_gui->setQuestionHTML([$this->question_obj->getId() => $question_html]);
428 
429  $page_gui->setPresentationTitle($this->question_obj->getTitleForHTMLOutput());
430 
431  $tpl->setVariable('QUESTION_OUTPUT', $page_gui->preview());
432  // \ilPageObjectGUI::preview sets an undefined tab, so the "question" tab has to be activated again
433  $this->tabs->setTabActive(self::TAB_ID_QUESTION);
434  }
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 436 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by handleInstantResponseRendering().

436  : void
437  {
438  $reachedPoints = $this->question_obj->calculateReachedPointsFromPreviewSession($this->preview_session);
439  $maxPoints = $this->question_obj->getMaximumPoints();
440 
441  $scoreInformation = sprintf(
442  $this->lng->txt("you_received_a_of_b_points"),
443  $reachedPoints,
444  $maxPoints
445  );
446 
447  $tpl->setCurrentBlock("reached_points_feedback");
448  $tpl->setVariable("REACHED_POINTS_FEEDBACK", $scoreInformation);
449  $tpl->parseCurrentBlock();
450  }
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 452 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().

452  : void
453  {
454  // FOR WHAT EXACTLY IS THIS USEFUL?
455  $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
456  $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
457 
458  $pageGUI = new ilAssQuestionPageGUI($this->question_obj->getId());
459 
460  $pageGUI->setEditPreview(true);
461  $pageGUI->setEnabledTabs(false);
462 
463  $this->question_gui->setPreviewSession($this->preview_session);
464 
465  $pageGUI->setQuestionHTML([$this->question_obj->getId() => $this->question_gui->getSolutionOutput(0, null, false, false, true, false, true, false, false)]);
466 
467  $output = $this->question_gui->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->question_gui->getSpecificFeedbackOutput(
523  (array) $this->preview_session->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:

◆ populateToolbar()

ilAssQuestionPreviewGUI::populateToolbar ( )
private

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

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

Referenced by showCmd().

381  : void
382  {
383  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, self::CMD_SHOW));
384 
385  if ($this->rbac_system->checkAccess('write', $this->parent_obj_ref_id)) {
386  if ($this->primary_cmd !== []) {
387  $this->toolbar->addComponent(
388  $this->ui_factory->button()->primary(key($this->primary_cmd), current($this->primary_cmd))
389  );
390  }
391  foreach ($this->additional_cmds as $label => $action) {
392  $this->toolbar->addComponent(
393  $this->ui_factory->button()->standard($label, $action)
394  );
395  }
396  }
397 
398  $this->toolbar->addComponent(
399  $this->ui_factory->button()->standard(
400  $this->lng->txt('qpl_reset_preview'),
401  $this->ctrl->getLinkTargetByClass(ilAssQuestionPreviewGUI::class, self::CMD_RESET)
402  )
403  );
404  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetCmd()

ilAssQuestionPreviewGUI::resetCmd ( )

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

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

339  : void
340  {
341  $this->preview_session->setRandomizerSeed(null);
342  $this->preview_session->setParticipantsSolution(null);
343  $this->preview_session->resetRequestedHints();
344  $this->preview_session->setInstantResponseActive(false);
345 
346  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qst_preview_reset_msg'), true);
347 
348  $this->ctrl->redirect($this, self::CMD_SHOW);
349  }
+ 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->question_obj->persistPreviewState($this->preview_session);
594  }
+ Here is the caller graph for this function:

◆ setInfoMessage()

ilAssQuestionPreviewGUI::setInfoMessage ( string  $message)

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

101  : void
102  {
103  $this->info_message = $message;
104  }

◆ setPrimaryCmd()

ilAssQuestionPreviewGUI::setPrimaryCmd ( string  $label,
string  $cmd 
)

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

106  : void
107  {
108  $this->primary_cmd[$label] = $cmd;
109  }

◆ showCmd()

ilAssQuestionPreviewGUI::showCmd ( string  $commands_panel_html = '')

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

References buildPreviewFormAction(), assQuestionGUI\CMD_SYNC_QUESTION_AND_RETURN, handleInstantResponseRendering(), isCommentingRequired(), populateCommentsPanel(), populateQuestionOutput(), and populateToolbar().

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

248  : void
249  {
250  $tpl = new ilTemplate('tpl.qpl_question_preview.html', true, true, 'components/ILIAS/TestQuestionPool');
251  $tpl->setVariable('PREVIEW_FORMACTION', $this->buildPreviewFormAction());
252 
253  $modal = '';
254  if ($this->question_gui->isSaveCommand() && $this->question_gui->needsSyncQuery()) {
255  $modal = $this->question_gui->getQuestionSyncModal(assQuestionGUI::CMD_SYNC_QUESTION_AND_RETURN);
256  }
257 
258  if ($this->info_message !== null) {
259  $this->tpl->setOnScreenMessage('info', $this->info_message, true);
260  }
261 
262  $this->populateToolbar();
263  $this->populateQuestionOutput($tpl);
264  $this->handleInstantResponseRendering($tpl);
265 
266  if ($this->isCommentingRequired()) {
267  $this->populateCommentsPanel($tpl, $commands_panel_html);
268  }
269 
270  $this->tpl->setContent($tpl->get() . $modal);
271  }
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

◆ $additional_cmds

array< string $label, string $action > ilAssQuestionPreviewGUI::$additional_cmds = []
private

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

◆ $hint_tracking

ilAssQuestionPreviewHintTracking ilAssQuestionPreviewGUI::$hint_tracking = null
private

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

◆ $info_message

string ilAssQuestionPreviewGUI::$info_message = null
private

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

◆ $preview_session

ilAssQuestionPreviewSession ilAssQuestionPreviewGUI::$preview_session = null
private

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

◆ $preview_settings

ilAssQuestionPreviewSettings ilAssQuestionPreviewGUI::$preview_settings = null
private

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

◆ $primary_cmd

array< string $label, string $action > ilAssQuestionPreviewGUI::$primary_cmd = []
private

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

◆ $question_gui

assQuestionGUI ilAssQuestionPreviewGUI::$question_gui = null
private

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

Referenced by initQuestion().

◆ $question_obj

assQuestion ilAssQuestionPreviewGUI::$question_obj = null
private

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

Referenced by getObject(), and getQuestion().

◆ $request_data_collector

readonly RequestDataCollector ilAssQuestionPreviewGUI::$request_data_collector
protected

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

◆ CMD_GATEWAY_CONFIRM_HINT_REQUEST

const ilAssQuestionPreviewGUI::CMD_GATEWAY_CONFIRM_HINT_REQUEST = 'gatewayConfirmHintRequest'

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

◆ CMD_GATEWAY_SHOW_HINT_LIST

const ilAssQuestionPreviewGUI::CMD_GATEWAY_SHOW_HINT_LIST = 'gatewayShowHintList'

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

◆ CMD_HANDLE_QUESTION_ACTION

const ilAssQuestionPreviewGUI::CMD_HANDLE_QUESTION_ACTION = 'handleQuestionAction'

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

◆ CMD_INSTANT_RESPONSE

const ilAssQuestionPreviewGUI::CMD_INSTANT_RESPONSE = 'instantResponse'

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

◆ CMD_RESET

const ilAssQuestionPreviewGUI::CMD_RESET = 'reset'

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

◆ TAB_ID_QUESTION

const ilAssQuestionPreviewGUI::TAB_ID_QUESTION = 'question'

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


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