ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAssQuestionHintRequestGUI Class Reference
+ Inheritance diagram for ilAssQuestionHintRequestGUI:
+ Collaboration diagram for ilAssQuestionHintRequestGUI:

Public Member Functions

 __construct ($parentGUI, $parentCMD, assQuestionGUI $questionGUI, $questionHintTracking)
 Constructor. More...
 
 executeCommand ()
 
 getHintPresentationLinkTarget ($hintId, $xmlStyle=true)
 returns the link target for hint request presentation More...
 
- Public Member Functions inherited from ilAssQuestionHintAbstractGUI
 __construct (assQuestionGUI $questionGUI)
 Constructor. More...
 

Data Fields

const CMD_SHOW_LIST = 'showList'
 command constants More...
 
const CMD_SHOW_HINT = 'showHint'
 
const CMD_CONFIRM_REQUEST = 'confirmRequest'
 
const CMD_PERFORM_REQUEST = 'performRequest'
 
const CMD_BACK_TO_QUESTION = 'backToQuestion'
 

Protected Attributes

 $parentGUI = null
 
 $parentCMD = null
 
 $questionHintTracking = null
 
- Protected Attributes inherited from ilAssQuestionHintAbstractGUI
ILIAS TestQuestionPool InternalRequestService $request
 
assQuestionGUI $questionGUI = null
 
assQuestion $questionOBJ = null
 
ilTabsGUI $tabs
 

Private Member Functions

 showListCmd ()
 shows the list of allready requested hints More...
 
 showHintCmd ()
 shows an allready requested hint More...
 
 performRequestCmd ()
 Performs a hint request and invokes the (re-)saving the question solution. More...
 
 backToQuestionCmd ()
 gateway command method to jump back to test session output More...
 
 populateContent ($content, $tpl)
 populates the rendered questin hint relating output content to global template depending on possibly active kiosk mode More...
 
 isQuestionPreview ()
 

Detailed Description

Definition at line 30 of file class.ilAssQuestionHintRequestGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionHintRequestGUI::__construct (   $parentGUI,
  $parentCMD,
assQuestionGUI  $questionGUI,
  $questionHintTracking 
)

Constructor.

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

References $parentCMD, $parentGUI, $questionHintTracking, and ILIAS\GlobalScreen\Provider\__construct().

60  {
61  $this->parentGUI = $parentGUI;
62  $this->parentCMD = $parentCMD;
63  $this->questionHintTracking = $questionHintTracking;
64 
65  parent::__construct($questionGUI);
66  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ backToQuestionCmd()

ilAssQuestionHintRequestGUI::backToQuestionCmd ( )
private

gateway command method to jump back to test session output

private ilCtrl $ilCtrl

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

References $DIC.

304  : void
305  {
306  global $DIC;
307  $ilCtrl = $DIC['ilCtrl'];
308 
309  $ilCtrl->redirect($this->parentGUI, $this->parentCMD);
310  }
global $DIC
Definition: feed.php:28

◆ executeCommand()

ilAssQuestionHintRequestGUI::executeCommand ( )

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

References $DIC, $lng, and ilAssQuestionHintPageObjectCommandForwarder\PRESENTATION_MODE_REQUEST.

69  {
70  global $DIC;
71  $ilCtrl = $DIC['ilCtrl'];
72  $ilTabs = $DIC['ilTabs'];
73  $lng = $DIC['lng'];
74 
75  $cmd = $ilCtrl->getCmd(self::CMD_SHOW_LIST);
76  $nextClass = $ilCtrl->getNextClass($this);
77 
78  switch ($nextClass) {
79  case 'ilasshintpagegui':
80 
81  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintPageObjectCommandForwarder.php';
82  $forwarder = new ilAssQuestionHintPageObjectCommandForwarder($this->questionOBJ, $ilCtrl, $ilTabs, $lng);
84  $forwarder->forward();
85  break;
86 
87  default:
88 
89  $cmd .= 'Cmd';
90  return $this->$cmd();
91  break;
92  }
93  return '';
94  }
$lng
global $DIC
Definition: feed.php:28

◆ getHintPresentationLinkTarget()

ilAssQuestionHintRequestGUI::getHintPresentationLinkTarget (   $hintId,
  $xmlStyle = true 
)

returns the link target for hint request presentation

ilCtrl $ilCtrl

Parameters
integer$hintId
boolean$xmlStyle
Returns
string $linkTarget

Definition at line 359 of file class.ilAssQuestionHintRequestGUI.php.

References $DIC.

Referenced by performRequestCmd().

359  : string
360  {
361  global $DIC;
362  $ilCtrl = $DIC['ilCtrl'];
363 
364  if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
365  $ilCtrl->setParameterByClass('ilasshintpagegui', 'hint_id', $hintId);
366  $linkTarget = $ilCtrl->getLinkTargetByClass('ilAssHintPageGUI', '', '', false, $xmlStyle);
367  } else {
368  $ilCtrl->setParameter($this, 'hintId', $hintId);
369  $linkTarget = $ilCtrl->getLinkTarget($this, self::CMD_SHOW_HINT, '', false, $xmlStyle);
370  }
371 
372  return $linkTarget;
373  }
global $DIC
Definition: feed.php:28
+ Here is the caller graph for this function:

◆ isQuestionPreview()

ilAssQuestionHintRequestGUI::isQuestionPreview ( )
private

Definition at line 342 of file class.ilAssQuestionHintRequestGUI.php.

Referenced by populateContent().

342  : bool
343  {
344  if ($this->questionHintTracking instanceof ilAssQuestionPreviewHintTracking) {
345  return true;
346  }
347 
348  return false;
349  }
+ Here is the caller graph for this function:

◆ performRequestCmd()

ilAssQuestionHintRequestGUI::performRequestCmd ( )
private

Performs a hint request and invokes the (re-)saving the question solution.

Redirects to local showHint command

private ilCtrl $ilCtrl

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

References $DIC, Vendor\Package\$e, getHintPresentationLinkTarget(), ILIAS\Repository\int(), and ilUtil\redirect().

272  : void
273  {
274  global $DIC;
275  $ilCtrl = $DIC['ilCtrl'];
276 
277  if (!$this->request->isset('hintId') || !(int) $this->request->raw('hintId')) {
278  throw new ilTestException('no hint id given');
279  }
280 
281  try {
282  $nextRequestableHint = $this->questionHintTracking->getNextRequestableHint();
284  $ilCtrl->redirect($this, self::CMD_BACK_TO_QUESTION);
285  }
286 
287  if ($nextRequestableHint->getId() != (int) $this->request->raw('hintId')) {
288  throw new ilTestException('given hint id does not relate to the next requestable hint');
289  }
290 
291  $this->questionHintTracking->storeRequest($nextRequestableHint);
292 
293  $redirectTarget = $this->getHintPresentationLinkTarget($nextRequestableHint->getId(), false);
294 
295  ilUtil::redirect($redirectTarget);
296  }
getHintPresentationLinkTarget($hintId, $xmlStyle=true)
returns the link target for hint request presentation
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
static redirect(string $a_script)
+ Here is the call graph for this function:

◆ populateContent()

ilAssQuestionHintRequestGUI::populateContent (   $content,
  $tpl 
)
private

populates the rendered questin hint relating output content to global template depending on possibly active kiosk mode

ilTemplate $tpl

Parameters
string$content

Definition at line 319 of file class.ilAssQuestionHintRequestGUI.php.

References $DIC, $tpl, and isQuestionPreview().

Referenced by showHintCmd(), and showListCmd().

319  : void
320  {
321  global $DIC;
322  $tpl = $DIC['tpl'];
323 
324  if (!$this->isQuestionPreview() && $this->parentGUI->object->getKioskMode()) {
325  $tpl->hideFooter();
326 
327  $tpl->addBlockFile(
328  'CONTENT',
329  'kiosk_content',
330  'tpl.il_tst_question_hints_kiosk_page.html',
331  'Modules/TestQuestionPool'
332  );
333 
334  $tpl->setVariable('KIOSK_HEAD', $this->parentGUI->getKioskHead());
335 
336  $tpl->setVariable('KIOSK_CONTENT', $content);
337  } else {
338  $tpl->setContent($content);
339  }
340  }
global $DIC
Definition: feed.php:28
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showHintCmd()

ilAssQuestionHintRequestGUI::showHintCmd ( )
private

shows an allready requested hint

private ilCtrl $ilCtrl ilTemplate $tpl ilLanguage $lng

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

References $DIC, Vendor\Package\$e, $lng, $tpl, ilUtil\appendUrlParameterString(), ilAssQuestionHint\getInstanceById(), ILIAS\Repository\int(), populateContent(), ilLegacyFormElementsUtil\prepareTextareaOutput(), ilNonEditableValueGUI\setValue(), and ilTestPlayerLayoutProvider\TEST_PLAYER_TITLE.

