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);
102 switch ($nextClass) {
103 case 'ilassquestionhintgui':
109 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
111 $ilCtrl->forwardCommand($gui);
114 case 'ilasshintpagegui':
122 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintPageObjectCommandForwarder.php';
124 $forwarder->setPresentationMode($presentationMode);
125 $forwarder->forward();
148 require_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
149 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
156 if ($this->hintOrderingClipboard->hasStored()) {
160 $lng->txt(
'tst_questions_hints_toolbar_cmd_reset_ordering_clipboard'),
161 $ilCtrl->getLinkTarget($this, self::CMD_RESET_ORDERING_CLIPBOARD)
165 $lng->txt(
'tst_questions_hints_toolbar_cmd_add_hint'),
181 $this->hintOrderingClipboard
184 $tpl->setContent($ilCtrl->getHtml($toolbar) . $ilCtrl->getHtml(
$table));
199 $hintIds = self::fetchHintIdsParameter();
201 if (!count($hintIds)) {
202 ilUtil::sendFailure($lng->txt(
'tst_question_hints_delete_hints_missing_selection_msg'),
true);
203 $ilCtrl->redirect($this);
206 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
209 $confirmation->setHeaderText($lng->txt(
'tst_question_hints_delete_hints_confirm_header'));
210 $confirmation->setFormAction($ilCtrl->getFormAction($this));
211 $confirmation->setConfirm($lng->txt(
'tst_question_hints_delete_hints_confirm_cmd'), self::CMD_PERFORM_DELETE);
212 $confirmation->setCancel($lng->txt(
'cancel'), self::CMD_SHOW_LIST);
216 foreach ($questionHintList as $questionHint) {
219 if (in_array($questionHint->getId(), $hintIds)) {
220 $confirmation->addItem(
'hint_ids[]', $questionHint->getId(), sprintf(
221 $lng->txt(
'tst_question_hints_delete_hints_confirm_item'),
222 $questionHint->getIndex(),
223 $questionHint->getText()
228 $tpl->setContent($ilCtrl->getHtml($confirmation));
246 $hintIds = self::fetchHintIdsParameter();
248 if (!count($hintIds)) {
249 ilUtil::sendFailure($lng->txt(
'tst_question_hints_delete_hints_missing_selection_msg'),
true);
250 $ilCtrl->redirect($this);
257 foreach ($questionCompleteHintList as $listKey => $questionHint) {
260 if (in_array($questionHint->getId(), $hintIds)) {
261 $questionHint->delete();
263 $questionRemainingHintList->addHint($questionHint);
267 $questionRemainingHintList->reIndex();
271 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
272 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
278 $ilCtrl->redirect($this);
297 $hintIndexes = self::orderHintIndexes(
298 self::fetchHintIndexesParameter()
301 if (!count($hintIndexes)) {
303 $ilCtrl->redirect($this);
310 foreach ($hintIndexes as $hintId => $hintIndex) {
311 if (!$curQuestionHintList->hintExists($hintId)) {
313 $ilCtrl->redirect($this);
316 $questionHint = $curQuestionHintList->getHint($hintId);
318 $newQuestionHintList->addHint($questionHint);
321 $newQuestionHintList->reIndex();
325 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
326 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
332 $ilCtrl->redirect($this);
349 $moveHintIds = self::fetchHintIdsParameter();
352 $moveHintId = current($moveHintIds);
356 $this->hintOrderingClipboard->setStored($moveHintId);
358 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
376 $targetHintIds = self::fetchHintIdsParameter();
379 $targetHintId = current($targetHintIds);
386 foreach ($curQuestionHintList as $questionHint) {
389 if ($questionHint->getId() == $this->hintOrderingClipboard->getStored()) {
393 if ($questionHint->getId() == $targetHintId) {
394 $targetQuestionHint = $questionHint;
398 $newQuestionHintList->addHint($pasteQuestionHint);
401 $newQuestionHintList->addHint($questionHint);
404 $successMsg = sprintf(
405 $lng->txt(
'tst_question_hints_paste_before_success_msg'),
406 $pasteQuestionHint->getIndex(),
407 $targetQuestionHint->getIndex()
410 $newQuestionHintList->reIndex();
412 $this->hintOrderingClipboard->resetStored();
416 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
434 $targetHintIds = self::fetchHintIdsParameter();
437 $targetHintId = current($targetHintIds);
444 foreach ($curQuestionHintList as $questionHint) {
447 if ($questionHint->getId() == $this->hintOrderingClipboard->getStored()) {
451 $newQuestionHintList->
addHint($questionHint);
453 if ($questionHint->getId() == $targetHintId) {
454 $targetQuestionHint = $questionHint;
458 $newQuestionHintList->addHint($pasteQuestionHint);
462 $successMsg = sprintf(
463 $lng->txt(
'tst_question_hints_paste_after_success_msg'),
464 $pasteQuestionHint->getIndex(),
465 $targetQuestionHint->getIndex()
468 $newQuestionHintList->reIndex();
470 $this->hintOrderingClipboard->resetStored();
474 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
488 $this->hintOrderingClipboard->resetStored();
490 ilUtil::sendInfo($lng->txt(
'tst_question_hints_ordering_clipboard_resetted'),
true);
491 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
505 if (!$this->hintOrderingClipboard->hasStored()) {
512 $lng->txt(
'tst_question_hints_item_stored_in_ordering_clipboard'),
513 $questionHint->getIndex()
528 if (!$questionHintList->hintExists($hintId)) {
530 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
546 foreach ($questionHintList as $questionHint) {
549 if ($questionHint->getId() != $this->hintOrderingClipboard->getStored()) {
550 $filteredQuestionHintList->addHint($questionHint);
554 return $filteredQuestionHintList;
570 if (!count($hintIds)) {
571 ilUtil::sendFailure($lng->txt(
'tst_question_hints_cut_hints_missing_selection_msg'),
true);
572 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
573 } elseif (count($hintIds) > 1) {
575 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
591 if (isset(
$_POST[
'hint_ids']) && is_array(
$_POST[
'hint_ids'])) {
592 foreach (
$_POST[
'hint_ids'] as $hintId) {
594 $hintIds[] = (int) $hintId;
597 } elseif (isset(
$_GET[
'hint_id']) && (
int)
$_GET[
'hint_id']) {
598 $hintIds[] = (int) $_GET[
'hint_id'];
613 $hintIndexes =
array();
615 if (isset(
$_POST[
'hint_indexes']) && is_array(
$_POST[
'hint_indexes'])) {
616 foreach (
$_POST[
'hint_indexes'] as $hintId => $hintIndex) {
618 $hintIndexes[(int) $hintId] = $hintIndex;
643 $this->questionGUI->originalSyncForm(
'showHints');
658 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
659 $ilCtrl->setParameterByClass(
'ilasshintpagegui',
'hint_id', $hintId);
660 $linkTarget =
$ilCtrl->getLinkTargetByClass(
'ilAssHintPageGUI',
'',
'',
false, $xmlStyle);
662 $ilCtrl->setParameter($this,
'hintId', $hintId);
663 $linkTarget =
$ilCtrl->getLinkTarget($this, self::CMD_SHOW_HINT,
'',
false, $xmlStyle);
684 if (!isset(
$_GET[
'hintId']) || !(
int)
$_GET[
'hintId']) {
688 $DIC->tabs()->clearTargets();
689 $DIC->tabs()->clearSubTabs();
691 $DIC->tabs()->setBackTarget(
692 $DIC->language()->txt(
'tst_question_hints_back_to_hint_list'),
693 $DIC->ctrl()->getLinkTarget($this, self::CMD_SHOW_LIST)
704 $form->setTableWidth(
'100%');
706 $form->setTitle(sprintf(
707 $lng->txt(
'tst_question_hints_form_header_edit'),
708 $questionHint->getIndex(),
709 $this->questionOBJ->getTitle()
714 $nonEditableHintText =
new ilNonEditableValueGUI(
$lng->txt(
'tst_question_hints_form_label_hint_text'),
'hint_text',
true);
716 $form->addItem($nonEditableHintText);
720 $nonEditableHintPoints =
new ilNonEditableValueGUI(
$lng->txt(
'tst_question_hints_form_label_hint_points'),
'hint_points');
721 $nonEditableHintPoints->
setValue($questionHint->getPoints());
722 $form->addItem($nonEditableHintPoints);
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.
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.
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...
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
if(isset($_POST['submit'])) $form
pasteFromOrderingClipboardAfterCmd()
pastes a hint from ordering clipboard after the selected one
static getContentStylePath($a_style_id, $add_random=true)
get content style path
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 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...
if(empty($password)) $table
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.