4require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintAbstractGUI.php';
5require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
6require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsOrderingClipboard.php';
91 $ilHelp =
$DIC[
'ilHelp'];
92 $ilHelp->setScreenIdComponent(
'qpl');
94 require_once
"./Services/Style/Content/classes/class.ilObjStyleSheet.php";
95 $tpl->setCurrentBlock(
"ContentStyle");
97 $tpl->parseCurrentBlock();
100 $nextClass =
$ilCtrl->getNextClass($this);
104 case 'ilassquestionhintgui':
111 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
116 case 'ilasshintpagegui':
127 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintPageObjectCommandForwarder.php';
129 $forwarder->setPresentationMode($presentationMode);
130 $forwarder->forward();
153 require_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
154 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
162 if( $this->hintOrderingClipboard->hasStored() )
167 $lng->txt(
'tst_questions_hints_toolbar_cmd_reset_ordering_clipboard'),
168 $ilCtrl->getLinkTarget($this, self::CMD_RESET_ORDERING_CLIPBOARD)
174 $lng->txt(
'tst_questions_hints_toolbar_cmd_add_hint'),
187 $this->questionOBJ, $questionHintList, $this, self::CMD_SHOW_LIST,
188 $tableMode, $this->hintOrderingClipboard
208 if( !count($hintIds) )
214 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
217 $confirmation->setHeaderText(
$lng->txt(
'tst_question_hints_delete_hints_confirm_header'));
218 $confirmation->setFormAction(
$ilCtrl->getFormAction($this));
219 $confirmation->setConfirm(
$lng->txt(
'tst_question_hints_delete_hints_confirm_cmd'), self::CMD_PERFORM_DELETE);
220 $confirmation->setCancel(
$lng->txt(
'cancel'), self::CMD_SHOW_LIST);
224 foreach($questionHintList as $questionHint)
228 if( in_array($questionHint->getId(), $hintIds) )
230 $confirmation->addItem(
'hint_ids[]', $questionHint->getId(),
sprintf(
231 $lng->txt(
'tst_question_hints_delete_hints_confirm_item'), $questionHint->getIndex(), $questionHint->getText()
236 $tpl->setContent(
$ilCtrl->getHtml($confirmation) );
257 if( !count($hintIds) )
267 foreach($questionCompleteHintList as $listKey => $questionHint)
271 if( in_array($questionHint->getId(), $hintIds) )
273 $questionHint->delete();
277 $questionRemainingHintList->addHint($questionHint);
281 $questionRemainingHintList->reIndex();
285 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
286 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
314 self::fetchHintIndexesParameter()
317 if( !count($hintIndexes) )
327 foreach($hintIndexes as $hintId => $hintIndex)
329 if( !$curQuestionHintList->hintExists($hintId) )
335 $questionHint = $curQuestionHintList->getHint($hintId);
337 $newQuestionHintList->addHint($questionHint);
340 $newQuestionHintList->reIndex();
344 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
345 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
373 $moveHintId = current($moveHintIds);
377 $this->hintOrderingClipboard->setStored($moveHintId);
379 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
401 $targetHintId = current($targetHintIds);
408 foreach($curQuestionHintList as $questionHint)
412 if( $questionHint->getId() == $this->hintOrderingClipboard->getStored() )
417 if( $questionHint->getId() == $targetHintId )
419 $targetQuestionHint = $questionHint;
423 $newQuestionHintList->addHint($pasteQuestionHint);
426 $newQuestionHintList->addHint($questionHint);
430 $lng->txt(
'tst_question_hints_paste_before_success_msg'),
431 $pasteQuestionHint->getIndex(), $targetQuestionHint->getIndex()
434 $newQuestionHintList->reIndex();
436 $this->hintOrderingClipboard->resetStored();
440 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
462 $targetHintId = current($targetHintIds);
469 foreach($curQuestionHintList as $questionHint)
473 if( $questionHint->getId() == $this->hintOrderingClipboard->getStored() )
478 $newQuestionHintList->addHint($questionHint);
480 if( $questionHint->getId() == $targetHintId )
482 $targetQuestionHint = $questionHint;
486 $newQuestionHintList->addHint($pasteQuestionHint);
491 $lng->txt(
'tst_question_hints_paste_after_success_msg'),
492 $pasteQuestionHint->getIndex(), $targetQuestionHint->getIndex()
495 $newQuestionHintList->reIndex();
497 $this->hintOrderingClipboard->resetStored();
501 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
515 $this->hintOrderingClipboard->resetStored();
518 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
532 if( !$this->hintOrderingClipboard->hasStored() )
540 $lng->txt(
'tst_question_hints_item_stored_in_ordering_clipboard'), $questionHint->getIndex()
555 if( !$questionHintList->hintExists($hintId) )
558 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
574 foreach($questionHintList as $questionHint)
578 if( $questionHint->getId() != $this->hintOrderingClipboard->getStored() )
580 $filteredQuestionHintList->addHint($questionHint);
584 return $filteredQuestionHintList;
600 if( !count($hintIds) )
603 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
605 elseif( count($hintIds) > 1 )
608 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
624 if( isset(
$_POST[
'hint_ids']) && is_array(
$_POST[
'hint_ids']) )
626 foreach(
$_POST[
'hint_ids'] as $hintId)
628 if( (
int)$hintId ) $hintIds[] = (int)$hintId;
631 elseif( isset(
$_GET[
'hint_id']) && (
int)
$_GET[
'hint_id'] )
633 $hintIds[] = (int)
$_GET[
'hint_id'];
648 $hintIndexes = array();
650 if( isset(
$_POST[
'hint_indexes']) && is_array(
$_POST[
'hint_indexes']) )
652 foreach(
$_POST[
'hint_indexes'] as $hintId => $hintIndex)
654 if( (
int)$hintId ) $hintIndexes[(int)$hintId] = $hintIndex;
678 $this->questionGUI->originalSyncForm(
'showHints');
693 if( $this->questionOBJ->isAdditionalContentEditingModePageObject() )
695 $ilCtrl->setParameterByClass(
'ilasshintpagegui',
'hint_id', $hintId);
696 $linkTarget =
$ilCtrl->getLinkTargetByClass(
'ilAssHintPageGUI',
'',
'',
false, $xmlStyle);
700 $ilCtrl->setParameter($this,
'hintId', $hintId);
701 $linkTarget =
$ilCtrl->getLinkTarget($this, self::CMD_SHOW_HINT,
'',
false, $xmlStyle);
722 if( !isset(
$_GET[
'hintId']) || !(
int)
$_GET[
'hintId'] )
727 $DIC->tabs()->clearTargets();
728 $DIC->tabs()->clearSubTabs();
730 $DIC->tabs()->setBackTarget(
731 $DIC->language()->txt(
'tst_question_hints_back_to_hint_list'),
$DIC->ctrl()->getLinkTarget($this, self::CMD_SHOW_LIST)
740 $form->setFormAction(
$ilCtrl->getFormAction($this));
742 $form->setTableWidth(
'100%');
745 $lng->txt(
'tst_question_hints_form_header_edit'),
746 $questionHint->getIndex(),
747 $this->questionOBJ->getTitle()
752 $nonEditableHintText =
new ilNonEditableValueGUI(
$lng->txt(
'tst_question_hints_form_label_hint_text'),
'hint_text',
true);
754 $form->addItem($nonEditableHintText);
758 $nonEditableHintPoints =
new ilNonEditableValueGUI(
$lng->txt(
'tst_question_hints_form_label_hint_points'),
'hint_points');
759 $nonEditableHintPoints->setValue($questionHint->getPoints());
760 $form->addItem($nonEditableHintPoints);
762 $tpl->setContent( $form->getHTML() );
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
Basic GUI class for assessment questions.
static _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
const PRESENTATION_MODE_PREVIEW
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
setEditingEnabled(bool $editingEnabled)
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...
getHintPresentationLinkTarget($hintId, $xmlStyle=true)
returns the link target for hint request presentation
showHintCmd()
shows an allready requested hint
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_TESTOUTPUT
the available table modes controlling the tables behaviour
const TBL_MODE_ADMINISTRATION
Confirmation screen class.
This class represents a non editable value in a property form.
static getContentStylePath($a_style_id)
get content style path
Base Exception for all Exceptions relating to Modules/Test.
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,...
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.