19require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintAbstractGUI.php';
20require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
21require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsOrderingClipboard.php';
72 $this->main_tpl =
$DIC->ui()->mainTemplate();
73 $this->
ctrl = $DIC->ctrl();
74 $this->
lng = $DIC->language();
99 $ilCtrl =
$DIC[
'ilCtrl'];
100 $ilTabs =
$DIC[
'ilTabs'];
103 $ilHelp =
$DIC[
'ilHelp'];
104 $ilHelp->setScreenIdComponent(
'qpl');
106 require_once
"./Services/Style/Content/classes/class.ilObjStyleSheet.php";
107 $DIC->ui()->mainTemplate()->setCurrentBlock(
"ContentStyle");
109 $DIC->ui()->mainTemplate()->parseCurrentBlock();
111 $cmd = $ilCtrl->getCmd(self::CMD_SHOW_LIST);
112 $nextClass = $ilCtrl->getNextClass($this);
114 switch ($nextClass) {
115 case 'ilassquestionhintgui':
121 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
123 $ilCtrl->forwardCommand($gui);
126 case 'ilasshintpagegui':
134 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintPageObjectCommandForwarder.php';
136 $forwarder->setPresentationMode($presentationMode);
137 $forwarder->forward();
141 $this->
tabs->setTabActive(
'tst_question_hints_tab');
157 $ilCtrl =
$DIC[
'ilCtrl'];
163 require_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
164 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
171 if ($this->hintOrderingClipboard->hasStored()) {
175 $lng->
txt(
'tst_questions_hints_toolbar_cmd_reset_ordering_clipboard'),
176 $ilCtrl->getLinkTarget($this, self::CMD_RESET_ORDERING_CLIPBOARD)
180 $lng->
txt(
'tst_questions_hints_toolbar_cmd_add_hint'),
196 $this->hintOrderingClipboard
199 $tpl->setContent($ilCtrl->getHtml($toolbar) . $ilCtrl->getHtml($table));
213 $ilCtrl =
$DIC[
'ilCtrl'];
219 if (!count($hintIds)) {
220 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'tst_question_hints_delete_hints_missing_selection_msg'),
true);
221 $ilCtrl->redirect($this);
226 $confirmation->setHeaderText(
$lng->
txt(
'tst_question_hints_delete_hints_confirm_header'));
227 $confirmation->setFormAction($ilCtrl->getFormAction($this));
228 $confirmation->setConfirm(
$lng->
txt(
'tst_question_hints_delete_hints_confirm_cmd'), self::CMD_PERFORM_DELETE);
229 $confirmation->setCancel(
$lng->
txt(
'cancel'), self::CMD_SHOW_LIST);
233 foreach ($questionHintList as $questionHint) {
236 if (in_array($questionHint->getId(), $hintIds)) {
237 $confirmation->addItem(
'hint_ids[]', $questionHint->getId(), sprintf(
238 $lng->
txt(
'tst_question_hints_delete_hints_confirm_item'),
239 $questionHint->getIndex(),
240 $questionHint->getText()
245 $tpl->setContent($ilCtrl->getHtml($confirmation));
262 $ilCtrl =
$DIC[
'ilCtrl'];
268 if (!count($hintIds)) {
269 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'tst_question_hints_delete_hints_missing_selection_msg'),
true);
270 $ilCtrl->redirect($this);
277 foreach ($questionCompleteHintList as $listKey => $questionHint) {
280 if (in_array($questionHint->getId(), $hintIds)) {
281 $questionHint->delete();
283 $questionRemainingHintList->addHint($questionHint);
287 $questionRemainingHintList->reIndex();
289 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
'tst_question_hints_delete_success_msg'),
true);
291 $originalexists = $this->questionOBJ->_questionExistsInPool((
int) $this->questionOBJ->getOriginalId());
292 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
299 $ilCtrl->redirect($this);
317 $ilCtrl =
$DIC[
'ilCtrl'];
321 self::fetchHintIndexesParameter()
324 if (!count($hintIndexes)) {
325 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'tst_question_hints_save_order_unkown_failure_msg'),
true);
326 $ilCtrl->redirect($this);
333 foreach ($hintIndexes as $hintId => $hintIndex) {
334 if (!$curQuestionHintList->hintExists($hintId)) {
335 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'tst_question_hints_save_order_unkown_failure_msg'),
true);
336 $ilCtrl->redirect($this);
339 $questionHint = $curQuestionHintList->getHint($hintId);
341 $newQuestionHintList->addHint($questionHint);
344 $newQuestionHintList->reIndex();
346 $this->main_tpl->setOnScreenMessage(
'success',
$lng->
txt(
'tst_question_hints_save_order_success_msg'),
true);
348 $originalexists = $this->questionOBJ->_questionExistsInPool((
int) $this->questionOBJ->getOriginalId());
349 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
356 $ilCtrl->redirect($this);
372 $ilCtrl =
$DIC[
'ilCtrl'];
377 $moveHintId = current($moveHintIds);
381 $this->hintOrderingClipboard->setStored($moveHintId);
383 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
400 $ilCtrl =
$DIC[
'ilCtrl'];
406 $targetHintId = current($targetHintIds);
413 foreach ($curQuestionHintList as $questionHint) {
416 if ($questionHint->getId() == $this->hintOrderingClipboard->getStored()) {
420 if ($questionHint->getId() == $targetHintId) {
421 $targetQuestionHint = $questionHint;
425 $newQuestionHintList->addHint($pasteQuestionHint);
428 $newQuestionHintList->addHint($questionHint);
431 $successMsg = sprintf(
432 $lng->
txt(
'tst_question_hints_paste_before_success_msg'),
433 $pasteQuestionHint->getIndex(),
434 $targetQuestionHint->getIndex()
437 $newQuestionHintList->reIndex();
439 $this->hintOrderingClipboard->resetStored();
441 $this->main_tpl->setOnScreenMessage(
'success', $successMsg,
true);
443 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
460 $ilCtrl =
$DIC[
'ilCtrl'];
466 $targetHintId = current($targetHintIds);
473 foreach ($curQuestionHintList as $questionHint) {
476 if ($questionHint->getId() == $this->hintOrderingClipboard->getStored()) {
480 $newQuestionHintList->addHint($questionHint);
482 if ($questionHint->getId() == $targetHintId) {
483 $targetQuestionHint = $questionHint;
487 $newQuestionHintList->addHint($pasteQuestionHint);
491 $successMsg = sprintf(
492 $lng->
txt(
'tst_question_hints_paste_after_success_msg'),
493 $pasteQuestionHint->getIndex(),
494 $targetQuestionHint->getIndex()
497 $newQuestionHintList->reIndex();
499 $this->hintOrderingClipboard->resetStored();
501 $this->main_tpl->setOnScreenMessage(
'success', $successMsg,
true);
503 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
516 $ilCtrl =
$DIC[
'ilCtrl'];
519 $this->hintOrderingClipboard->resetStored();
521 $this->main_tpl->setOnScreenMessage(
'info',
$lng->
txt(
'tst_question_hints_ordering_clipboard_resetted'),
true);
522 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
537 if (!$this->hintOrderingClipboard->hasStored()) {
543 $this->main_tpl->setOnScreenMessage(
'info', sprintf(
544 $lng->
txt(
'tst_question_hints_item_stored_in_ordering_clipboard'),
545 $questionHint->getIndex()
560 if (!$questionHintList->hintExists($hintId)) {
561 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'tst_question_hints_invalid_hint_id'),
true);
562 $this->
ctrl->redirect($this, self::CMD_SHOW_LIST);
578 foreach ($questionHintList as $questionHint) {
581 if ($questionHint->getId() != $this->hintOrderingClipboard->getStored()) {
582 $filteredQuestionHintList->addHint($questionHint);
586 return $filteredQuestionHintList;
601 $ilCtrl =
$DIC[
'ilCtrl'];
604 if (!count($hintIds)) {
605 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'tst_question_hints_cut_hints_missing_selection_msg'),
true);
606 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
607 } elseif (count($hintIds) > 1) {
608 $this->main_tpl->setOnScreenMessage(
'failure',
$lng->
txt(
'tst_question_hints_cut_hints_single_selection_msg'),
true);
609 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
624 $request =
$DIC->testQuestionPool()->internal()->request();
627 if (isset($_POST[
'hint_ids']) && is_array($_POST[
'hint_ids'])) {
628 foreach ($_POST[
'hint_ids'] as $hintId) {
630 $hintIds[] = (
int) $hintId;
649 $hintIndexes = array();
651 if (isset($_POST[
'hint_indexes']) && is_array($_POST[
'hint_indexes'])) {
652 foreach ($_POST[
'hint_indexes'] as $hintId => $hintIndex) {
654 $hintIndexes[(
int) $hintId] = $hintIndex;
679 $this->questionGUI->originalSyncForm(
'showHints');
692 $ilCtrl =
$DIC[
'ilCtrl'];
694 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
695 $ilCtrl->setParameterByClass(
'ilasshintpagegui',
'hint_id', $hintId);
696 $linkTarget = $ilCtrl->getLinkTargetByClass(
'ilAssHintPageGUI',
'',
'',
false, $xmlStyle);
698 $ilCtrl->setParameter($this,
'hintId', $hintId);
699 $linkTarget = $ilCtrl->getLinkTarget($this, self::CMD_SHOW_HINT,
'',
false, $xmlStyle);
716 $ilCtrl =
$DIC[
'ilCtrl'];
720 if (!$this->request->isset(
'hintId') || !(
int) $this->request->raw(
'hintId')) {
724 $DIC->tabs()->clearTargets();
725 $DIC->tabs()->clearSubTabs();
727 $DIC->tabs()->setBackTarget(
728 $DIC->language()->txt(
'tst_question_hints_back_to_hint_list'),
729 $DIC->ctrl()->getLinkTarget($this, self::CMD_SHOW_LIST)
738 $form->setFormAction($ilCtrl->getFormAction($this));
740 $form->setTableWidth(
'100%');
742 $form->setTitle(sprintf(
743 $lng->
txt(
'tst_question_hints_form_header_edit'),
744 $questionHint->getIndex(),
745 $this->questionOBJ->getTitleForHTMLOutput()
752 $form->addItem($nonEditableHintText);
757 $nonEditableHintPoints->setValue($questionHint->getPoints());
758 $form->addItem($nonEditableHintPoints);
760 $tpl->setContent($form->getHTML());
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _isWriteable(int $question_id, int $user_id)
assQuestionGUI $questionGUI
ILIAS TestQuestionPool InternalRequestService $request
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
ilGlobalTemplateInterface $main_tpl
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
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilCtrl provides processing control methods.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc