ILIAS  trunk Revision v11.0_alpha-1851-ga8564da6fed
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 ()
 
 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.

111  : void
112  {
113  $this->additional_cmds[$label] = $cmd;
114  }

◆ assessmentCmd()

ilAssQuestionPreviewGUI::assessmentCmd ( )

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

References ILIAS\Repository\tabs().

267  {
268  $this->tabs->activateTab('statistics');
269  $this->question_gui->assessment();
270  }
+ Here is the call graph for this function:

◆ buildPreviewFormAction()

ilAssQuestionPreviewGUI::buildPreviewFormAction ( )
protected

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

References ILIAS\Repository\ctrl().

Referenced by showCmd().

230  : string
231  {
232  return $this->ctrl->getFormAction($this, self::CMD_SHOW) . '#' . self::FEEDBACK_FOCUS_ANCHOR;
233  }
+ 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(), 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  $forwarder = new ilAssQuestionFeedbackPageObjectCommandForwarder($this->question_obj, $this->ctrl, $this->tabs, $this->lng);
217  $forwarder->forward();
218  break;
219  case 'ilcommentgui':
220  $comment_gui = new ilCommentGUI($this->question_obj->getObjId(), $this->question_obj->getId(), 'quest');
221  $comments_panel_html = $this->ctrl->forwardCommand($comment_gui);
222  $this->showCmd($comments_panel_html);
223  break;
224  default:
225  $cmd = $this->ctrl->getCmd(self::CMD_SHOW);
226  $this->{$cmd . 'Cmd'}();
227  }
228  }
global $DIC
Definition: shib_login.php:22
Comment GUI.
showCmd(string $commands_panel_html='')
+ Here is the call graph for this function:

◆ gatewayConfirmHintRequestCmd()

ilAssQuestionPreviewGUI::gatewayConfirmHintRequestCmd ( )

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

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

576  : void
577  {
578  if (!$this->saveQuestionSolution()) {
579  $this->preview_session->setInstantResponseActive(false);
580  $this->showCmd();
581  return;
582  }
583 
584  $this->ctrl->redirectByClass(
585  'ilAssQuestionHintRequestGUI',
587  );
588  }
showCmd(string $commands_panel_html='')
+ Here is the call graph for this function:

◆ gatewayShowHintListCmd()

ilAssQuestionPreviewGUI::gatewayShowHintListCmd ( )

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

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

590  : void
591  {
592  if (!$this->saveQuestionSolution()) {
593  $this->preview_session->setInstantResponseActive(false);
594  $this->showCmd();
595  return;
596  }
597 
598  $this->ctrl->redirectByClass(
599  'ilAssQuestionHintRequestGUI',
601  );
602  }
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 607 of file class.ilAssQuestionPreviewGUI.php.

Referenced by populateQuestionOutput().

608  {
609  if (!$this->preview_session->randomizerSeedExists()) {
610  $this->preview_session->setRandomizerSeed((new RandomSeed())->createSeed());
611  }
612  return $this->random_group->shuffleArray(new GivenSeed((int) $this->preview_session->getRandomizerSeed()));
613  }
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 455 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by populateQuestionOutput().

