ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAssQuestionHintsGUI Class Reference
+ Inheritance diagram for ilAssQuestionHintsGUI:
+ Collaboration diagram for ilAssQuestionHintsGUI:

Public Member Functions

 __construct (assQuestionGUI $questionGUI)
 Constructor. More...
 
 executeCommand ()
 Execute Command. More...
 
 confirmSyncCmd ()
 
 __construct (assQuestionGUI $questionGUI)
 Constructor. More...
 

Data Fields

const CMD_SHOW_LIST = 'showList'
 command constants More...
 
const CMD_CONFIRM_DELETE = 'confirmDelete'
 
const CMD_PERFORM_DELETE = 'performDelete'
 
const CMD_SAVE_LIST_ORDER = 'saveListOrder'
 
const CMD_CUT_TO_ORDERING_CLIPBOARD = 'cutToOrderingClipboard'
 
const CMD_PASTE_FROM_ORDERING_CLIPBOARD_BEFORE = 'pasteFromOrderingClipboardBefore'
 
const CMD_PASTE_FROM_ORDERING_CLIPBOARD_AFTER = 'pasteFromOrderingClipboardAfter'
 
const CMD_RESET_ORDERING_CLIPBOARD = 'resetOrderingClipboard'
 
const CMD_CONFIRM_SYNC = 'confirmSync'
 

Private Member Functions

 showListCmd ()
 shows a table with existing hints More...
 
 confirmDeleteCmd ()
 shows a confirmation screen with selected hints for deletion More...
 
 performDeleteCmd ()
 performs confirmed deletion for selected hints More...
 
 saveListOrderCmd ()
 saves the order based on index values passed from table's form (the table must not be paginated, because ALL hints index values are required) More...
 
 cutToOrderingClipboardCmd ()
 cuts a hint from question hint list and stores it to ordering clipboard More...
 
 pasteFromOrderingClipboardBeforeCmd ()
 pastes a hint from ordering clipboard before the selected one More...
 
 pasteFromOrderingClipboardAfterCmd ()
 pastes a hint from ordering clipboard after the selected one More...
 
 resetOrderingClipboardCmd ()
 resets the ordering clipboard More...
 
 initHintOrderingClipboardNotification ()
 inits the notification telling the user, that a hint is stored to hint ordering clipboard More...
 
 checkForExistingHintRelatingToCurrentQuestionAndRedirectOnFailure ($hintId)
 checks for an existing hint relating to current question and redirects with corresponding failure message on failure More...
 
 getQuestionHintListWithoutHintStoredInOrderingClipboard (ilAssQuestionHintList $questionHintList)
 returns a new quastion hint list that contains all question hints from the passed list except for the hint that is stored to ordering clipboard More...
 
 checkForSingleHintIdAndRedirectOnFailure ($hintIds)
 checks for a hint id in the passed array and redirects with corresponding failure message if not exactly one id is given More...
 

Static Private Member Functions

static fetchHintIdsParameter ()
 fetches either an array of hint ids from POST or a single hint id from GET and returns an array of (a single) hint id(s) casted to integer in both cases More...
 
static fetchHintIndexesParameter ()
 fetches an array of hint index values from POST More...
 
static orderHintIndexes ($hintIndexes)
 sorts the array of indexes by index value so keys (hint ids) get into new order submitted by user More...
 

Private Attributes

 $hintOrderingClipboard = null
 

Additional Inherited Members

- Protected Attributes inherited from ilAssQuestionHintAbstractGUI
 $questionGUI = null
 
 $questionOBJ = null
 

Detailed Description

Definition at line 22 of file class.ilAssQuestionHintsGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionHintsGUI::__construct ( assQuestionGUI  $questionGUI)

Constructor.

@access public

Parameters
assQuestionGUI$questionGUI

Reimplemented from ilAssQuestionHintAbstractGUI.

Definition at line 51 of file class.ilAssQuestionHintsGUI.php.

References ilAssQuestionHintAbstractGUI\$questionGUI.

Member Function Documentation

◆ checkForExistingHintRelatingToCurrentQuestionAndRedirectOnFailure()

