4 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintAbstractGUI.php';
5 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
6 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';
78 $ilCtrl->forwardCommand($gui);
81 case 'ilasshintpagegui':
83 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintPageObjectCommandForwarder.php';
86 $forwarder->forward();
109 require_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
110 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
116 if( $this->hintOrderingClipboard->hasStored() )
121 $lng->txt(
'tst_questions_hints_toolbar_cmd_reset_ordering_clipboard'),
122 $ilCtrl->getLinkTarget($this, self::CMD_RESET_ORDERING_CLIPBOARD)
128 $lng->txt(
'tst_questions_hints_toolbar_cmd_add_hint'),
134 $this->questionOBJ, $questionHintList, $this, self::CMD_SHOW_LIST,
138 $tpl->setContent( $ilCtrl->getHtml($toolbar) . $ilCtrl->getHtml($table) );
155 if( !count($hintIds) )
157 ilUtil::sendFailure($lng->txt(
'tst_question_hints_delete_hints_missing_selection_msg'),
true);
158 $ilCtrl->redirect($this);
161 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
164 $confirmation->setHeaderText($lng->txt(
'tst_question_hints_delete_hints_confirm_header'));
165 $confirmation->setFormAction($ilCtrl->getFormAction($this));
171 foreach($questionHintList as $questionHint)
175 if( in_array($questionHint->getId(), $hintIds) )
177 $confirmation->addItem(
'hint_ids[]', $questionHint->getId(), sprintf(
178 $lng->txt(
'tst_question_hints_delete_hints_confirm_item'), $questionHint->getIndex(), $questionHint->getText()
183 $tpl->setContent( $ilCtrl->getHtml($confirmation) );
199 if( !count($hintIds) )
201 ilUtil::sendFailure($lng->txt(
'tst_question_hints_delete_hints_missing_selection_msg'),
true);
202 $ilCtrl->redirect($this);
209 foreach($questionCompleteHintList as $listKey => $questionHint)
213 if( in_array($questionHint->getId(), $hintIds) )
215 $questionHint->delete();
219 $questionRemainingHintList->addHint($questionHint);
223 $questionRemainingHintList->reIndex();
227 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
228 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
235 $ilCtrl->redirect($this);
251 self::fetchHintIndexesParameter()
254 if( !count($hintIndexes) )
257 $ilCtrl->redirect($this);
264 foreach($hintIndexes as $hintId => $hintIndex)
266 if( !$curQuestionHintList->hintExists($hintId) )
269 $ilCtrl->redirect($this);
272 $questionHint = $curQuestionHintList->getHint($hintId);
274 $newQuestionHintList->addHint($questionHint);
277 $newQuestionHintList->reIndex();
281 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
282 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
289 $ilCtrl->redirect($this);
305 $moveHintId = current($moveHintIds);
309 $this->hintOrderingClipboard->setStored($moveHintId);
311 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
328 $targetHintId = current($targetHintIds);
335 foreach($curQuestionHintList as $questionHint)
339 if( $questionHint->getId() == $this->hintOrderingClipboard->getStored() )
344 if( $questionHint->getId() == $targetHintId )
346 $targetQuestionHint = $questionHint;
350 $newQuestionHintList->addHint($pasteQuestionHint);
353 $newQuestionHintList->addHint($questionHint);
356 $successMsg = sprintf(
357 $lng->txt(
'tst_question_hints_paste_before_success_msg'),
358 $pasteQuestionHint->getIndex(), $targetQuestionHint->getIndex()
361 $newQuestionHintList->reIndex();
363 $this->hintOrderingClipboard->resetStored();
367 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
384 $targetHintId = current($targetHintIds);
391 foreach($curQuestionHintList as $questionHint)
395 if( $questionHint->getId() == $this->hintOrderingClipboard->getStored() )
400 $newQuestionHintList->
addHint($questionHint);
402 if( $questionHint->getId() == $targetHintId )
404 $targetQuestionHint = $questionHint;
408 $newQuestionHintList->addHint($pasteQuestionHint);
412 $successMsg = sprintf(
413 $lng->txt(
'tst_question_hints_paste_after_success_msg'),
414 $pasteQuestionHint->getIndex(), $targetQuestionHint->getIndex()
417 $newQuestionHintList->reIndex();
419 $this->hintOrderingClipboard->resetStored();
423 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
437 $this->hintOrderingClipboard->resetStored();
439 ilUtil::sendInfo($lng->txt(
'tst_question_hints_ordering_clipboard_resetted'),
true);
440 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
454 if( !$this->hintOrderingClipboard->hasStored() )
462 $lng->txt(
'tst_question_hints_item_stored_in_ordering_clipboard'), $questionHint->getIndex()
477 if( !$questionHintList->hintExists($hintId) )
480 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
496 foreach($questionHintList as $questionHint)
500 if( $questionHint->getId() != $this->hintOrderingClipboard->getStored() )
502 $filteredQuestionHintList->addHint($questionHint);
506 return $filteredQuestionHintList;
522 if( !count($hintIds) )
524 ilUtil::sendFailure($lng->txt(
'tst_question_hints_cut_hints_missing_selection_msg'),
true);
525 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
527 elseif( count($hintIds) > 1 )
530 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
546 if( isset(
$_POST[
'hint_ids']) && is_array(
$_POST[
'hint_ids']) )
548 foreach(
$_POST[
'hint_ids'] as $hintId)
550 if( (
int)$hintId ) $hintIds[] = (int)$hintId;
553 elseif( isset(
$_GET[
'hint_id']) && (
int)
$_GET[
'hint_id'] )
555 $hintIds[] = (int)$_GET[
'hint_id'];
570 $hintIndexes = array();
572 if( isset(
$_POST[
'hint_indexes']) && is_array(
$_POST[
'hint_indexes']) )
574 foreach(
$_POST[
'hint_indexes'] as $hintId => $hintIndex)
576 if( (
int)$hintId ) $hintIndexes[(int)$hintId] = $hintIndex;
600 $this->questionGUI->originalSyncForm(
'showHints');