ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 
)

Member Function Documentation

◆ backToQuestionCmd()

ilAssQuestionHintRequestGUI::backToQuestionCmd ( )
private

gateway command method to jump back to test session output

@access private @global ilCtrl $ilCtrl

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

267 {
268 global $DIC;
269 $ilCtrl = $DIC['ilCtrl'];
270
271 $ilCtrl->redirect($this->parentGUI, $this->parentCMD);
272 }
global $ilCtrl
Definition: ilias.php:18
$DIC
Definition: xapitoken.php:46

References $DIC, and $ilCtrl.

◆ confirmRequestCmd()

ilAssQuestionHintRequestGUI::confirmRequestCmd ( )
private

shows a confirmation screen for a hint request

@access private @global ilCtrl $ilCtrl @global ilTemplate $tpl @global ilLanguage $lng

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

192 {
193 global $DIC;
194 $ilCtrl = $DIC['ilCtrl'];
195 $tpl = $DIC['tpl'];
196 $lng = $DIC['lng'];
197
198 try {
199 $nextRequestableHint = $this->questionHintTracking->getNextRequestableHint();
201 $ilCtrl->redirect($this, self::CMD_BACK_TO_QUESTION);
202 }
203
204 require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
205
206 $confirmation = new ilConfirmationGUI();
207
209 $ilCtrl->getFormAction($this),
210 "hintId={$nextRequestableHint->getId()}"
211 );
212
213 $confirmation->setFormAction($formAction);
214
215 $confirmation->setConfirm($lng->txt('tst_question_hints_confirm_request'), self::CMD_PERFORM_REQUEST);
216 $confirmation->setCancel($lng->txt('tst_question_hints_cancel_request'), self::CMD_BACK_TO_QUESTION);
217
218 $confirmation->setHeaderText(sprintf(
219 $lng->txt('tst_question_hints_request_confirmation'),
220 $nextRequestableHint->getIndex(),
221 $nextRequestableHint->getPoints()
222 ));
223
224 $this->populateContent($ilCtrl->getHtml($confirmation));
225 }
populateContent($content)
populates the rendered questin hint relating output content to global template depending on possibly ...
Confirmation screen class.
static appendUrlParameterString($a_url, $a_par, $xml_style=false)
append URL parameter string ("par1=value1&par2=value2...") to given URL string
$lng
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl

References $DIC, Vendor\Package\$e, $ilCtrl, $lng, $tpl, ilUtil\appendUrlParameterString(), and populateContent().

+ Here is the call graph for this function:

◆ executeCommand()

ilAssQuestionHintRequestGUI::executeCommand ( )

Execute Command.

@access public @global ilCtrl $ilCtrl

Returns
mixed

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

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

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

◆ getHintPresentationLinkTarget()

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

returns the link target for hint request presentation

@global ilCtrl $ilCtrl

Parameters
integer$hintId
boolean$xmlStyle
Returns
string $linkTarget

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

323 {
324 global $DIC;
325 $ilCtrl = $DIC['ilCtrl'];
326
327 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
328 $ilCtrl->setParameterByClass('ilasshintpagegui', 'hint_id', $hintId);
329 $linkTarget = $ilCtrl->getLinkTargetByClass('ilAssHintPageGUI', '', '', false, $xmlStyle);
330 } else {
331 $ilCtrl->setParameter($this, 'hintId', $hintId);
332 $linkTarget = $ilCtrl->getLinkTarget($this, self::CMD_SHOW_HINT, '', false, $xmlStyle);
333 }
334
335 return $linkTarget;
336 }

References $DIC, and $ilCtrl.

Referenced by performRequestCmd().

+ Here is the caller graph for this function:

◆ isQuestionPreview()

ilAssQuestionHintRequestGUI::isQuestionPreview ( )
private

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

306 {
307 if ($this->questionHintTracking instanceof ilAssQuestionPreviewHintTracking) {
308 return true;
309 }
310
311 return false;
312 }

Referenced by populateContent().

+ 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

@access private @global ilCtrl $ilCtrl

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

235 {
236 global $DIC;
237 $ilCtrl = $DIC['ilCtrl'];
238
239 if (!isset($_GET['hintId']) || !(int) $_GET['hintId']) {
240 throw new ilTestException('no hint id given');
241 }
242
243 try {
244 $nextRequestableHint = $this->questionHintTracking->getNextRequestableHint();
246 $ilCtrl->redirect($this, self::CMD_BACK_TO_QUESTION);
247 }
248
249 if ($nextRequestableHint->getId() != (int) $_GET['hintId']) {
250 throw new ilTestException('given hint id does not relate to the next requestable hint');
251 }
252
253 $this->questionHintTracking->storeRequest($nextRequestableHint);
254
255 $redirectTarget = $this->getHintPresentationLinkTarget($nextRequestableHint->getId(), false);
256
257 ilUtil::redirect($redirectTarget);
258 }
$_GET["client_id"]
getHintPresentationLinkTarget($hintId, $xmlStyle=true)
returns the link target for hint request presentation
Base Exception for all Exceptions relating to Modules/Test.
static redirect($a_script)