ilAssQuestionHintsGUI::checkForExistingHintRelatingToCurrentQuestionAndRedirectOnFailure (   $hintId)
private

checks for an existing hint relating to current question and redirects with corresponding failure message on failure

@access private

Parameters
integer$hintId

Definition at line 473 of file class.ilAssQuestionHintsGUI.php.

474 {
475 $questionHintList = ilAssQuestionHintList::getListByQuestionId( $this->questionOBJ->getId() );
476
477 if( !$questionHintList->hintExists($hintId) )
478 {
479 ilUtil::sendFailure($lng->txt('tst_question_hints_invalid_hint_id'), true);
480 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
481 }
482 }
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40

References $ilCtrl, $lng, ilAssQuestionHintList\getListByQuestionId(), and ilUtil\sendFailure().

Referenced by cutToOrderingClipboardCmd(), pasteFromOrderingClipboardAfterCmd(), and pasteFromOrderingClipboardBeforeCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkForSingleHintIdAndRedirectOnFailure()

ilAssQuestionHintsGUI::checkForSingleHintIdAndRedirectOnFailure (   $hintIds)
private

checks for a hint id in the passed array and redirects with corresponding failure message if not exactly one id is given

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

Parameters
array$hintIds

Definition at line 518 of file class.ilAssQuestionHintsGUI.php.

519 {
520 global $ilCtrl, $lng;
521
522 if( !count($hintIds) )
523 {
524 ilUtil::sendFailure($lng->txt('tst_question_hints_cut_hints_missing_selection_msg'), true);
525 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
526 }
527 elseif( count($hintIds) > 1 )
528 {
529 ilUtil::sendFailure($lng->txt('tst_question_hints_cut_hints_single_selection_msg'), true);
530 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
531 }
532 }

References $ilCtrl, $lng, and ilUtil\sendFailure().

Referenced by cutToOrderingClipboardCmd(), pasteFromOrderingClipboardAfterCmd(), and pasteFromOrderingClipboardBeforeCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeleteCmd()

ilAssQuestionHintsGUI::confirmDeleteCmd ( )
private

shows a confirmation screen with selected hints for deletion

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

Definition at line 149 of file class.ilAssQuestionHintsGUI.php.

150 {
151 global $ilCtrl, $tpl, $lng;
152
153 $hintIds = self::fetchHintIdsParameter();
154
155 if( !count($hintIds) )
156 {
157 ilUtil::sendFailure($lng->txt('tst_question_hints_delete_hints_missing_selection_msg'), true);
158 $ilCtrl->redirect($this);
159 }
160
161 require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
162 $confirmation = new ilConfirmationGUI();
163
164 $confirmation->setHeaderText($lng->txt('tst_question_hints_delete_hints_confirm_header'));
165 $confirmation->setFormAction($ilCtrl->getFormAction($this));
166 $confirmation->setConfirm($lng->txt('tst_question_hints_delete_hints_confirm_cmd'), self::CMD_PERFORM_DELETE);
167 $confirmation->setCancel($lng->txt('cancel'), self::CMD_SHOW_LIST);
168
169 $questionHintList = ilAssQuestionHintList::getListByQuestionId($this->questionOBJ->getId());
170
171 foreach($questionHintList as $questionHint)
172 {
173 /* @var $questionHint ilAssQuestionHint */
174
175 if( in_array($questionHint->getId(), $hintIds) )
176 {
177 $confirmation->addItem('hint_ids[]', $questionHint->getId(), sprintf(
178 $lng->txt('tst_question_hints_delete_hints_confirm_item'), $questionHint->getIndex(), $questionHint->getText()
179 ));
180 }
181 }
182
183 $tpl->setContent( $ilCtrl->getHtml($confirmation) );
184 }
global $tpl
Definition: ilias.php:8
static fetchHintIdsParameter()
fetches either an array of hint ids from POST or a single hint id from GET and returns an array of (a...
Confirmation screen class.

References $ilCtrl, $lng, $tpl, fetchHintIdsParameter(), ilAssQuestionHintList\getListByQuestionId(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ confirmSyncCmd()

ilAssQuestionHintsGUI::confirmSyncCmd ( )

Definition at line 598 of file class.ilAssQuestionHintsGUI.php.

599 {
600 $this->questionGUI->originalSyncForm('showHints');
601 }

◆ cutToOrderingClipboardCmd()

ilAssQuestionHintsGUI::cutToOrderingClipboardCmd ( )
private

cuts a hint from question hint list and stores it to ordering clipboard

@access private @global ilCtrl $ilCtrl

Definition at line 298 of file class.ilAssQuestionHintsGUI.php.

299 {
300 global $ilCtrl;
301
302 $moveHintIds = self::fetchHintIdsParameter();
303 $this->checkForSingleHintIdAndRedirectOnFailure($moveHintIds);
304
305 $moveHintId = current($moveHintIds);
306
308
309 $this->hintOrderingClipboard->setStored($moveHintId);
310
311 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
312 }
checkForExistingHintRelatingToCurrentQuestionAndRedirectOnFailure($hintId)
checks for an existing hint relating to current question and redirects with corresponding failure mes...
checkForSingleHintIdAndRedirectOnFailure($hintIds)
checks for a hint id in the passed array and redirects with corresponding failure message if not exac...

References $ilCtrl, checkForExistingHintRelatingToCurrentQuestionAndRedirectOnFailure(), checkForSingleHintIdAndRedirectOnFailure(), and fetchHintIdsParameter().

+ Here is the call graph for this function:

◆ executeCommand()

ilAssQuestionHintsGUI::executeCommand ( )

Execute Command.

@access public @global ilCtrl $ilCtrl

Returns
mixed

Definition at line 65 of file class.ilAssQuestionHintsGUI.php.

66 {
67 global $ilCtrl, $ilTabs, $lng;
68
69 $cmd = $ilCtrl->getCmd(self::CMD_SHOW_LIST);
70 $nextClass = $ilCtrl->getNextClass($this);
71
72 switch($nextClass)
73 {
74 case 'ilassquestionhintgui':
75
76 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
77 $gui = new ilAssQuestionHintGUI($this->questionGUI);
78 $ilCtrl->forwardCommand($gui);
79 break;
80
81 case 'ilasshintpagegui':
82
83 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintPageObjectCommandForwarder.php';
84 $forwarder = new ilAssQuestionHintPageObjectCommandForwarder($this->questionOBJ, $ilCtrl, $ilTabs, $lng);
86 $forwarder->forward();
87 break;
88
89 default:
90
91 $cmd .= 'Cmd';
92 $this->$cmd();
93 break;
94 }
95 }
$cmd
Definition: sahs_server.php:35

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

◆ fetchHintIdsParameter()

static ilAssQuestionHintsGUI::fetchHintIdsParameter ( )
staticprivate

fetches either an array of hint ids from POST or a single hint id from GET and returns an array of (a single) hint id(s) casted to integer in both cases

@access private

Returns
array $hintIds

Definition at line 542 of file class.ilAssQuestionHintsGUI.php.

543 {
544 $hintIds = array();
545
546 if( isset($_POST['hint_ids']) && is_array($_POST['hint_ids']) )
547 {
548 foreach($_POST['hint_ids'] as $hintId)
549 {
550 if( (int)$hintId ) $hintIds[] = (int)$hintId;
551 }
552 }
553 elseif( isset($_GET['hint_id']) && (int)$_GET['hint_id'] )
554 {
555 $hintIds[] = (int)$_GET['hint_id'];
556 }
557
558 return $hintIds;
559 }
$_GET["client_id"]
$_POST['username']
Definition: cron.php:12

References $_GET, and $_POST.

Referenced by confirmDeleteCmd(), cutToOrderingClipboardCmd(), pasteFromOrderingClipboardAfterCmd(), pasteFromOrderingClipboardBeforeCmd(), and performDeleteCmd().

+ Here is the caller graph for this function:

◆ fetchHintIndexesParameter()

static ilAssQuestionHintsGUI::fetchHintIndexesParameter ( )
staticprivate

fetches an array of hint index values from POST

@access private

Returns
array $hintIndexes

Definition at line 568 of file class.ilAssQuestionHintsGUI.php.

569 {
570 $hintIndexes = array();
571
572 if( isset($_POST['hint_indexes']) && is_array($_POST['hint_indexes']) )
573 {
574 foreach($_POST['hint_indexes'] as $hintId => $hintIndex)
575 {
576 if( (int)$hintId ) $hintIndexes[(int)$hintId] = $hintIndex;
577 }
578 }
579
580 return $hintIndexes;
581 }

References $_POST.

◆ getQuestionHintListWithoutHintStoredInOrderingClipboard()

ilAssQuestionHintsGUI::getQuestionHintListWithoutHintStoredInOrderingClipboard ( ilAssQuestionHintList  $questionHintList)
private

returns a new quastion hint list that contains all question hints from the passed list except for the hint that is stored to ordering clipboard

@access private

Parameters
ilAssQuestionHintList$questionHintList
Returns
ilAssQuestionHintList $filteredQuestionHintList

Definition at line 492 of file class.ilAssQuestionHintsGUI.php.

493 {
494 $filteredQuestionHintList = new ilAssQuestionHintList();
495
496 foreach($questionHintList as $questionHint)
497 {
498 /* @var $questionHint ilAssQuestionHint */
499
500 if( $questionHint->getId() != $this->hintOrderingClipboard->getStored() )
501 {
502 $filteredQuestionHintList->addHint($questionHint);
503 }
504 }
505
506 return $filteredQuestionHintList;
507 }

Referenced by showListCmd().

+ Here is the caller graph for this function:

◆ initHintOrderingClipboardNotification()

ilAssQuestionHintsGUI::initHintOrderingClipboardNotification ( )
private

inits the notification telling the user, that a hint is stored to hint ordering clipboard

@access private @global ilLanguage $lng

Definition at line 450 of file class.ilAssQuestionHintsGUI.php.

451 {
452 global $lng;
453
454 if( !$this->hintOrderingClipboard->hasStored() )
455 {
456 return;
457 }
458
459 $questionHint = ilAssQuestionHint::getInstanceById( $this->hintOrderingClipboard->getStored() );
460
461 ilUtil::sendInfo(sprintf(
462 $lng->txt('tst_question_hints_item_stored_in_ordering_clipboard'), $questionHint->getIndex()
463 ));
464 }
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $lng, ilAssQuestionHint\getInstanceById(), and ilUtil\sendInfo().

Referenced by showListCmd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ orderHintIndexes()

static ilAssQuestionHintsGUI::orderHintIndexes (   $hintIndexes)
staticprivate

sorts the array of indexes by index value so keys (hint ids) get into new order submitted by user

@access private

Returns
array $hintIndexes

Definition at line 591 of file class.ilAssQuestionHintsGUI.php.

592 {
593 asort($hintIndexes);
594
595 return $hintIndexes;
596 }

Referenced by saveListOrderCmd().

+ Here is the caller graph for this function:

◆ pasteFromOrderingClipboardAfterCmd()

ilAssQuestionHintsGUI::pasteFromOrderingClipboardAfterCmd ( )
private

pastes a hint from ordering clipboard after the selected one

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

Definition at line 377 of file class.ilAssQuestionHintsGUI.php.

378 {
379 global $ilCtrl, $lng;
380
381 $targetHintIds = self::fetchHintIdsParameter();
382 $this->checkForSingleHintIdAndRedirectOnFailure($targetHintIds);
383
384 $targetHintId = current($targetHintIds);
385
387
388 $curQuestionHintList = ilAssQuestionHintList::getListByQuestionId( $this->questionOBJ->getId() );
389 $newQuestionHintList = new ilAssQuestionHintList( $this->questionOBJ->getId() );
390
391 foreach($curQuestionHintList as $questionHint)
392 {
393 /* @var $questionHint ilAssQuestionHint */
394
395 if( $questionHint->getId() == $this->hintOrderingClipboard->getStored() )
396 {
397 continue;
398 }
399
400 $newQuestionHintList->addHint($questionHint);
401
402 if( $questionHint->getId() == $targetHintId )
403 {
404 $targetQuestionHint = $questionHint;
405
406 $pasteQuestionHint = ilAssQuestionHint::getInstanceById( $this->hintOrderingClipboard->getStored() );
407
408 $newQuestionHintList->addHint($pasteQuestionHint);
409 }
410 }
411
412 $successMsg = sprintf(
413 $lng->txt('tst_question_hints_paste_after_success_msg'),
414 $pasteQuestionHint->getIndex(), $targetQuestionHint->getIndex()
415 );
416
417 $newQuestionHintList->reIndex();
418
419 $this->hintOrderingClipboard->resetStored();
420
421 ilUtil::sendSuccess($successMsg, true);
422
423 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
424 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $ilCtrl, $lng, checkForExistingHintRelatingToCurrentQuestionAndRedirectOnFailure(), checkForSingleHintIdAndRedirectOnFailure(), fetchHintIdsParameter(), ilAssQuestionHint\getInstanceById(), ilAssQuestionHintList\getListByQuestionId(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ pasteFromOrderingClipboardBeforeCmd()

ilAssQuestionHintsGUI::pasteFromOrderingClipboardBeforeCmd ( )
private

pastes a hint from ordering clipboard before the selected one

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

Definition at line 321 of file class.ilAssQuestionHintsGUI.php.

322 {
323 global $ilCtrl, $lng;
324
325 $targetHintIds = self::fetchHintIdsParameter();
326 $this->checkForSingleHintIdAndRedirectOnFailure($targetHintIds);
327
328 $targetHintId = current($targetHintIds);
329
331
332 $curQuestionHintList = ilAssQuestionHintList::getListByQuestionId( $this->questionOBJ->getId() );
333 $newQuestionHintList = new ilAssQuestionHintList( $this->questionOBJ->getId() );
334
335 foreach($curQuestionHintList as $questionHint)
336 {
337 /* @var $questionHint ilAssQuestionHint */
338
339 if( $questionHint->getId() == $this->hintOrderingClipboard->getStored() )
340 {
341 continue;
342 }
343
344 if( $questionHint->getId() == $targetHintId )
345 {
346 $targetQuestionHint = $questionHint;
347
348 $pasteQuestionHint = ilAssQuestionHint::getInstanceById( $this->hintOrderingClipboard->getStored() );
349
350 $newQuestionHintList->addHint($pasteQuestionHint);
351 }
352
353 $newQuestionHintList->addHint($questionHint);
354 }
355
356 $successMsg = sprintf(
357 $lng->txt('tst_question_hints_paste_before_success_msg'),
358 $pasteQuestionHint->getIndex(), $targetQuestionHint->getIndex()
359 );
360
361 $newQuestionHintList->reIndex();
362
363 $this->hintOrderingClipboard->resetStored();
364
365 ilUtil::sendSuccess($successMsg, true);
366
367 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
368 }

References $ilCtrl, $lng, checkForExistingHintRelatingToCurrentQuestionAndRedirectOnFailure(), checkForSingleHintIdAndRedirectOnFailure(), fetchHintIdsParameter(), ilAssQuestionHint\getInstanceById(), ilAssQuestionHintList\getListByQuestionId(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ performDeleteCmd()

ilAssQuestionHintsGUI::performDeleteCmd ( )
private

performs confirmed deletion for selected hints

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

Definition at line 193 of file class.ilAssQuestionHintsGUI.php.

194 {
195 global $ilCtrl, $tpl, $lng;
196
197 $hintIds = self::fetchHintIdsParameter();
198
199 if( !count($hintIds) )
200 {
201 ilUtil::sendFailure($lng->txt('tst_question_hints_delete_hints_missing_selection_msg'), true);
202 $ilCtrl->redirect($this);
203 }
204
205 $questionCompleteHintList = ilAssQuestionHintList::getListByQuestionId($this->questionOBJ->getId());
206
207 $questionRemainingHintList = new ilAssQuestionHintList();
208
209 foreach($questionCompleteHintList as $listKey => $questionHint)
210 {
211 /* @var $questionHint ilAssQuestionHint */
212
213 if( in_array($questionHint->getId(), $hintIds) )
214 {
215 $questionHint->delete();
216 }
217 else
218 {
219 $questionRemainingHintList->addHint($questionHint);
220 }
221 }
222
223 $questionRemainingHintList->reIndex();
224
225 ilUtil::sendSuccess($lng->txt('tst_question_hints_delete_success_msg'), true);
226
227 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
228 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
229 global $ilUser;
230 if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->questionOBJ->original_id, $ilUser->getId()))
231 {
232 $ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_CONFIRM_SYNC);
233 }
234
235 $ilCtrl->redirect($this);
236 }
_isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
global $ilUser
Definition: imgupload.php:15

References $_GET, $ilCtrl, $ilUser, $lng, $tpl, assQuestion\_isWriteable(), CMD_CONFIRM_SYNC, fetchHintIdsParameter(), ilAssQuestionHintList\getListByQuestionId(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ resetOrderingClipboardCmd()

ilAssQuestionHintsGUI::resetOrderingClipboardCmd ( )
private

resets the ordering clipboard

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

Definition at line 433 of file class.ilAssQuestionHintsGUI.php.

434 {
435 global $ilCtrl, $lng;
436
437 $this->hintOrderingClipboard->resetStored();
438
439 ilUtil::sendInfo($lng->txt('tst_question_hints_ordering_clipboard_resetted'), true);
440 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
441 }

References $ilCtrl, $lng, and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ saveListOrderCmd()

ilAssQuestionHintsGUI::saveListOrderCmd ( )
private

saves the order based on index values passed from table's form (the table must not be paginated, because ALL hints index values are required)

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

Definition at line 246 of file class.ilAssQuestionHintsGUI.php.

247 {
248 global $ilCtrl, $lng;
249
250 $hintIndexes = self::orderHintIndexes(
251 self::fetchHintIndexesParameter()
252 );
253
254 if( !count($hintIndexes) )
255 {
256 ilUtil::sendFailure($lng->txt('tst_question_hints_save_order_unkown_failure_msg'), true);
257 $ilCtrl->redirect($this);
258 }
259
260 $curQuestionHintList = ilAssQuestionHintList::getListByQuestionId( $this->questionOBJ->getId() );
261
262 $newQuestionHintList = new ilAssQuestionHintList();
263
264 foreach($hintIndexes as $hintId => $hintIndex)
265 {
266 if( !$curQuestionHintList->hintExists($hintId) )
267 {
268 ilUtil::sendFailure($lng->txt('tst_question_hints_save_order_unkown_failure_msg'), true);
269 $ilCtrl->redirect($this);
270 }
271
272 $questionHint = $curQuestionHintList->getHint($hintId);
273
274 $newQuestionHintList->addHint($questionHint);
275 }
276
277 $newQuestionHintList->reIndex();
278
279 ilUtil::sendSuccess($lng->txt('tst_question_hints_save_order_success_msg'), true);
280
281 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
282 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
283 global $ilUser;
284 if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->questionOBJ->original_id, $ilUser->getId()))
285 {
286 $ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_CONFIRM_SYNC);
287 }
288
289 $ilCtrl->redirect($this);
290 }
static orderHintIndexes($hintIndexes)
sorts the array of indexes by index value so keys (hint ids) get into new order submitted by user

References $_GET, $ilCtrl, $ilUser, $lng, assQuestion\_isWriteable(), CMD_CONFIRM_SYNC, ilAssQuestionHintList\getListByQuestionId(), orderHintIndexes(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ showListCmd()

ilAssQuestionHintsGUI::showListCmd ( )
private

shows a table with existing hints

@access private @global ilTemplate $tpl

Definition at line 103 of file class.ilAssQuestionHintsGUI.php.

104 {
105 global $ilCtrl, $tpl, $lng;
106
108
109 require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
110 require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
111
112 $toolbar = new ilToolbarGUI();
113
114 $questionHintList = ilAssQuestionHintList::getListByQuestionId( $this->questionOBJ->getId() );
115
116 if( $this->hintOrderingClipboard->hasStored() )
117 {
118 $questionHintList = $this->getQuestionHintListWithoutHintStoredInOrderingClipboard($questionHintList);
119
120 $toolbar->addButton(
121 $lng->txt('tst_questions_hints_toolbar_cmd_reset_ordering_clipboard'),
122 $ilCtrl->getLinkTarget($this, self::CMD_RESET_ORDERING_CLIPBOARD)
123 );
124 }
125 else
126 {
127 $toolbar->addButton(
128 $lng->txt('tst_questions_hints_toolbar_cmd_add_hint'),
129 $ilCtrl->getLinkTargetByClass('ilAssQuestionHintGUI', ilAssQuestionHintGUI::CMD_SHOW_FORM)
130 );
131 }
132
133 $table = new ilAssQuestionHintsTableGUI(
134 $this->questionOBJ, $questionHintList, $this, self::CMD_SHOW_LIST,
135 ilAssQuestionHintsTableGUI::TBL_MODE_ADMINISTRATION, $this->hintOrderingClipboard
136 );
137
138 $tpl->setContent( $ilCtrl->getHtml($toolbar) . $ilCtrl->getHtml($table) );
139 }
const CMD_SHOW_FORM
command constants
getQuestionHintListWithoutHintStoredInOrderingClipboard(ilAssQuestionHintList $questionHintList)
returns a new quastion hint list that contains all question hints from the passed list except for the...
initHintOrderingClipboardNotification()
inits the notification telling the user, that a hint is stored to hint ordering clipboard

References $ilCtrl, $lng, $tpl, ilAssQuestionHintGUI\CMD_SHOW_FORM, ilAssQuestionHintList\getListByQuestionId(), getQuestionHintListWithoutHintStoredInOrderingClipboard(), initHintOrderingClipboardNotification(), and ilAssQuestionHintsTableGUI\TBL_MODE_ADMINISTRATION.

+ Here is the call graph for this function:

Field Documentation

◆ $hintOrderingClipboard

ilAssQuestionHintsGUI::$hintOrderingClipboard = null
private

Definition at line 43 of file class.ilAssQuestionHintsGUI.php.

◆ CMD_CONFIRM_DELETE

const ilAssQuestionHintsGUI::CMD_CONFIRM_DELETE = 'confirmDelete'

◆ CMD_CONFIRM_SYNC

const ilAssQuestionHintsGUI::CMD_CONFIRM_SYNC = 'confirmSync'

◆ CMD_CUT_TO_ORDERING_CLIPBOARD

const ilAssQuestionHintsGUI::CMD_CUT_TO_ORDERING_CLIPBOARD = 'cutToOrderingClipboard'

◆ CMD_PASTE_FROM_ORDERING_CLIPBOARD_AFTER

const ilAssQuestionHintsGUI::CMD_PASTE_FROM_ORDERING_CLIPBOARD_AFTER = 'pasteFromOrderingClipboardAfter'

◆ CMD_PASTE_FROM_ORDERING_CLIPBOARD_BEFORE

const ilAssQuestionHintsGUI::CMD_PASTE_FROM_ORDERING_CLIPBOARD_BEFORE = 'pasteFromOrderingClipboardBefore'

◆ CMD_PERFORM_DELETE

const ilAssQuestionHintsGUI::CMD_PERFORM_DELETE = 'performDelete'

Definition at line 29 of file class.ilAssQuestionHintsGUI.php.

◆ CMD_RESET_ORDERING_CLIPBOARD

const ilAssQuestionHintsGUI::CMD_RESET_ORDERING_CLIPBOARD = 'resetOrderingClipboard'

Definition at line 34 of file class.ilAssQuestionHintsGUI.php.

◆ CMD_SAVE_LIST_ORDER

const ilAssQuestionHintsGUI::CMD_SAVE_LIST_ORDER = 'saveListOrder'

◆ CMD_SHOW_LIST


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