Skip to content

Commit

Permalink
0010758: Feedback-Fragenänderungen nicht im Fragenpool nachvollzogen;…
Browse files Browse the repository at this point in the history
… dto bei Hinweiseditierungen

git-svn-id: http://svn.ilias.de/svn/ilias/branches/Release_4_4_x_branch@57975 21b2c9ec-7c21-0410-8b45-9bfb8ed2bfc5
  • Loading branch information
Nadia Ahmad committed Feb 11, 2015
1 parent 0a13ad7 commit 5d84cb9
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 3 deletions.
38 changes: 37 additions & 1 deletion Modules/TestQuestionPool/classes/class.assQuestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -2770,6 +2770,7 @@ function syncWithOriginal()
$this->syncXHTMLMediaObjectsOfQuestion();

$this->onSyncWithOriginal($original, $this->getId());
$this->syncHints();
}

function createRandomSolution($test_id, $user_id)
Expand Down Expand Up @@ -3345,7 +3346,42 @@ function getQuestionTypeID()
}
return 0;
}


public function syncHints()
{
global $ilDB;

// delete hints of the original
$ilDB->manipulateF("DELETE FROM qpl_hints WHERE qht_question_fi = %s",
array('integer'),
array($this->original_id)
);

// get hints of the actual question
$result = $ilDB->queryF("SELECT * FROM qpl_hints WHERE qht_question_fi = %s",
array('integer'),
array($this->getId())
);

// save hints to the original
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
$next_id = $ilDB->nextId('qpl_hints');
/** @var ilDB $ilDB */
$ilDB->insert('qpl_hints', array(
'qht_hint_id' => array('integer', $next_id),
'qht_question_fi' => array('integer', $this->original_id),
'qht_hint_index' => array('integer', $row["qht_hint_index"]),
'qht_hint_points' => array('integer', $row["qht_hint_points"]),
'qht_hint_text' => array('text', $row["qht_hint_text"]),
)
);
}
}
}

/**
* Collects all text in the question which could contain media objects
* which were created with the Rich Text Editor
Expand Down
5 changes: 5 additions & 0 deletions Modules/TestQuestionPool/classes/class.assQuestionGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -1773,5 +1773,10 @@ protected function writeQuestionGenericPostData()
);
}

public function showHints()
{
global $ilCtrl;

$ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
}
}
12 changes: 10 additions & 2 deletions Modules/TestQuestionPool/classes/class.ilAssQuestionHintGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ilAssQuestionHintGUI extends ilAssQuestionHintAbstractGUI
const CMD_SHOW_FORM = 'showForm';
const CMD_SAVE_FORM = 'saveForm';
const CMD_CANCEL_FORM = 'cancelForm';
const CMD_CONFIRM_FORM = 'confirmForm';

/**
* Execute Command
Expand Down Expand Up @@ -101,7 +102,7 @@ private function showFormCmd(ilPropertyFormGUI $form = null)
*/
private function saveFormCmd()
{
global $ilCtrl, $lng;
global $ilCtrl, $lng, $ilUser;

$form = $this->buildForm();

Expand Down Expand Up @@ -130,8 +131,15 @@ private function saveFormCmd()
$questionHint->setPoints( $form->getInput('hint_points') );

$questionHint->save();

ilUtil::sendSuccess($lng->txt('tst_question_hints_form_saved_msg'), true);

$originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->questionOBJ->original_id, $ilUser->getId()))
{
$ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_CONFIRM_SYNC);
}


if( $hintJustCreated && $this->questionOBJ->isAdditionalContentEditingModePageObject() )
{
Expand Down
24 changes: 24 additions & 0 deletions Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class ilAssQuestionHintsGUI extends ilAssQuestionHintAbstractGUI
const CMD_PASTE_FROM_ORDERING_CLIPBOARD_BEFORE = 'pasteFromOrderingClipboardBefore';
const CMD_PASTE_FROM_ORDERING_CLIPBOARD_AFTER = 'pasteFromOrderingClipboardAfter';
const CMD_RESET_ORDERING_CLIPBOARD = 'resetOrderingClipboard';
const CMD_CONFIRM_SYNC = 'confirmSync';

/**
* object that handles the current ordering clipboard state
Expand Down Expand Up @@ -222,6 +223,15 @@ private function performDeleteCmd()
$questionRemainingHintList->reIndex();

ilUtil::sendSuccess($lng->txt('tst_question_hints_delete_success_msg'), true);

$originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
global $ilUser;
if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->questionOBJ->original_id, $ilUser->getId()))
{
$ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_CONFIRM_SYNC);
}

$ilCtrl->redirect($this);
}

Expand Down Expand Up @@ -265,6 +275,15 @@ private function saveListOrderCmd()
$newQuestionHintList->reIndex();

ilUtil::sendSuccess($lng->txt('tst_question_hints_save_order_success_msg'), true);

$originalexists = $this->questionOBJ->_questionExistsInPool($this->questionOBJ->original_id);
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
global $ilUser;
if ($_GET["calling_test"] && $originalexists && assQuestion::_isWriteable($this->questionOBJ->original_id, $ilUser->getId()))
{
$ilCtrl->redirectByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_CONFIRM_SYNC);
}

$ilCtrl->redirect($this);
}

Expand Down Expand Up @@ -566,4 +585,9 @@ private static function fetchPreparedHintIndexesParameter()

return $hintIndexes;
}

public function confirmSyncCmd()
{
$this->questionGUI->originalSyncForm('showHints');
}
}

0 comments on commit 5d84cb9

Please sign in to comment.