455  : string
456  {
457  $navGUI = new ilAssQuestionRelatedNavigationBarGUI($this->ctrl, $this->lng);
458 
459  $navGUI->setInstantResponseCmd(self::CMD_INSTANT_RESPONSE);
460  $navGUI->setHintRequestCmd(self::CMD_GATEWAY_CONFIRM_HINT_REQUEST);
461  $navGUI->setHintListCmd(self::CMD_GATEWAY_SHOW_HINT_LIST);
462 
463  $navGUI->setInstantResponseEnabled($this->preview_settings->isInstantFeedbackNavigationRequired());
464  $navGUI->setHintProvidingEnabled($this->preview_settings->isHintProvidingEnabled());
465 
466  $navGUI->setHintRequestsPossible($this->hint_tracking->requestsPossible());
467  $navGUI->setHintRequestsExist($this->hint_tracking->requestsExist());
468 
469  return $this->ctrl->getHTML($navGUI);
470  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleInstantResponseRendering()

ilAssQuestionPreviewGUI::handleInstantResponseRendering ( ilTemplate  $tpl)

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

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

Referenced by showCmd().

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

References ILIAS\Repository\ctrl().

355  : void
356  {
357  $this->question_obj->persistPreviewState($this->preview_session);
358  $this->ctrl->redirect($this, self::CMD_SHOW);
359  }
+ 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 344 of file class.ilAssQuestionPreviewGUI.php.

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

344  : void
345  {
346  if ($this->saveQuestionSolution()) {
347  $this->preview_session->setInstantResponseActive(true);
348  } else {
349  $this->preview_session->setInstantResponseActive(false);
350  }
351 
352  $this->ctrl->redirect($this, self::CMD_SHOW);
353  }
+ Here is the call graph for this function:

◆ isCommentingRequired()

ilAssQuestionPreviewGUI::isCommentingRequired ( )
protected

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

Referenced by showCmd().

235  : bool
236  {
237  return !$this->preview_settings->isTestRefId() &&
238  $this->rbac_system->checkAccess('read', $this->request_data_collector->getRefId());
239  }
+ Here is the caller graph for this function:

◆ isShowBestSolutionRequired()

ilAssQuestionPreviewGUI::isShowBestSolutionRequired ( )
private

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

Referenced by handleInstantResponseRendering().

536  {
537  if (!$this->preview_settings->isBestSolutionEnabled()) {
538  return false;
539  }
540 
541  return $this->preview_session->isInstantResponseActive();
542  }
+ Here is the caller graph for this function:

◆ isShowGenericQuestionFeedbackRequired()

ilAssQuestionPreviewGUI::isShowGenericQuestionFeedbackRequired ( )
private

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

Referenced by handleInstantResponseRendering().

545  {
546  if (!$this->preview_settings->isGenericFeedbackEnabled()) {
547  return false;
548  }
549 
550  return $this->preview_session->isInstantResponseActive();
551  }
+ Here is the caller graph for this function:

◆ isShowReachedPointsRequired()

ilAssQuestionPreviewGUI::isShowReachedPointsRequired ( )
private

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

Referenced by handleInstantResponseRendering().

563  {
564  if (!$this->preview_settings->isReachedPointsEnabled()) {
565  return false;
566  }
567 
568  return $this->preview_session->isInstantResponseActive();
569  }
+ Here is the caller graph for this function:

◆ isShowSpecificQuestionFeedbackRequired()

ilAssQuestionPreviewGUI::isShowSpecificQuestionFeedbackRequired ( )
private

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

Referenced by handleInstantResponseRendering(), and populateQuestionOutput().

553  : bool
554  {
555  if (!$this->preview_settings->isSpecificFeedbackEnabled()) {
556  return false;
557  }
558 
559  return $this->preview_session->isInstantResponseActive();
560  }
+ Here is the caller graph for this function:

◆ populateCommentsPanel()

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

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

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

Referenced by showCmd().

615  : void
616  {
617  if ($comments_panel_html === '') {
618  $comments_panel_html = $this->question_gui->getCommentsPanelHTML();
619  }
620 
621  $tpl->setCurrentBlock('notes_panel');
622  $tpl->setVariable('NOTES_PANEL', $comments_panel_html);
623  $tpl->parseCurrentBlock();
624  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
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 476 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().

476  : bool
477  {
478  if ($this->question_obj->isPreviewSolutionCorrect($this->preview_session)) {
479  $feedback = $this->question_gui->getGenericFeedbackOutputForCorrectSolution();
481  } else {
482  $feedback = $this->question_gui->getGenericFeedbackOutputForIncorrectSolution();
484  }
485 
486  if ($feedback !== '') {
487  $tpl->setCurrentBlock('instant_feedback_generic');
488  $tpl->setVariable('GENERIC_FEEDBACK', $feedback);
489  $tpl->setVariable('ILC_FB_CSS_CLASS', $cssClass);
490  $tpl->parseCurrentBlock();
491  return true;
492  }
493  return false;
494  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
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 515 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by handleInstantResponseRendering().

515  : void
516  {
517  if ($withFocusAnchor) {
518  $tpl->setCurrentBlock('inst_resp_id');
519  $tpl->setVariable('INSTANT_RESPONSE_FOCUS_ID', self::FEEDBACK_FOCUS_ANCHOR);
520  $tpl->parseCurrentBlock();
521  }
522 
523  $tpl->setCurrentBlock('instant_response_header');
524  $tpl->setVariable('INSTANT_RESPONSE_HEADER', $this->lng->txt('tst_feedback'));
525  $tpl->parseCurrentBlock();
526  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
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 528 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by handleInstantResponseRendering().

529  {
530  $tpl->setCurrentBlock('instant_response_message');
531  $tpl->setVariable('INSTANT_RESPONSE_MESSAGE', $a_message);
532  $tpl->parseCurrentBlock();
533  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
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 386 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().

386  : void
387  {
388  // FOR WHAT EXACTLY IS THIS USEFUL?
389  $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
390  $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
391 
392  $page_gui = new ilAssQuestionPageGUI($this->question_obj->getId());
393  $page_gui->setRenderPageContainer(false);
394  $page_gui->setEditPreview(true);
395  $page_gui->setEnabledTabs(false);
396 
397  $this->question_gui->setPreviewSession($this->preview_session);
398  $question = $this->question_gui->getObject();
399  $question->setShuffler($this->getQuestionAnswerShuffler());
400  $this->question_gui->setObject($question);
401 
402  $question_html = $this->question_gui->getPreview(true, $this->isShowSpecificQuestionFeedbackRequired());
403  $this->question_gui->magicAfterTestOutput();
404 
405  $question_html .= $this->getQuestionNavigationHtml();
406 
407  $page_gui->setQuestionHTML([$this->question_obj->getId() => $question_html]);
408 
409  $page_gui->setPresentationTitle($this->question_obj->getTitleForHTMLOutput());
410 
411  $tpl->setVariable('QUESTION_OUTPUT', $page_gui->preview());
412  // \ilPageObjectGUI::preview sets an undefined tab, so the "question" tab has to be activated again
413  $this->tabs->setTabActive(self::TAB_ID_QUESTION);
414  }
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:544
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 416 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by handleInstantResponseRendering().

416  : void
417  {
418  $reachedPoints = $this->question_obj->calculateReachedPointsFromPreviewSession($this->preview_session);
419  $maxPoints = $this->question_obj->getMaximumPoints();
420 
421  $scoreInformation = sprintf(
422  $this->lng->txt("you_received_a_of_b_points"),
423  $reachedPoints,
424  $maxPoints
425  );
426 
427  $tpl->setCurrentBlock("reached_points_feedback");
428  $tpl->setVariable("REACHED_POINTS_FEEDBACK", $scoreInformation);
429  $tpl->parseCurrentBlock();
430  }
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
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 432 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by handleInstantResponseRendering().

432  : void
433  {
434  // FOR WHAT EXACTLY IS THIS USEFUL?
435  $this->ctrl->setReturnByClass('ilAssQuestionPageGUI', 'view');
436  $this->ctrl->setReturnByClass('ilObjQuestionPoolGUI', 'questions');
437 
438  $pageGUI = new ilAssQuestionPageGUI($this->question_obj->getId());
439 
440  $pageGUI->setEditPreview(true);
441  $pageGUI->setEnabledTabs(false);
442 
443  $this->question_gui->setPreviewSession($this->preview_session);
444 
445  $pageGUI->setQuestionHTML([$this->question_obj->getId() => $this->question_gui->getSolutionOutput(0, null, false, false, true, false, true, false, false)]);
446 
447  $output = $this->question_gui->getSolutionOutput(0, null, false, false, true, false, true, false, false);
448 
449  $tpl->setCurrentBlock('solution_output');
450  $tpl->setVariable('TXT_CORRECT_SOLUTION', $this->lng->txt('tst_best_solution_is'));
451  $tpl->setVariable('SOLUTION_OUTPUT', $output);
452  $tpl->parseCurrentBlock();
453  }
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...
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
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 500 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by handleInstantResponseRendering().

500  : bool
501  {
502  $fb = $this->question_gui->getSpecificFeedbackOutput(
503  (array) $this->preview_session->getParticipantsSolution()
504  );
505 
506  if (!empty($fb)) {
507  $tpl->setCurrentBlock('instant_feedback_specific');
508  $tpl->setVariable('ANSWER_FEEDBACK', $fb);
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:544
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 361 of file class.ilAssQuestionPreviewGUI.php.

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

Referenced by showCmd().

361  : void
362  {
363  $this->toolbar->setFormAction($this->ctrl->getFormAction($this, self::CMD_SHOW));
364 
365  if ($this->rbac_system->checkAccess('write', $this->parent_obj_ref_id)) {
366  if ($this->primary_cmd !== []) {
367  $this->toolbar->addComponent(
368  $this->ui_factory->button()->primary(key($this->primary_cmd), current($this->primary_cmd))
369  );
370  }
371  foreach ($this->additional_cmds as $label => $action) {
372  $this->toolbar->addComponent(
373  $this->ui_factory->button()->standard($label, $action)
374  );
375  }
376  }
377 
378  $this->toolbar->addComponent(
379  $this->ui_factory->button()->standard(
380  $this->lng->txt('qpl_reset_preview'),
381  $this->ctrl->getLinkTargetByClass(ilAssQuestionPreviewGUI::class, self::CMD_RESET)
382  )
383  );
384  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetCmd()

ilAssQuestionPreviewGUI::resetCmd ( )

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

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

332  : void
333  {
334  $this->preview_session->setRandomizerSeed(null);
335  $this->preview_session->setParticipantsSolution(null);
336  $this->preview_session->resetRequestedHints();
337  $this->preview_session->setInstantResponseActive(false);
338 
339  $this->tpl->setOnScreenMessage('info', $this->lng->txt('qst_preview_reset_msg'), true);
340 
341  $this->ctrl->redirect($this, self::CMD_SHOW);
342  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ saveQuestionSolution()

ilAssQuestionPreviewGUI::saveQuestionSolution ( )

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

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

571  : bool
572  {
573  return $this->question_obj->persistPreviewState($this->preview_session);
574  }
+ Here is the caller graph for this function:

◆ setInfoMessage()

ilAssQuestionPreviewGUI::setInfoMessage ( string  $message)

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

References $message.

Referenced by ilObjTestGUI\forwardCommandToQuestionPreview().

101  : void
102  {
103  $this->info_message = $message;
104  }
$message
Definition: xapiexit.php:31
+ Here is the caller graph for this function:

◆ 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 241 of file class.ilAssQuestionPreviewGUI.php.

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

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

241  : void
242  {
243  $tpl = new ilTemplate('tpl.qpl_question_preview.html', true, true, 'components/ILIAS/TestQuestionPool');
244  $tpl->setVariable('PREVIEW_FORMACTION', $this->buildPreviewFormAction());
245 
246  $modal = '';
247  if ($this->question_gui->isSaveCommand() && $this->question_gui->needsSyncQuery()) {
248  $modal = $this->question_gui->getQuestionSyncModal(assQuestionGUI::CMD_SYNC_QUESTION_AND_RETURN);
249  }
250 
251  if ($this->info_message !== null) {
252  $this->tpl->setOnScreenMessage('info', $this->info_message, true);
253  }
254 
255  $this->populateToolbar();
256  $this->populateQuestionOutput($tpl);
257  $this->handleInstantResponseRendering($tpl);
258 
259  if ($this->isCommentingRequired()) {
260  $this->populateCommentsPanel($tpl, $commands_panel_html);
261  }
262 
263  $this->tpl->setContent($tpl->get() . $modal);
264  }
populateCommentsPanel(ilTemplate $tpl, string $comments_panel_html)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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: