ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAssQuestionHintRequestGUI Class Reference
+ Inheritance diagram for ilAssQuestionHintRequestGUI:
+ Collaboration diagram for ilAssQuestionHintRequestGUI:

Public Member Functions

 __construct (ilTestOutputGUI $testOutputGUI, ilTestSession $testSession, assQuestionGUI $questionGUI)
 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

 $testOutputGUI = null
 
 $testSession = 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...
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionHintRequestGUI::__construct ( ilTestOutputGUI  $testOutputGUI,
ilTestSession  $testSession,
assQuestionGUI  $questionGUI 
)

Constructor.

Parameters
ilTestOutputGUI$testOutputGUI
ilTestSession$testSession
assQuestionGUI$questionGUI

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

References $testOutputGUI, and $testSession.

47  {
48  $this->testOutputGUI = $testOutputGUI;
49  $this->testSession = $testSession;
50 
51  parent::__construct($questionGUI);
52  }

Member Function Documentation

◆ backToQuestionCmd()

ilAssQuestionHintRequestGUI::backToQuestionCmd ( )
private

gateway command method to jump back to test session output

private ilCtrl $ilCtrl

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

References $ilCtrl.

260  {
261  global $ilCtrl;
262 
263  $ilCtrl->redirectByClass('ilTestOutputGUI', 'redirectQuestion');
264  }
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 188 of file class.ilAssQuestionHintRequestGUI.php.

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

189  {
190  global $ilCtrl, $tpl, $lng;
191 
193  $this->questionOBJ->getId(), $this->testSession->getActiveId(), $this->testSession->getPass()
194  );
195 
196  require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
197 
198  $confirmation = new ilConfirmationGUI();
199 
200  $formAction = ilUtil::appendUrlParameterString(
201  $ilCtrl->getFormAction($this), "hintId={$nextRequestableHint->getId()}"
202  );
203 
204  $confirmation->setFormAction($formAction);
205 
206  $confirmation->setConfirm($lng->txt('tst_question_hints_confirm_request'), self::CMD_PERFORM_REQUEST);
207  $confirmation->setCancel($lng->txt('tst_question_hints_cancel_request'), self::CMD_BACK_TO_QUESTION);
208 
209  $confirmation->setHeaderText(sprintf(
210  $lng->txt('tst_question_hints_request_confirmation'),
211  $nextRequestableHint->getIndex(),
212  $nextRequestableHint->getPoints()
213  ));
214 
215  $this->populateContent( $ilCtrl->getHtml($confirmation) );
216  }
populateContent($content)
populates the rendered questin hint relating output content to global template depending on possibly ...
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
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $lng
Definition: privfeed.php:40
static getNextRequestableHint($questionId, $activeId, $pass)
Returns the next requestable hint for given question relating to given testactive and testpass...
Confirmation screen class.
+ Here is the call graph for this function:

◆ executeCommand()

ilAssQuestionHintRequestGUI::executeCommand ( )

Execute Command.

public ilCtrl $ilCtrl

Returns
mixed

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

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

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

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

References $ilCtrl.

Referenced by performRequestCmd().

305  {
306  global $ilCtrl;
307 
308  if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
309  {
310  $ilCtrl->setParameterByClass('ilasshintpagegui', 'hint_id', $hintId);
311  $linkTarget = $ilCtrl->getLinkTargetByClass('ilAssHintPageGUI', '', '', false, $xmlStyle);
312  }
313  else
314  {
315  $ilCtrl->setParameter($this, 'hintId', $hintId);
316  $linkTarget = $ilCtrl->getLinkTarget($this, self::CMD_SHOW_HINT, '', false, $xmlStyle);
317  }
318 
319  return $linkTarget;
320  }
global $ilCtrl
Definition: ilias.php:18
+ 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 225 of file class.ilAssQuestionHintRequestGUI.php.

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

226  {
227  global $ilCtrl;
228 
229  if( !isset($_GET['hintId']) || !(int)$_GET['hintId'] )
230  {
231  throw new ilTestException('no hint id given');
232  }
233 
235  $this->questionOBJ->getId(), $this->testSession->getActiveId(), $this->testSession->getPass()
236  );
237 
238  if( $nextRequestableHint->getId() != (int)$_GET['hintId'] )
239  {
240  throw new ilTestException('given hint id does not relate to the next requestable hint');
241  }
242 
244  $nextRequestableHint, $this->questionOBJ->getId(),
245  $this->testSession->getActiveId(), $this->testSession->getPass()
246  );
247 
248  $redirectTarget = $this->getHintPresentationLinkTarget($nextRequestableHint->getId(), false);
249 
250  ilUtil::redirect($redirectTarget);
251  }
getHintPresentationLinkTarget($hintId, $xmlStyle=true)
returns the link target for hint request presentation
$_GET["client_id"]
static storeRequest(ilAssQuestionHint $questionHint, $questionId, $activeId, $pass)
Tracks the given hint as requested for the given question, testactive and testpass.
Base Exception for all Exceptions relating to Modules/Test.
global $ilCtrl
Definition: ilias.php:18
static redirect($a_script)
http redirect to other script
static getNextRequestableHint($questionId, $activeId, $pass)
Returns the next requestable hint for given question relating to given testactive and testpass...
+ 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 273 of file class.ilAssQuestionHintRequestGUI.php.

References $tpl.

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

274  {
275  global $tpl;
276 
277  if( $this->testOutputGUI->object->getKioskMode() )
278  {
279  $tpl->setBodyClass('kiosk');
280  $tpl->setAddFooter(false);
281 
282  $tpl->addBlockFile(
283  'CONTENT', 'content', 'tpl.il_tst_question_hints_kiosk_page.html', 'Modules/TestQuestionPool'
284  );
285 
286  $tpl->setVariable('KIOSK_HEAD', $this->testOutputGUI->getKioskHead());
287 
288  $tpl->setVariable('KIOSK_CONTENT', $content);
289  }
290  else
291  {
292  $tpl->setContent($content);
293  }
294  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ 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(), ilAssQuestionHintTracking\getNumExistingRequests(), ilAssQuestionHintTracking\isRequested(), 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 
126  (int)$_GET['hintId'], $this->testSession->getActiveId(), $this->testSession->getPass()
127  );
128 
129  if( !$isRequested )
130  {
131  throw new ilTestException('hint with given id is not yet requested for given testactive and testpass');
132  }
133 
134  $questionHint = ilAssQuestionHint::getInstanceById((int)$_GET['hintId']);
135 
136  require_once 'Services/Utilities/classes/class.ilUtil.php';
137  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
138  require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
139 
140  // build form
141 
142  $form = new ilPropertyFormGUI();
143 
144  $form->setFormAction($ilCtrl->getFormAction($this));
145 
146  $form->setTableWidth('100%');
147 
148  $form->setTitle(sprintf(
149  $lng->txt('tst_question_hints_form_header_edit'),
150  $questionHint->getIndex(),
151  $this->questionOBJ->getTitle()
152  ));
153 
154  $form->addCommandButton(self::CMD_BACK_TO_QUESTION, $lng->txt('tst_question_hints_back_to_question'));
155 
157  $this->questionOBJ->getId(), $this->testSession->getActiveId(), $this->testSession->getPass()
158  );
159 
160  if($numExistingRequests > 1)
161  {
162  $form->addCommandButton(self::CMD_SHOW_LIST, $lng->txt('button_show_requested_question_hints'));
163  }
164 
165  // form input: hint text
166 
167  $nonEditableHintText = new ilNonEditableValueGUI($lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text', true);
168  $nonEditableHintText->setValue( ilUtil::prepareTextareaOutput($questionHint->getText(), true) );
169  $form->addItem($nonEditableHintText);
170 
171  // form input: hint points
172 
173  $nonEditableHintPoints = new ilNonEditableValueGUI($lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points');
174  $nonEditableHintPoints->setValue($questionHint->getPoints());
175  $form->addItem($nonEditableHintPoints);
176 
177  $this->populateContent( $ilCtrl->getHtml($form) );
178  }
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 ...
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
Base Exception for all Exceptions relating to Modules/Test.
global $ilCtrl
Definition: ilias.php:18
static isRequested($hintId, $activeId, $pass)
Returns the fact wether the hint for given id is requested for the given testactive and testpass...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
This class represents a non editable value in a property form.
global $lng
Definition: privfeed.php:40
static getNumExistingRequests($questionId, $activeId, $pass)
Returns the number existing hint requests for the given question relating to the given testactive and...
+ Here is the call graph for this function:

◆ showListCmd()

ilAssQuestionHintRequestGUI::showListCmd ( )
private

shows the list of allready requested hints

private

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

References $ilCtrl, $tpl, ilAssQuestionHintTracking\getRequestedHintsList(), and populateContent().

92  {
93  global $ilCtrl, $tpl;
94 
95  require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
96 
98  $this->questionOBJ->getId(), $this->testSession->getActiveId(), $this->testSession->getPass()
99  );
100 
101  $table = new ilAssQuestionHintsTableGUI(
102  $this->questionOBJ, $questionHintList, $this, self::CMD_SHOW_LIST
103  );
104 
105  $this->populateContent( $ilCtrl->getHtml($table) );
106  }
static getRequestedHintsList($questionId, $activeId, $pass)
Returns an object of class ilAssQuestionHintList containing objects of class ilAssQuestionHint for al...
populateContent($content)
populates the rendered questin hint relating output content to global template depending on possibly ...
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the call graph for this function:

Field Documentation

◆ $testOutputGUI

ilAssQuestionHintRequestGUI::$testOutputGUI = null
protected

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

Referenced by __construct().

◆ $testSession

ilAssQuestionHintRequestGUI::$testSession = null
protected

Definition at line 37 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

const ilAssQuestionHintRequestGUI::CMD_SHOW_LIST = 'showList'

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