138  : void
139  {
140  global $DIC;
141  $ilCtrl = $DIC['ilCtrl'];
142  $tpl = $DIC['tpl'];
143  $lng = $DIC['lng'];
144 
145  if (!$this->request->isset('hintId') || !(int) $this->request->raw('hintId')) {
146  throw new ilTestException('no hint id given');
147  }
148 
149  $isRequested = $this->questionHintTracking->isRequested((int) $this->request->raw('hintId'));
150 
151  if (!$isRequested) {
152  throw new ilTestException('hint with given id is not yet requested for given testactive and testpass');
153  }
154 
155  $questionHint = ilAssQuestionHint::getInstanceById((int) $this->request->raw('hintId'));
156 
157  require_once 'Services/Utilities/classes/class.ilUtil.php';
158  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
159  require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
160 
161  if ($DIC->globalScreen()->tool()->context()->current()->getAdditionalData()
163  $DIC->globalScreen()->tool()->context()->current()->getAdditionalData()->replace(
165  $this->parentGUI->getObject()->getTitle() . ' - ' . sprintf(
166  $lng->txt('tst_question_hints_form_header_edit'),
167  $questionHint->getIndex(),
168  $this->request->int('sequence') ?? 0
169  )
170  );
171  }
172 
173  $form = new ilPropertyFormGUI();
174 
175  $form->setFormAction($ilCtrl->getFormAction($this));
176 
177  $form->setTableWidth('100%');
178 
179  $form->setTitle(sprintf(
180  $lng->txt('tst_question_hints_form_header_edit'),
181  $questionHint->getIndex(),
182  $this->questionOBJ->getTitleForHTMLOutput()
183  ));
184 
185  $form->addCommandButton(self::CMD_BACK_TO_QUESTION, $lng->txt('tst_question_hints_back_to_question'));
186 
187  $numExistingRequests = $this->questionHintTracking->getNumExistingRequests();
188 
189  if ($numExistingRequests > 1) {
190  $form->addCommandButton(self::CMD_SHOW_LIST, $lng->txt('show_requested_question_hints'));
191  }
192 
193  // form input: hint text
194 
195  $nonEditableHintText = new ilNonEditableValueGUI($lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text', true);
196  $nonEditableHintText->setValue(ilLegacyFormElementsUtil::prepareTextareaOutput($questionHint->getText(), true));
197  $form->addItem($nonEditableHintText);
198 
199  // form input: hint points
200 
201  $nonEditableHintPoints = new ilNonEditableValueGUI($lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points');
202  $nonEditableHintPoints->setValue($questionHint->getPoints());
203  $form->addItem($nonEditableHintPoints);
204 
205  $this->populateContent($ilCtrl->getHtml($form), $tpl);
206  }
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
populateContent($content, $tpl)
populates the rendered questin hint relating output content to global template depending on possibly ...
$lng
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
static prepareTextareaOutput(string $txt_output, bool $prepare_for_latex_output=false, bool $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
+ Here is the call graph for this function:

◆ showListCmd()

ilAssQuestionHintRequestGUI::showListCmd ( )
private

shows the list of allready requested hints

private

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

References $DIC, $lng, $tpl, populateContent(), and ilTestPlayerLayoutProvider\TEST_PLAYER_TITLE.

101  : void
102  {
103  global $DIC;
104  $ilCtrl = $DIC['ilCtrl'];
105  $tpl = $DIC['tpl'];
106  $lng = $DIC['lng'];
107 
108  if ($DIC->globalScreen()->tool()->context()->current()->getAdditionalData()
110  $DIC->globalScreen()->tool()->context()->current()->getAdditionalData()->replace(
112  $this->parentGUI->getObject()->getTitle() . ' - ' . $lng->txt('show_requested_question_hints')
113  );
114  }
115 
116  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
117 
118  $questionHintList = $this->questionHintTracking->getRequestedHintsList();
119 
120  $table = new ilAssQuestionHintsTableGUI(
121  $this->questionOBJ,
122  $questionHintList,
123  $this,
124  self::CMD_SHOW_LIST
125  );
126 
127  $this->populateContent($ilCtrl->getHtml($table), $tpl);
128  }
populateContent($content, $tpl)
populates the rendered questin hint relating output content to global template depending on possibly ...
$lng
global $DIC
Definition: feed.php:28
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

Field Documentation

◆ $parentCMD

ilAssQuestionHintRequestGUI::$parentCMD = null
protected

Definition at line 49 of file class.ilAssQuestionHintRequestGUI.php.

Referenced by __construct().

◆ $parentGUI

ilAssQuestionHintRequestGUI::$parentGUI = null
protected

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

Referenced by __construct().

◆ $questionHintTracking

ilAssQuestionHintRequestGUI::$questionHintTracking = null
protected

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

Referenced by __construct().

◆ CMD_BACK_TO_QUESTION

const ilAssQuestionHintRequestGUI::CMD_BACK_TO_QUESTION = 'backToQuestion'

◆ CMD_CONFIRM_REQUEST

const ilAssQuestionHintRequestGUI::CMD_CONFIRM_REQUEST = 'confirmRequest'

◆ CMD_PERFORM_REQUEST

const ilAssQuestionHintRequestGUI::CMD_PERFORM_REQUEST = 'performRequest'

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

◆ CMD_SHOW_HINT

const ilAssQuestionHintRequestGUI::CMD_SHOW_HINT = 'showHint'

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

◆ CMD_SHOW_LIST


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