ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAssQuestionHintRequestGUI Class Reference
+ Inheritance diagram for ilAssQuestionHintRequestGUI:
+ Collaboration diagram for ilAssQuestionHintRequestGUI:

Public Member Functions

 __construct ($parentGUI, $parentCMD, assQuestionGUI $questionGUI, $questionHintTracking)
 Constructor. More...
 
 executeCommand ()
 Execute Command. More...
 
 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
 $questionGUI = null
 
 $questionOBJ = null
 

Private Member Functions

 showListCmd ()
 shows the list of allready requested hints More...
 
 showHintCmd ()
 shows an allready requested hint More...
 
 confirmRequestCmd ()
 shows a confirmation screen for a hint request 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)
 populates the rendered questin hint relating output content to global template depending on possibly active kiosk mode More...
 
 isQuestionPreview ()
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

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

References $parentCMD, $parentGUI, and $questionHintTracking.

48  {
49  $this->parentGUI = $parentGUI;
50  $this->parentCMD = $parentCMD;
51  $this->questionHintTracking = $questionHintTracking;
52 
53  parent::__construct($questionGUI);
54  }

Member Function Documentation

◆ backToQuestionCmd()

ilAssQuestionHintRequestGUI::backToQuestionCmd ( )
private

gateway command method to jump back to test session output

private ilCtrl $ilCtrl

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

References $ilCtrl.

263  {
264  global $ilCtrl;
265 
266  $ilCtrl->redirect($this->parentGUI, $this->parentCMD);
267  }
global $ilCtrl
Definition: ilias.php:18

◆ confirmRequestCmd()

ilAssQuestionHintRequestGUI::confirmRequestCmd ( )
private

shows a confirmation screen for a hint request

private ilCtrl $ilCtrl ilTemplate $tpl ilLanguage $lng

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

References $ilCtrl, $lng, $tpl, ilUtil\appendUrlParameterString(), and populateContent().

185  {
186  global $ilCtrl, $tpl, $lng;
187 
188  try
189  {
190  $nextRequestableHint = $this->questionHintTracking->getNextRequestableHint();
191  }
193  {
194  $ilCtrl->redirect($this, self::CMD_BACK_TO_QUESTION);
195  }
196 
197  require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
198 
199  $confirmation = new ilConfirmationGUI();
200 
201  $formAction = ilUtil::appendUrlParameterString(
202  $ilCtrl->getFormAction($this), "hintId={$nextRequestableHint->getId()}"
203  );
204 
205  $confirmation->setFormAction($formAction);
206 
207  $confirmation->setConfirm($lng->txt('tst_question_hints_confirm_request'), self::CMD_PERFORM_REQUEST);
208  $confirmation->setCancel($lng->txt('tst_question_hints_cancel_request'), self::CMD_BACK_TO_QUESTION);
209 
210  $confirmation->setHeaderText(sprintf(
211  $lng->txt('tst_question_hints_request_confirmation'),
212  $nextRequestableHint->getIndex(),
213  $nextRequestableHint->getPoints()
214  ));
215 
216  $this->populateContent( $ilCtrl->getHtml($confirmation) );
217  }
populateContent($content)
populates the rendered questin hint relating output content to global template depending on possibly ...
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
global $lng
Definition: privfeed.php:17
Confirmation screen class.
+ Here is the call graph for this function:

◆ executeCommand()

ilAssQuestionHintRequestGUI::executeCommand ( )

Execute Command.

public ilCtrl $ilCtrl

Returns
mixed

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

References $cmd, $ilCtrl, $lng, and ilAssQuestionHintPageObjectCommandForwarder\PRESENTATION_MODE_REQUEST.

