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';
59 parent::__construct($questionGUI);
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();
99 $cmd = $ilCtrl->getCmd(self::CMD_SHOW_LIST);
100 $nextClass = $ilCtrl->getNextClass($this);
104 case 'ilassquestionhintgui':
111 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
113 $ilCtrl->forwardCommand($gui);
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
191 $tpl->setContent( $ilCtrl->getHtml($toolbar) . $ilCtrl->getHtml($table) );
206 $hintIds = self::fetchHintIdsParameter();
208 if( !count($hintIds) )
210 ilUtil::sendFailure($lng->txt(
'tst_question_hints_delete_hints_missing_selection_msg'),
true);
211 $ilCtrl->redirect($this);
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) );
255 $hintIds = self::fetchHintIdsParameter();
257 if( !count($hintIds) )
259 ilUtil::sendFailure($lng->txt(
'tst_question_hints_delete_hints_missing_selection_msg'),
true);
260 $ilCtrl->redirect($this);
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";
293 $ilCtrl->redirect($this);
313 $hintIndexes = self::orderHintIndexes(
314 self::fetchHintIndexesParameter()
317 if( !count($hintIndexes) )
320 $ilCtrl->redirect($this);
327 foreach($hintIndexes as $hintId => $hintIndex)
329 if( !$curQuestionHintList->hintExists($hintId) )
332 $ilCtrl->redirect($this);
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";
352 $ilCtrl->redirect($this);
370 $moveHintIds = self::fetchHintIdsParameter();
373 $moveHintId = current($moveHintIds);
377 $this->hintOrderingClipboard->setStored($moveHintId);
379 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
398 $targetHintIds = self::fetchHintIdsParameter();
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);
429 $successMsg = sprintf(
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);
459 $targetHintIds = self::fetchHintIdsParameter();
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);
490 $successMsg = sprintf(
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();
517 ilUtil::sendInfo($lng->txt(
'tst_question_hints_ordering_clipboard_resetted'),
true);
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) )
602 ilUtil::sendFailure($lng->txt(
'tst_question_hints_cut_hints_missing_selection_msg'),
true);
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%');
744 $form->setTitle(sprintf(
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() );
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static getListByQuestionId($questionId)
instantiates a question hint list for the passed question id
const CMD_CUT_TO_ORDERING_CLIPBOARD
static orderHintIndexes($hintIndexes)
sorts the array of indexes by index value so keys (hint ids) get into new order submitted by user ...
setValue($a_value)
Set Value.
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...
getHintPresentationLinkTarget($hintId, $xmlStyle=true)
returns the link target for hint request presentation
static getInstanceById($hintId)
creates a hint object instance, loads the persisted hint dataset identified by passed hint id from da...
const PRESENTATION_MODE_AUTHOR
presentation mode for authoring
executeCommand()
Execute Command.
showListCmd()
shows a table with existing hints
showHintCmd()
shows an allready requested hint
static fetchHintIdsParameter()
fetches either an array of hint ids from POST or a single hint id from GET and returns an array of (a...
const CMD_RESET_ORDERING_CLIPBOARD
const PRESENTATION_MODE_PREVIEW
presentation mode for authoring
const CMD_SHOW_LIST
command constants
getQuestionHintListWithoutHintStoredInOrderingClipboard(ilAssQuestionHintList $questionHintList)
returns a new quastion hint list that contains all question hints from the passed list except for the...
Base Exception for all Exceptions relating to Modules/Test.
__construct(assQuestionGUI $questionGUI)
Constructor.
const CMD_SAVE_LIST_ORDER
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
resetOrderingClipboardCmd()
resets the ordering clipboard
const TBL_MODE_ADMINISTRATION
const TBL_MODE_TESTOUTPUT
the available table modes controlling the tables behaviour
cutToOrderingClipboardCmd()
cuts a hint from question hint list and stores it to ordering clipboard
pasteFromOrderingClipboardAfterCmd()
pastes a hint from ordering clipboard after the selected one
Basic GUI class for assessment questions.
const CMD_PASTE_FROM_ORDERING_CLIPBOARD_BEFORE
Create styles array
The data for the language used.
confirmDeleteCmd()
shows a confirmation screen with selected hints for deletion
performDeleteCmd()
performs confirmed deletion for selected hints
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
const CMD_SHOW_FORM
command constants
static getContentStylePath($a_style_id)
get content style path
static fetchHintIndexesParameter()
fetches an array of hint index values from POST
This class represents a non editable value in a property form.
pasteFromOrderingClipboardBeforeCmd()
pastes a hint from ordering clipboard before the selected one
addHint(ilAssQuestionHint $questionHint)
adds a question hint object to the current list instance
saveListOrderCmd()
saves the order based on index values passed from table's form (the table must not be paginated...
checkForSingleHintIdAndRedirectOnFailure($hintIds)
checks for a hint id in the passed array and redirects with corresponding failure message if not exac...
setEditingEnabled(bool $editingEnabled)
initHintOrderingClipboardNotification()
inits the notification telling the user, that a hint is stored to hint ordering clipboard ...
const CMD_PASTE_FROM_ORDERING_CLIPBOARD_AFTER
checkForExistingHintRelatingToCurrentQuestionAndRedirectOnFailure($hintId)
checks for an existing hint relating to current question and redirects with corresponding failure mes...
Confirmation screen class.
static _isWriteable($question_id, $user_id)
Returns true if the question is writeable by a certain user.