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 $ilTabs =
$DIC[
'ilTabs'];
94 $ilHelp =
$DIC[
'ilHelp'];
95 $ilHelp->setScreenIdComponent(
'qpl');
97 require_once
"./Services/Style/Content/classes/class.ilObjStyleSheet.php";
98 $DIC->ui()->mainTemplate()->setCurrentBlock(
"ContentStyle");
100 $DIC->ui()->mainTemplate()->parseCurrentBlock();
102 $cmd =
$ilCtrl->getCmd(self::CMD_SHOW_LIST);
103 $nextClass =
$ilCtrl->getNextClass($this);
105 switch ($nextClass) {
106 case 'ilassquestionhintgui':
112 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php';
117 case 'ilasshintpagegui':
125 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintPageObjectCommandForwarder.php';
127 $forwarder->setPresentationMode($presentationMode);
128 $forwarder->forward();
154 require_once
'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
155 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsTableGUI.php';
162 if ($this->hintOrderingClipboard->hasStored()) {
166 $lng->txt(
'tst_questions_hints_toolbar_cmd_reset_ordering_clipboard'),
167 $ilCtrl->getLinkTarget($this, self::CMD_RESET_ORDERING_CLIPBOARD)
171 $lng->txt(
'tst_questions_hints_toolbar_cmd_add_hint'),
187 $this->hintOrderingClipboard
210 if (!count($hintIds)) {
215 require_once
'Services/Utilities/classes/class.ilConfirmationGUI.php';
218 $confirmation->setHeaderText(
$lng->txt(
'tst_question_hints_delete_hints_confirm_header'));
219 $confirmation->setFormAction(
$ilCtrl->getFormAction($this));
220 $confirmation->setConfirm(
$lng->txt(
'tst_question_hints_delete_hints_confirm_cmd'), self::CMD_PERFORM_DELETE);
221 $confirmation->setCancel(
$lng->txt(
'cancel'), self::CMD_SHOW_LIST);
225 foreach ($questionHintList as $questionHint) {
228 if (in_array($questionHint->getId(), $hintIds)) {
229 $confirmation->addItem(
'hint_ids[]', $questionHint->getId(), sprintf(
230 $lng->txt(
'tst_question_hints_delete_hints_confirm_item'),
231 $questionHint->getIndex(),
232 $questionHint->getText()
260 if (!count($hintIds)) {
269 foreach ($questionCompleteHintList as $listKey => $questionHint) {
272 if (in_array($questionHint->getId(), $hintIds)) {
273 $questionHint->delete();
275 $questionRemainingHintList->addHint($questionHint);
279 $questionRemainingHintList->reIndex();
281 ilUtil::sendSuccess(
$lng->txt(
'tst_question_hints_delete_success_msg'),
true);
283 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
284 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
313 self::fetchHintIndexesParameter()
316 if (!count($hintIndexes)) {
325 foreach ($hintIndexes as $hintId => $hintIndex) {
326 if (!$curQuestionHintList->hintExists($hintId)) {
331 $questionHint = $curQuestionHintList->getHint($hintId);
333 $newQuestionHintList->addHint($questionHint);
336 $newQuestionHintList->reIndex();
338 ilUtil::sendSuccess(
$lng->txt(
'tst_question_hints_save_order_success_msg'),
true);
340 $originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
341 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
369 $moveHintId = current($moveHintIds);
373 $this->hintOrderingClipboard->setStored($moveHintId);
375 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
398 $targetHintId = current($targetHintIds);
405 foreach ($curQuestionHintList as $questionHint) {
408 if ($questionHint->getId() == $this->hintOrderingClipboard->getStored()) {
412 if ($questionHint->getId() == $targetHintId) {
413 $targetQuestionHint = $questionHint;
417 $newQuestionHintList->addHint($pasteQuestionHint);
420 $newQuestionHintList->addHint($questionHint);
423 $successMsg = sprintf(
424 $lng->txt(
'tst_question_hints_paste_before_success_msg'),
425 $pasteQuestionHint->getIndex(),
426 $targetQuestionHint->getIndex()
429 $newQuestionHintList->reIndex();
431 $this->hintOrderingClipboard->resetStored();
433 ilUtil::sendSuccess($successMsg,
true);
435 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
458 $targetHintId = current($targetHintIds);
465 foreach ($curQuestionHintList as $questionHint) {
468 if ($questionHint->getId() == $this->hintOrderingClipboard->getStored()) {
472 $newQuestionHintList->addHint($questionHint);
474 if ($questionHint->getId() == $targetHintId) {
475 $targetQuestionHint = $questionHint;
479 $newQuestionHintList->addHint($pasteQuestionHint);
483 $successMsg = sprintf(
484 $lng->txt(
'tst_question_hints_paste_after_success_msg'),
485 $pasteQuestionHint->getIndex(),
486 $targetQuestionHint->getIndex()
489 $newQuestionHintList->reIndex();
491 $this->hintOrderingClipboard->resetStored();
493 ilUtil::sendSuccess($successMsg,
true);
495 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
511 $this->hintOrderingClipboard->resetStored();
514 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
529 if (!$this->hintOrderingClipboard->hasStored()) {
536 $lng->txt(
'tst_question_hints_item_stored_in_ordering_clipboard'),
537 $questionHint->getIndex()
552 if (!$questionHintList->hintExists($hintId)) {
554 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
570 foreach ($questionHintList as $questionHint) {
573 if ($questionHint->getId() != $this->hintOrderingClipboard->getStored()) {
574 $filteredQuestionHintList->addHint($questionHint);
578 return $filteredQuestionHintList;
596 if (!count($hintIds)) {
598 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
599 } elseif (count($hintIds) > 1) {
601 $ilCtrl->redirect($this, self::CMD_SHOW_LIST);
617 if (isset(
$_POST[
'hint_ids']) && is_array(
$_POST[
'hint_ids'])) {
618 foreach (
$_POST[
'hint_ids'] as $hintId) {
620 $hintIds[] = (int) $hintId;
623 } elseif (isset(
$_GET[
'hint_id']) && (
int)
$_GET[
'hint_id']) {
624 $hintIds[] = (int)
$_GET[
'hint_id'];
639 $hintIndexes = array();
641 if (isset(
$_POST[
'hint_indexes']) && is_array(
$_POST[
'hint_indexes'])) {
642 foreach (
$_POST[
'hint_indexes'] as $hintId => $hintIndex) {
644 $hintIndexes[(int) $hintId] = $hintIndex;
669 $this->questionGUI->originalSyncForm(
'showHints');
684 if ($this->questionOBJ->isAdditionalContentEditingModePageObject()) {
685 $ilCtrl->setParameterByClass(
'ilasshintpagegui',
'hint_id', $hintId);
686 $linkTarget =
$ilCtrl->getLinkTargetByClass(
'ilAssHintPageGUI',
'',
'',
false, $xmlStyle);
688 $ilCtrl->setParameter($this,
'hintId', $hintId);
689 $linkTarget =
$ilCtrl->getLinkTarget($this, self::CMD_SHOW_HINT,
'',
false, $xmlStyle);
710 if (!isset(
$_GET[
'hintId']) || !(
int)
$_GET[
'hintId']) {
714 $DIC->tabs()->clearTargets();
715 $DIC->tabs()->clearSubTabs();
717 $DIC->tabs()->setBackTarget(
718 $DIC->language()->txt(
'tst_question_hints_back_to_hint_list'),
719 $DIC->ctrl()->getLinkTarget($this, self::CMD_SHOW_LIST)
730 $form->setTableWidth(
'100%');
732 $form->setTitle(sprintf(
733 $lng->txt(
'tst_question_hints_form_header_edit'),
734 $questionHint->getIndex(),
735 $this->questionOBJ->getTitle()
740 $nonEditableHintText =
new ilNonEditableValueGUI(
$lng->txt(
'tst_question_hints_form_label_hint_text'),
'hint_text',
true);
742 $form->addItem($nonEditableHintText);
746 $nonEditableHintPoints =
new ilNonEditableValueGUI(
$lng->txt(
'tst_question_hints_form_label_hint_points'),
'hint_points');
747 $nonEditableHintPoints->setValue($questionHint->getPoints());
748 $form->addItem($nonEditableHintPoints);
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, $add_random=true)
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 sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(empty($password)) $table
if(isset($_POST['submit'])) $form