64  {
65  global $ilCtrl, $ilTabs, $lng;
66 
67  $cmd = $ilCtrl->getCmd(self::CMD_SHOW_LIST);
68  $nextClass = $ilCtrl->getNextClass($this);
69 
70  switch($nextClass)
71  {
72  case 'ilasshintpagegui':
73 
74  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintPageObjectCommandForwarder.php';
75  $forwarder = new ilAssQuestionHintPageObjectCommandForwarder($this->questionOBJ, $ilCtrl, $ilTabs, $lng);
77  $forwarder->forward();
78  break;
79 
80  default:
81 
82  $cmd .= 'Cmd';
83  return $this->$cmd();
84  break;
85  }
86  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:17

◆ 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 317 of file class.ilAssQuestionHintRequestGUI.php.

References $ilCtrl.

Referenced by performRequestCmd().

318  {
319  global $ilCtrl;
320 
321  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
322  {
323  $ilCtrl->setParameterByClass('ilasshintpagegui', 'hint_id', $hintId);
324  $linkTarget = $ilCtrl->getLinkTargetByClass('ilAssHintPageGUI', '', '', false, $xmlStyle);
325  }
326  else
327  {
328  $ilCtrl->setParameter($this, 'hintId', $hintId);
329  $linkTarget = $ilCtrl->getLinkTarget($this, self::CMD_SHOW_HINT, '', false, $xmlStyle);
330  }
331 
332  return $linkTarget;
333  }
global $ilCtrl
Definition: ilias.php:18
+ Here is the caller graph for this function:

◆ isQuestionPreview()

ilAssQuestionHintRequestGUI::isQuestionPreview ( )
private

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

Referenced by populateContent().

300  {
301  if( $this->questionHintTracking instanceof ilAssQuestionPreviewHintTracking )
302  {
303  return true;
304  }
305 
306  return false;
307  }
+ 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 226 of file class.ilAssQuestionHintRequestGUI.php.

References $_GET, $ilCtrl, getHintPresentationLinkTarget(), and ilUtil\redirect().

227  {
228  global $ilCtrl;
229 
230  if( !isset($_GET['hintId']) || !(int)$_GET['hintId'] )
231  {
232  throw new ilTestException('no hint id given');
233  }
234 
235  try
236  {
237  $nextRequestableHint = $this->questionHintTracking->getNextRequestableHint();
238  }
240  {
241  $ilCtrl->redirect($this, self::CMD_BACK_TO_QUESTION);
242  }
243 
244  if( $nextRequestableHint->getId() != (int)$_GET['hintId'] )
245  {
246  throw new ilTestException('given hint id does not relate to the next requestable hint');
247  }
248 
249  $this->questionHintTracking->storeRequest($nextRequestableHint);
250 
251  $redirectTarget = $this->getHintPresentationLinkTarget($nextRequestableHint->getId(), false);
252 
253  ilUtil::redirect($redirectTarget);
254  }
getHintPresentationLinkTarget($hintId, $xmlStyle=true)
returns the link target for hint request presentation
$_GET["client_id"]
Base Exception for all Exceptions relating to Modules/Test.
global $ilCtrl
Definition: ilias.php:18
static redirect($a_script)
http redirect to other script
+ Here is the call graph for this function:

◆ populateContent()

ilAssQuestionHintRequestGUI::populateContent (   $content)
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 276 of file class.ilAssQuestionHintRequestGUI.php.

References $tpl, and isQuestionPreview().

Referenced by confirmRequestCmd(), showHintCmd(), and showListCmd().

277  {
278  global $tpl;
279 
280  if( !$this->isQuestionPreview() && $this->parentGUI->object->getKioskMode() )
281  {
282  $tpl->setBodyClass('kiosk');
283  $tpl->setAddFooter(false);
284 
285  $tpl->addBlockFile(
286  'CONTENT', 'content', 'tpl.il_tst_question_hints_kiosk_page.html', 'Modules/TestQuestionPool'
287  );
288 
289  $tpl->setVariable('KIOSK_HEAD', $this->parentGUI->getKioskHead());
290 
291  $tpl->setVariable('KIOSK_CONTENT', $content);
292  }
293  else
294  {
295  $tpl->setContent($content);
296  }
297  }
global $tpl
Definition: ilias.php:8
+ 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 116 of file class.ilAssQuestionHintRequestGUI.php.

References $_GET, $ilCtrl, $lng, $tpl, ilAssQuestionHint\getInstanceById(), populateContent(), ilUtil\prepareTextareaOutput(), and ilNonEditableValueGUI\setValue().

117  {
118  global $ilCtrl, $tpl, $lng;
119 
120  if( !isset($_GET['hintId']) || !(int)$_GET['hintId'] )
121  {
122  throw new ilTestException('no hint id given');
123  }
124 
125  $isRequested = $this->questionHintTracking->isRequested((int)$_GET['hintId']);
126 
127  if( !$isRequested )
128  {
129  throw new ilTestException('hint with given id is not yet requested for given testactive and testpass');
130  }
131 
132  $questionHint = ilAssQuestionHint::getInstanceById((int)$_GET['hintId']);
133 
134  require_once 'Services/Utilities/classes/class.ilUtil.php';
135  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
136  require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
137 
138  // build form
139 
140  $form = new ilPropertyFormGUI();
141 
142  $form->setFormAction($ilCtrl->getFormAction($this));
143 
144  $form->setTableWidth('100%');
145 
146  $form->setTitle(sprintf(
147  $lng->txt('tst_question_hints_form_header_edit'),
148  $questionHint->getIndex(),
149  $this->questionOBJ->getTitle()
150  ));
151 
152  $form->addCommandButton(self::CMD_BACK_TO_QUESTION, $lng->txt('tst_question_hints_back_to_question'));
153 
154  $numExistingRequests = $this->questionHintTracking->getNumExistingRequests();
155 
156  if($numExistingRequests > 1)
157  {
158  $form->addCommandButton(self::CMD_SHOW_LIST, $lng->txt('button_show_requested_question_hints'));
159  }
160 
161  // form input: hint text
162 
163  $nonEditableHintText = new ilNonEditableValueGUI($lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text', true);
164  $nonEditableHintText->setValue( ilUtil::prepareTextareaOutput($questionHint->getText(), true) );
165  $form->addItem($nonEditableHintText);
166 
167  // form input: hint points
168 
169  $nonEditableHintPoints = new ilNonEditableValueGUI($lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points');
170  $nonEditableHintPoints->setValue($questionHint->getPoints());
171  $form->addItem($nonEditableHintPoints);
172 
173  $this->populateContent( $ilCtrl->getHtml($form) );
174  }
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
This class represents a property form user interface.
$_GET["client_id"]
populateContent($content)
populates the rendered questin hint relating output content to global template depending on possibly ...
Base Exception for all Exceptions relating to Modules/Test.
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
This class represents a non editable value in a property form.
global $lng
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ showListCmd()

ilAssQuestionHintRequestGUI::showListCmd ( )
private

shows the list of allready requested hints

private

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

References $ilCtrl, $tpl, and populateContent().

94  {
95  global $ilCtrl, $tpl;
96 
97  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
98 
99  $questionHintList = $this->questionHintTracking->getRequestedHintsList();
100 
101  $table = new ilAssQuestionHintsTableGUI(
102  $this->questionOBJ, $questionHintList, $this, self::CMD_SHOW_LIST
103  );
104 
105  $this->populateContent( $ilCtrl->getHtml($table) );
106  }
populateContent($content)
populates the rendered questin hint relating output content to global template depending on possibly ...
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

Field Documentation

◆ $parentCMD

ilAssQuestionHintRequestGUI::$parentCMD = null
protected

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

Referenced by __construct().

◆ $parentGUI

ilAssQuestionHintRequestGUI::$parentGUI = null
protected

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

Referenced by __construct().

◆ $questionHintTracking

ilAssQuestionHintRequestGUI::$questionHintTracking = null
protected

Definition at line 42 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 26 of file class.ilAssQuestionHintRequestGUI.php.

◆ CMD_SHOW_HINT

const ilAssQuestionHintRequestGUI::CMD_SHOW_HINT = 'showHint'

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

◆ CMD_SHOW_LIST


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