4require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintAbstractGUI.php';
5require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
6require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsOrderingClipboard.php';
70 $nextClass =
$ilCtrl->getNextClass($this);
74 case 'ilassquestionhintgui':
76 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
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,
155 if( !count($hintIds) )
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));
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);
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) )
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";
251 self::fetchHintIndexesParameter()
254 if( !count($hintIndexes) )
264 foreach($hintIndexes as $hintId => $hintIndex)
266 if( !$curQuestionHintList->hintExists($hintId) )
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";
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();
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) )
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');
Basic GUI class for assessment questions.
_isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.
const CMD_SHOW_FORM
command constants
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
const PRESENTATION_MODE_AUTHOR
presentation mode for authoring
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
pasteFromOrderingClipboardAfterCmd()
pastes a hint from ordering clipboard after the selected one
resetOrderingClipboardCmd()
resets the ordering clipboard
getQuestionHintListWithoutHintStoredInOrderingClipboard(ilAssQuestionHintList $questionHintList)
returns a new quastion hint list that contains all question hints from the passed list except for the...
__construct(assQuestionGUI $questionGUI)
Constructor.
initHintOrderingClipboardNotification()
inits the notification telling the user, that a hint is stored to hint ordering clipboard
pasteFromOrderingClipboardBeforeCmd()
pastes a hint from ordering clipboard before the selected one
static fetchHintIdsParameter()
fetches either an array of hint ids from POST or a single hint id from GET and returns an array of (a...
cutToOrderingClipboardCmd()
cuts a hint from question hint list and stores it to ordering clipboard
const CMD_PASTE_FROM_ORDERING_CLIPBOARD_AFTER
static fetchHintIndexesParameter()
fetches an array of hint index values from POST
performDeleteCmd()
performs confirmed deletion for selected hints
saveListOrderCmd()
saves the order based on index values passed from table's form (the table must not be paginated,...
const CMD_RESET_ORDERING_CLIPBOARD
checkForExistingHintRelatingToCurrentQuestionAndRedirectOnFailure($hintId)
checks for an existing hint relating to current question and redirects with corresponding failure mes...
executeCommand()
Execute Command.
const CMD_PASTE_FROM_ORDERING_CLIPBOARD_BEFORE
checkForSingleHintIdAndRedirectOnFailure($hintIds)
checks for a hint id in the passed array and redirects with corresponding failure message if not exac...
showListCmd()
shows a table with existing hints
static orderHintIndexes($hintIndexes)
sorts the array of indexes by index value so keys (hint ids) get into new order submitted by user
const CMD_SAVE_LIST_ORDER
const CMD_CUT_TO_ORDERING_CLIPBOARD
confirmDeleteCmd()
shows a confirmation screen with selected hints for deletion
const CMD_SHOW_LIST
command constants
const TBL_MODE_ADMINISTRATION
Confirmation screen class.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.