5 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintAbstractGUI.php';
6 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
7 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsOrderingClipboard.php';
69 $cmd = $ilCtrl->getCmd(self::CMD_SHOW_LIST);
70 $nextClass = $ilCtrl->getNextClass($this);
74 case 'ilassquestionhintgui':
76 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
79 return $ilCtrl->forwardCommand($gui);
100 require_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
101 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
107 if( $this->hintOrderingClipboard->hasStored() )
112 $lng->txt(
'tst_questions_hints_toolbar_cmd_reset_ordering_clipboard'),
113 $ilCtrl->getLinkTarget($this, self::CMD_RESET_ORDERING_CLIPBOARD)
119 $lng->txt(
'tst_questions_hints_toolbar_cmd_add_hint'),
125 $this->questionOBJ, $questionHintList, $this, self::CMD_SHOW_LIST,
129 $tpl->setContent( $ilCtrl->getHtml($toolbar) . $ilCtrl->getHtml($table) );
146 if( !count($hintIds) )
148 ilUtil::sendFailure($lng->txt(
'tst_question_hints_delete_hints_missing_selection_msg'),
true);
149 $ilCtrl->redirect($this);
152 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
155 $confirmation->setHeaderText($lng->txt(
'tst_question_hints_delete_hints_confirm_header'));
156 $confirmation->setFormAction($ilCtrl->getFormAction($this));
162 foreach($questionHintList as $questionHint)
166 if( in_array($questionHint->getId(), $hintIds) )
168 $confirmation->addItem(
'hint_ids[]', $questionHint->getId(), sprintf(
169 $lng->txt(
'tst_question_hints_delete_hints_confirm_item'), $questionHint->getIndex(), $questionHint->getText()
174 $tpl->setContent( $ilCtrl->getHtml($confirmation) );
190 if( !count($hintIds) )
192 ilUtil::sendFailure($lng->txt(
'tst_question_hints_delete_hints_missing_selection_msg'),
true);
193 $ilCtrl->redirect($this);
200 foreach($questionCompleteHintList as $listKey => $questionHint)
204 if( in_array($questionHint->getId(), $hintIds) )
206 $questionHint->delete();
210 $questionRemainingHintList->addHint($questionHint);
214 $questionRemainingHintList->reIndex();
218 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
219 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
226 $ilCtrl->redirect($this);
242 self::fetchHintIndexesParameter()
245 if( !count($hintIndexes) )
248 $ilCtrl->redirect($this);
255 foreach($hintIndexes as $hintId => $hintIndex)
257 if( !$curQuestionHintList->hintExists($hintId) )
260 $ilCtrl->redirect($this);
263 $questionHint = $curQuestionHintList->getHint($hintId);
265 $newQuestionHintList->addHint($questionHint);
268 $newQuestionHintList->reIndex();
272 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
273 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
280 $ilCtrl->redirect($this);
296 $moveHintId = current($moveHintIds);
300 $this->hintOrderingClipboard->setStored($moveHintId);
302 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
319 $targetHintId = current($targetHintIds);
326 foreach($curQuestionHintList as $questionHint)
330 if( $questionHint->getId() == $this->hintOrderingClipboard->getStored() )
335 if( $questionHint->getId() == $targetHintId )
337 $targetQuestionHint = $questionHint;
341 $newQuestionHintList->addHint($pasteQuestionHint);
344 $newQuestionHintList->addHint($questionHint);
347 $successMsg = sprintf(
348 $lng->txt(
'tst_question_hints_paste_before_success_msg'),
349 $pasteQuestionHint->getIndex(), $targetQuestionHint->getIndex()
352 $newQuestionHintList->reIndex();
354 $this->hintOrderingClipboard->resetStored();
358 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
375 $targetHintId = current($targetHintIds);
382 foreach($curQuestionHintList as $questionHint)
386 if( $questionHint->getId() == $this->hintOrderingClipboard->getStored() )
391 $newQuestionHintList->
addHint($questionHint);
393 if( $questionHint->getId() == $targetHintId )
395 $targetQuestionHint = $questionHint;
399 $newQuestionHintList->addHint($pasteQuestionHint);
403 $successMsg = sprintf(
404 $lng->txt(
'tst_question_hints_paste_after_success_msg'),
405 $pasteQuestionHint->getIndex(), $targetQuestionHint->getIndex()
408 $newQuestionHintList->reIndex();
410 $this->hintOrderingClipboard->resetStored();
414 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
428 $this->hintOrderingClipboard->resetStored();
430 ilUtil::sendInfo($lng->txt(
'tst_question_hints_ordering_clipboard_resetted'),
true);
431 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
445 if( !$this->hintOrderingClipboard->hasStored() )
453 $lng->txt(
'tst_question_hints_item_stored_in_ordering_clipboard'), $questionHint->getIndex()
468 if( !$questionHintList->hintExists($hintId) )
471 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
487 foreach($questionHintList as $questionHint)
491 if( $questionHint->getId() != $this->hintOrderingClipboard->getStored() )
493 $filteredQuestionHintList->addHint($questionHint);
497 return $filteredQuestionHintList;
513 if( !count($hintIds) )
515 ilUtil::sendFailure($lng->txt(
'tst_question_hints_cut_hints_missing_selection_msg'),
true);
516 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
518 elseif( count($hintIds) > 1 )
521 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
537 if( isset(
$_POST[
'hint_ids']) && is_array(
$_POST[
'hint_ids']) )
539 foreach(
$_POST[
'hint_ids'] as $hintId)
541 if( (
int)$hintId ) $hintIds[] = (int)$hintId;
544 elseif( isset(
$_GET[
'hint_id']) && (
int)
$_GET[
'hint_id'] )
546 $hintIds[] = (int)$_GET[
'hint_id'];
561 $hintIndexes = array();
563 if( isset(
$_POST[
'hint_indexes']) && is_array(
$_POST[
'hint_indexes']) )
565 foreach(
$_POST[
'hint_indexes'] as $hintId => $hintIndex)
567 if( (
int)$hintId ) $hintIndexes[(int)$hintId] = $hintIndex;
591 $this->questionGUI->originalSyncForm(
'showHints');