References $_GET, $DIC, Vendor\Package\$e, $ilCtrl, getHintPresentationLinkTarget(), and ilUtil\redirect().

+ 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

@global ilTemplate $tpl

Parameters
string$content

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

282 {
283 global $DIC;
284 $tpl = $DIC['tpl'];
285
286 if (!$this->isQuestionPreview() && $this->parentGUI->object->getKioskMode()) {
287 $tpl->setBodyClass('kiosk');
288 $tpl->hideFooter();
289
290 $tpl->addBlockFile(
291 'CONTENT',
292 'content',
293 'tpl.il_tst_question_hints_kiosk_page.html',
294 'Modules/TestQuestionPool'
295 );
296
297 $tpl->setVariable('KIOSK_HEAD', $this->parentGUI->getKioskHead());
298
299 $tpl->setVariable('KIOSK_CONTENT', $content);
300 } else {
301 $tpl->setContent($content);
302 }
303 }

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

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

+ 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

@access private @global ilCtrl $ilCtrl @global ilTemplate $tpl @global ilLanguage $lng

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

124 {
125 global $DIC;
126 $ilCtrl = $DIC['ilCtrl'];
127 $tpl = $DIC['tpl'];
128 $lng = $DIC['lng'];
129
130 if (!isset($_GET['hintId']) || !(int) $_GET['hintId']) {
131 throw new ilTestException('no hint id given');
132 }
133
134 $isRequested = $this->questionHintTracking->isRequested((int) $_GET['hintId']);
135
136 if (!$isRequested) {
137 throw new ilTestException('hint with given id is not yet requested for given testactive and testpass');
138 }
139
140 $questionHint = ilAssQuestionHint::getInstanceById((int) $_GET['hintId']);
141
142 require_once 'Services/Utilities/classes/class.ilUtil.php';
143 require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
144 require_once 'Services/Form/classes/class.ilNonEditableValueGUI.php';
145
146 // build form
147
148 $form = new ilPropertyFormGUI();
149
150 $form->setFormAction($ilCtrl->getFormAction($this));
151
152 $form->setTableWidth('100%');
153
154 $form->setTitle(sprintf(
155 $lng->txt('tst_question_hints_form_header_edit'),
156 $questionHint->getIndex(),
157 $this->questionOBJ->getTitle()
158 ));
159
160 $form->addCommandButton(self::CMD_BACK_TO_QUESTION, $lng->txt('tst_question_hints_back_to_question'));
161
162 $numExistingRequests = $this->questionHintTracking->getNumExistingRequests();
163
164 if ($numExistingRequests > 1) {
165 $form->addCommandButton(self::CMD_SHOW_LIST, $lng->txt('button_show_requested_question_hints'));
166 }
167
168 // form input: hint text
169
170 $nonEditableHintText = new ilNonEditableValueGUI($lng->txt('tst_question_hints_form_label_hint_text'), 'hint_text', true);
171 $nonEditableHintText->setValue(ilUtil::prepareTextareaOutput($questionHint->getText(), true));
172 $form->addItem($nonEditableHintText);
173
174 // form input: hint points
175
176 $nonEditableHintPoints = new ilNonEditableValueGUI($lng->txt('tst_question_hints_form_label_hint_points'), 'hint_points');
177 $nonEditableHintPoints->setValue($questionHint->getPoints());
178 $form->addItem($nonEditableHintPoints);
179
180 $this->populateContent($ilCtrl->getHtml($form));
181 }
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
This class represents a non editable value in a property form.
This class represents a property form user interface.
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,...

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

+ Here is the call graph for this function:

◆ showListCmd()

ilAssQuestionHintRequestGUI::showListCmd ( )
private

shows the list of allready requested hints

@access private

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

96 {
97 global $DIC;
98 $ilCtrl = $DIC['ilCtrl'];
99 $tpl = $DIC['tpl'];
100
101 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
102
103 $questionHintList = $this->questionHintTracking->getRequestedHintsList();
104
105 $table = new ilAssQuestionHintsTableGUI(
106 $this->questionOBJ,
107 $questionHintList,
108 $this,
109 self::CMD_SHOW_LIST
110 );
111
112 $this->populateContent($ilCtrl->getHtml($table));
113 }

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

+ 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: