ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestNewScoringGUI Class Reference

NewScoring class for tests. More...

+ Inheritance diagram for ilTestNewScoringGUI:
+ Collaboration diagram for ilTestNewScoringGUI:

Public Member Functions

 ilTestNewScoringGUI ($a_object)
 ilTestNewScoringGUI constructor
executeCommand ()
 execute command
 scoreQuestion ()
 question scoring
 getQuestionStat ($qid, $save=FALSE, $qnum="")
 sync ()
 Confirm synchronisation with original questionpool.
 cancelSync ()
 Cancel dialog to confirm synchronisation.
- Public Member Functions inherited from ilTestServiceGUI
 ilTestServiceGUI ($a_object)
 ilTestScoringGUI constructor
 getCommand ($cmd)
 Retrieves the ilCtrl command.
 getPassOverview ($active_id, $targetclass="", $targetcommand="", $short=FALSE, $hide_details=FALSE)
 Returns the pass overview for a given active ID.
 getFinalStatement ($active_id)
 Returns the final statement for a user.
 getPassListOfAnswers (&$result_array, $active_id, $pass, $show_solutions=FALSE, $only_answered_questions=FALSE, $show_question_only=FALSE, $show_reached_points=FALSE, $compare_solutions=FALSE)
 Returns the list of answers of a users test pass.
 getPassListOfAnswersWithScoring (&$result_array, $active_id, $pass, $show_solutions=FALSE)
 Returns the list of answers of a users test pass and offers a scoring option.
 getPassDetailsOverview ($result_array, $active_id, $pass, $targetclass="", $targetcommandsort="", $targetcommanddetails="", $standard_header=TRUE)
 Returns the pass details overview for a given active ID and pass.
 getResultsSignature ()
 Returns HTML code for a signature field.
 getResultsUserdata ($active_id, $overwrite_anonymity=FALSE)
 Returns the user data for a test results output.
 getCorrectSolutionOutput ($question_id, $active_id, $pass)
 Returns an output of the solution to an answer compared to the correct solution.
 getResultsOfUserOutput ($active_id, $pass, $show_pass_details=TRUE, $show_answers=TRUE, $show_question_only=FALSE, $show_reached_points=FALSE)
 Output of the pass overview for a test called by a test participant.
 getResultsHeadUserAndPass ($active_id, $pass)
 Returns the user and pass data for a test results output.
 getQuestionResultForTestUsers ($question_id, $test_id)
 Creates a HTML representation for the results of a given question in a test.

Additional Inherited Members

- Data Fields inherited from ilTestServiceGUI
 $object
 $lng
 $tpl
 $ctrl
 $ilias
 $tree
 $ref_id

Detailed Description

NewScoring class for tests.

Author
Dimitrina Vissoultcheva dviss.nosp@m.@uni.nosp@m.-main.nosp@m.z.de
Version
$Id$

Definition at line 36 of file class.ilTestNewScoringGUI.php.

Member Function Documentation

ilTestNewScoringGUI::cancelSync ( )

Cancel dialog to confirm synchronisation.

Definition at line 851 of file class.ilTestNewScoringGUI.php.

References $_GET.

{
$this->ctrl->setParameter($this, "q_id", $_GET["q_id"]);
$this->ctrl->setParameter($this, "sync", "no");
$this->ctrl->redirect($this, "scoreQuestion");
}
& ilTestNewScoringGUI::executeCommand ( )

execute command

Reimplemented from ilTestServiceGUI.

Definition at line 59 of file class.ilTestNewScoringGUI.php.

References $cmd, $ret, and ilTestServiceGUI\getCommand().

{
$cmd = $this->ctrl->getCmd();
$next_class = $this->ctrl->getNextClass($this);
if (strlen($cmd) == 0)
{
$this->ctrl->redirect($this, "scoreQuestion");
}
$cmd = $this->getCommand($cmd);
switch($next_class)
{
default:
$ret =& $this->$cmd();
break;
}
return $ret;
}

+ Here is the call graph for this function:

ilTestNewScoringGUI::getQuestionStat (   $qid,
  $save = FALSE,
  $qnum = "" 
)

Definition at line 323 of file class.ilTestNewScoringGUI.php.

References $filename, $ilDB, $pos, $title, assQuestion\_getQuestionType(), CLOZE_NUMERIC, CLOZE_SELECT, CLOZE_TEXT, ilTestNewScoring\getSolutionStat(), ilTestNewScoring\getUserAnswers(), and OQ_PICTURES.

Referenced by scoreQuestion().

{
global $ilUser, $ilDB;
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
include_once "./Modules/Test/classes/class.ilTestNewScoring.php";
$obj_scoring = new ilTestNewScoring($this->object);
$questionId = $qid;
// show QuestionText
$question = $this->object->createQuestionGUI("", $questionId);
$qtype = assQuestion::_getQuestionType($questionId);
$qText = $question->getSolutionOutput("", NULL, FALSE, TRUE, FALSE);
$qText = preg_replace("/<pre>/", "", $qText);
$qText = preg_replace("/<\/pre>/", "", $qText);
$template = new ilTemplate("tpl.il_as_tst_stat_question.html", TRUE, TRUE, "Modules/Test/newscoring");
if (!$save)
{
$qnum .= ". ";
}
$title = $qnum. $question->object->getTitle(). " - ". $this->lng->txt($qtype);
$template->setCurrentBlock("qtable");
$template->setVariable("QUESTION_HEADING", $title);
$template->setVariable("TXT_QUESTION_PREVIEW", $this->lng->txt("regrading_question_preview"));
$template->setVariable("TXT_CORRECT_ANSWERS_AND_POINTS", $this->lng->txt("regrading_correct_answers_and_points"));
$template->setVariable("TXT_STATS_USER_ANSWERS", $this->lng->txt("regrading_stats_user_answers"));
$template->setVariable("QUESTION_TEXT", $qText);
$template->setVariable("QUESTION_ID", $questionId);
switch ($qtype)
{
case "assClozeTest":
$template->setCurrentBlock("identical_scoring");
$identical_scoring = $question->object->getIdenticalScoring();
if ($identical_scoring) $template->setVariable("CHECKED_IDENT_SCORING", " checked=\"checked\"");
$template->setVariable("TEXT_IDENT_SCORING", $this->lng->txt("identical_scoring"));
// Add textgap rating options
$textgap_options = array(
array("ci", $this->lng->txt("cloze_textgap_case_insensitive")),
array("cs", $this->lng->txt("cloze_textgap_case_sensitive")),
array("l1", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1")),
array("l2", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2")),
array("l3", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3")),
array("l4", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4")),
array("l5", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5"))
);
$textgap_rating = $question->object->getTextgapRating();
$template->setVariable("TEXTGAP_RATING", "Text-Bewertung");
foreach ($textgap_options as $textgap_option)
{
$template->setCurrentBlock("textgap_rating");
$template->setVariable("TEXTGAP_VALUE", $textgap_option[0]);
$template->setVariable("TEXTGAP_TEXT", $textgap_option[1]);
if (strcmp($textgap_rating, $textgap_option[0]) == 0)
{
$template->setVariable("SELECTED_TEXTGAP_VALUE", " selected=\"selected\"");
}
$template->parseCurrentBlock();
}
$template->ParseCurrentBlock();
$gapTextArray=array();
$clozeText = $question->object->getClozeText();
$gapTextArray = split ("/gap", $clozeText);
$textgap = 0;
$cnt1=0;
$cnt2=0;
foreach ($question->object->gaps as $gap_id => $value)
{
$origItemCount = 0;
$gap_text = strstr($gapTextArray[$gap_id], "[gap]");
while($pos = strpos($gap_text, ","))
{
$origItemCount++;
$gap_text = strstr(",", $gap_text);
}
$answerarray = array();
for ($order = 0; $order < $question->object->gaps[$gap_id]->getItemCount(); $order++)
{
// correct answers
$answer = $question->object->gaps[$gap_id]->getItem($order);
// numeric-gap
if ($question->object->gaps[$gap_id]->getType() == CLOZE_NUMERIC)
{
$template->setCurrentBlock("correct_ranges");
$template->setVariable("LOWNAME",$gap_id."_1");
$template->setVariable("UPPERNAME", $gap_id."_2");
$template->setVariable("TEXT_RANGE_LOWER_LIMIT", ($gap_id+1).".2. ".$this->lng->txt("range_lower_limit"));
$template->setVariable("VALUE_LOWER_LIMIT", " value=\"" . $answer->getLowerBound() . "\"");
$template->setVariable("TEXT_RANGE_UPPER_LIMIT", ($gap_id+1).".3. ".$this->lng->txt("range_upper_limit"));
$template->setVariable("VALUE_UPPER_LIMIT", " value=\"" . $answer->getUpperBound() . "\"");
$template->setVariable("VALUENAME", $gap_id."_3"); // Wert angeben
$template->setVariable("TEXT_VALUE", ($gap_id+1).".1. ".$this->lng->txt("value"));
$template->setVariable("VALUE_VALUE", " value=\"" . $answer->getAnswertext() . "\"");
$template->setVariable("POINTNAME",$gap_id."_0");
$template->setVariable("TEXT_POINTS", ($gap_id+1).".4. ". $this->lng->txt("points"));
$template->setVariable("VALUE_POINTS", "\"". " value=\"" . $answer->getPoints() . "\"");
$template->parseCurrentBlock();
}
else // textgap
{
$template->setCurrentBlock("correct_cloze");
$template->setVariable("CORRECT_ANSWER", ($gap_id+1). ".". ($order+1). ".". $answer->getAnswertext());
$template->setVariable("POINTS", $answer->getPoints());
$template->setVariable("FIELDNAME", $gap_id."_".$order);
if (($question->object->gaps[$gap_id]->getType() == CLOZE_TEXT) && ($order > $origItemCount))
{
$template->setVariable("PARAMS", ($gap_id."_".$order));
$template->setVariable("DELETE", "0");
$template->setVariable("COUNTER", $cnt1++);
$textgap = 1;
}
$template->ParseCurrentBlock();
array_push($answerarray, $answer->getAnswertext()."_".$answer->getPoints());
}
}
//Statistik of UserAnswers (from temp_solutions!!!)
$values = array();
$values = ilTestNewScoring::getSolutionStat($questionId, $gap_id);
foreach ($values as $value2)
{
$template->setCurrentBlock("answer_stat");
$userans = $value2;
$stat = ilTestNewScoring::getUserAnswers($questionId, $userans, $gap_id);
$template->setVariable("STUD", ($gap_id+1). ". (". $stat["count"]. ") ". $userans);
$solutionId = $stat["val"];
// SelectGap
if ($question->object->gaps[$gap_id]->getType() == CLOZE_SELECT)
{
for ($order = 0; $order < $question->object->gaps[$gap_id]->getItemCount(); $order++)
{
$answer = $question->object->gaps[$gap_id]->getItem($order);
if ($answer->getOrder() == $userans)
{
$userans_val = $answer->getAnswertext();
$template->setVariable("STUD", ($gap_id+1). ".". ($order+1). ". (". $stat["count"]. ") ". $userans_val);
}
}
}
// TextGap
if ($userans AND ($question->object->gaps[$gap_id]->getType() == CLOZE_TEXT))
{
// Check with Levenshtein etc, $answerarray contains the correct answers (answerText_Points)
$OK = $obj_scoring->checkLevenstein($question, $answerarray, $userans);
if (!$OK )
{
$maxItem = $question->object->gaps[$gap_id]->getItemCount();
$template->setVariable("PARAMS", ($gap_id."_".$maxItem. "_".$solutionId));
$template->setVariable("ADD", "0");
$template->setVariable("COUNTER", $cnt2++);
}
$textgap = 1;
}
$template->ParseCurrentBlock();
} // end of User-Statistik
}
break;
case "assMatchingQuestion":
$order = 1;
foreach ($question->object->matchingpairs as $key => $value)
{
$template->setCurrentBlock("correct_matching");
$question->object->loadFromDb($questionId);
$matching_obj = $question->object->matchingpairs[$key];
$template->setVariable("ORDER", $order);
$template->setVariable("POINTS", $matching_obj->__get("points"));
$definition = $matching_obj->__get("definition");
$term = $matching_obj->__get("term");
if (strlen($definition->text))
{
$template->setVariable("DEFINITION", $definition->text);
}
elseif (strlen($definition->picture))
{
$def_thumb = $question->object->getImagePathWeb(). $question->object->getThumbPrefix() . $definition->picture;
$template->setVariable("DEFINITION", "<img src=\"$def_thumb\" />");
}
if (strlen($term->text))
{
$template->setVariable("TERM", $term->text);
}
elseif (strlen($term->picture))
{
$term_thumb = $question->object->getImagePathWeb(). $question->object->getThumbPrefix() . $term->picture;
$template->setVariable("TERM", "<img src=\"$term_thumb\" />");
}
$template->setVariable("TERMID", "0_". $term->identifier);
$template->ParseCurrentBlock();
// Statistik der Benutzer-Antworten
if (strlen($definition->text))
{
$def = $definition->text;
}
elseif (strlen($definition->picture))
{
$def = $definition->picture;
}
$temp = $obj_scoring->getSolutionStat($questionId, $def);
$order2 = 0;
foreach ($temp as $val1)
{
if ($order2 == 0)
{
$value2 = $val1;
$order2++;
}
else
{
$stat = $obj_scoring->getUserAnswers($questionId, $val1, $value2);
$template->setCurrentBlock("answer_stat");
if (!strlen($definition->text) && strlen($definition->picture))
{
$def = "<img src=\"$def_thumb\" />";
}
if (strlen($term->text))
{
$terms = $stat["val"];
}
elseif (strlen($term->picture))
{
$terms = "<img src=\"$term_thumb\" />";
}
if ($terms)
{
$template->setVariable("STUD", $order. ".". $order2. ". (". $stat["count"]. ") ". $def. "-". $terms);
}
$template->ParseCurrentBlock();
$order2++;
}
}
$order++;
}
break;
case "assOrderingQuestion":
case "assOrderingHorizontal":
// correct answer
$template->setCurrentBlock("correct_ordering");
$itemPoints = $obj_scoring->loadOrderingItemPoints($questionId);
if ($qtype == "assOrderingHorizontal")
{
$template->setVariable("CORRECT_HORIZONTAL", $question->object->getOrderText());
}
else
foreach ($question->object->answers as $idx => $answer)
{
$template->setCurrentBlock("correct_ordering_row");
if ($question->object->getOrderingType() == OQ_PICTURES)
{
$filename = "thumb.".$answer->getAnswertext();
$imagepath = $question->object->getImagePathWeb() .$filename;
$template->setVariable("CORRECT_ANSWER", "<img src=\"$imagepath\" />");
}
else
{
$template->setVariable("CORRECT_ANSWER", $answer->getAnswertext());
}
$template->setVariable("POSITION", ($idx+1));
$template->setVariable("POINTS_TEXTNAME", "0_". ($idx+1));
if (count($itemPoints))
{
$template->setVariable("POINTS_VALUE", $itemPoints[$idx]);
}
$template->ParseCurrentBlock();
}
$template->setCurrentBlock("max_points");
$maxpoints = $question->object->getMaximumPoints();
$template->setVariable("POINTS_TEXTNAME", ("0_0"));
$template->setVariable("MAX_POINTS", $maxpoints);
$template->ParseCurrentBlock();
if ($qtype == "assOrderingQuestion")
{
foreach ($question->object->answers as $idx => $answer)
{
// Statistik der Benutzer-Antworten
$value1 = $idx;
$temp = $obj_scoring->getSolutionStat($questionId, $value1);
$template->setCurrentBlock("answer_stat");
$cnt = 0;
foreach ($temp as $val2)
{
$stat = $obj_scoring->getUserAnswers($questionId, $value1, $val2);
$template->setCurrentBlock("answer_stat");
if ($question->object->getOrderingType() == OQ_PICTURES)
{
$filename = "thumb.".$answer->getAnswertext();
$imagepath = $question->object->getImagePathWeb(). $filename;
$template->setVariable("STUD", ($value1+1). ". (". $stat["count"]. ") ". $val2. " - ". "<img src=\"$imagepath\" />");
}
else
{
$template->setVariable("STUD", ($value1+1). ". (". $stat["count"]. ") ". $val2. " - ". $answer->getAnswertext());
}
$template->ParseCurrentBlock();
}
}
}
else
{
$temp = $obj_scoring->getSolutionStat($questionId);
$template->setCurrentBlock("answer_stat");
$template->ParseCurrentBlock();
$cnt = 1;
foreach ($temp as $val2)
{
$stat = $obj_scoring->getUserAnswers($questionId, 0, $val2);
$template->setCurrentBlock("answer_stat");
$val = preg_replace('/{::}/', ' ', $val2);
$template->setVariable("STUD", $cnt++. ". (". $stat["count"]. ") ". $val);
$template->ParseCurrentBlock();
}
}
break;
case "assMultipleChoice":
case "assSingleChoice":
// korrekte Antworten
foreach ($question->object->answers as $answer)
{
if ($qtype == "assMultipleChoice")
{
$template->setCurrentBlock("correct_mult");
$template->setVariable("POINTS-UNCHECKED", $answer->getPointsUnchecked());
$template->setVariable("FIELDNAME_U", "1_".$answer->getOrder());
}
else
{
$template->setCurrentBlock("correct_single");
}
$template->setVariable("CORRECT_ANSWER", ($answer->getOrder()+1). ". ". $answer->getAnswertext());
$template->setVariable("POINTS", $answer->getPoints());
$template->setVariable("FIELDNAME", "0_".$answer->getOrder());
$template->ParseCurrentBlock();
// Statistik der Benutzer-Antworten
$value1 = $answer->getOrder();
$temp = $obj_scoring->getSolutionStat($questionId, $value1);
$template->setCurrentBlock("answer_stat");
$template->setVariable("STUD", ($value1+1). ". (". count($temp). ") ". $answer->getAnswertext());
$template->ParseCurrentBlock();
}
break;
case "assNumeric":
// korrekte Antworten
$template->setCurrentBlock("correct_ranges");
$template->setVariable("TEXT_POINTS", $this->lng->txt("points"));
$template->setVariable("VALUE_POINTS", "\"". " value=\"" . $question->object->getPoints() . "\"");
$template->setVariable("POINTNAME","0_0");
$template->setVariable("LOWNAME","1_0");
$template->setVariable("UPPERNAME", "2_0");
$template->setVariable("TEXT_RANGE_LOWER_LIMIT", $this->lng->txt("range_lower_limit"));
$template->setVariable("VALUE_LOWER_LIMIT", " value=\"" . $question->object->getLowerLimit() . "\"");
$template->setVariable("TEXT_RANGE_UPPER_LIMIT", $this->lng->txt("range_upper_limit"));
$template->setVariable("VALUE_UPPER_LIMIT", " value=\"" . $question->object->getUpperLimit() . "\"");
$template->parseCurrentBlock();
// Statistik der Benutzer-Antworten
$temp = $obj_scoring->getSolutionStat($questionId);
$counter = 1;
foreach ($temp as $value1)
{
$stat = $obj_scoring->getUserAnswers($questionId, $value1);
$template->setCurrentBlock("answer_stat");
$template->setVariable("STUD", $counter++. ". (". $stat["count"]. ") ". $value1);
$template->ParseCurrentBlock();
}
break;
case "assTextSubset":
// korrekte Antworten
// "allanswers" (new Question-Parameter) needs to be initialized
if (!$question->object->allanswers)
{
$question->object->setAllAnswers(count($question->object->answers));
$question->object->saveToDb();
}
$cnt = 0;
foreach ($question->object->answers as $answer)
{
$template->setCurrentBlock("correct_subset");
$template->setVariable("CORRECT_ANSWER", ($answer->getOrder()+1). ". ". $answer->getAnswertext());
$template->setVariable("POINTS", $answer->getPoints());
$template->setVariable("FIELDNAME", "0_".$answer->getOrder());
if (($answer->getOrder()+1) > $question->object->allanswers)
{
$template->setVariable("PARAMS", ("0_".$answer->getOrder()));
$template->setVariable("DELETE", "0");
$template->setVariable("COUNTER", $cnt++);
}
$template->ParseCurrentBlock();
}
// Add textgap rating options
$text_options = array(
array("ci", $this->lng->txt("cloze_textgap_case_insensitive")),
array("cs", $this->lng->txt("cloze_textgap_case_sensitive")),
array("l1", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "1")),
array("l2", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "2")),
array("l3", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "3")),
array("l4", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "4")),
array("l5", sprintf($this->lng->txt("cloze_textgap_levenshtein_of"), "5"))
);
$text_rating = $question->object->getTextRating();
foreach ($text_options as $text_option)
{
$template->setCurrentBlock("text_rating");
$template->setVariable("TEXT_VALUE", $text_option[0]);
$template->setVariable("TEXT_TEXT", $text_option[1]);
if (strcmp($text_rating, $text_option[0]) == 0)
{
$template->setVariable("SELECTED_TEXT_VALUE", " selected=\"selected\"");
}
$template->parseCurrentBlock();
}
// Statistik der Benutzer-Antworten
$temp = $obj_scoring->getSolutionStat($questionId);
$cnt = 0;
foreach ($temp as $value1)
{
if (!$value1)
continue;
$stat = $obj_scoring->getUserAnswers($questionId, $value1);
// Check userAnswer with Levenshtein
$template->setCurrentBlock("answer_stat");
$available_answers =& $question->object->getAvailableAnswers();
$index = $question->object->isAnswerCorrect($available_answers, $value1);
if ($index !== FALSE)
{
$template->setVariable("STUD", ($index+1). ". (". $stat["count"]. ") ". $value1);
}
else
{
$template->setVariable("STUD", "0. (". $stat["count"]. ") ". $value1);
$template->setVariable("PARAMS", ("0_". $question->object->getAnswerCount()."_".$stat["val"]));
$template->setVariable("ADD", "0");
$template->setVariable("COUNTER", $cnt++);
}
$template->ParseCurrentBlock();
}
break;
} // end of case
$template->ParseCurrentBlock();
if ($save)
{
$template->setVariable("SAVEPOINTS", $this->lng->txt("regrading_save"));
if ($textgap || ($qtype == "assTextSubset"))
{
$template->setVariable("COLSPAN", 1);
$template->setVariable("DEL_ANSWER", $this->lng->txt("regrading_remove_answer"));
$template->setVariable("ADD_ANSWER", $this->lng->txt("regrading_add_answer"));
}
else
{
$template->setVariable("COLSPAN", 3);
}
}
return $template->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestNewScoringGUI::ilTestNewScoringGUI (   $a_object)

ilTestNewScoringGUI constructor

The constructor takes the test object reference as parameter

Parameters
object$a_objectAssociated ilObjTest class public

Definition at line 48 of file class.ilTestNewScoringGUI.php.

References ilTestServiceGUI\ilTestServiceGUI().

{
$this->ctrl->saveParameter($this, "active_id");
$this->ctrl->saveParameter($this, "userfilter");
$this->ctrl->saveParameter($this, "pass");
}

+ Here is the call graph for this function:

ilTestNewScoringGUI::scoreQuestion ( )

question scoring

Definition at line 82 of file class.ilTestNewScoringGUI.php.

References $_GET, $_POST, $_REQUEST, $command, $data, $ilDB, $ilErr, $out, ilTestServiceGUI\$tpl, assQuestion\_getQuestionType(), assQuestion\_isWriteable(), getQuestionStat(), and ilUtil\sendInfo().

{
global $ilUser, $ilDB, $ilErr, $tpl;
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
include_once "./Modules/Test/classes/class.ilTestNewScoring.php";
$qtypes = array();
array_push($qtypes, "assClozeTest", "assMultipleChoice", "assNumeric", "assTextSubset", "assSingleChoice", "assMatchingQuestion", "assOrderingQuestion", "assOrderingHorizontal");
$obj_scoring = new ilTestNewScoring($this->object);
$questionId = $_POST["id"];
$command = $_GET["command"];
if ($_REQUEST["export"])
{
$testquestions =& $this->object->getTestQuestions();
$qnum = 1;
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_stat_questions.html", "Modules/Test/newscoring");
foreach ($testquestions as $question)
{
$obj_scoring->loadTempTable($question["question_id"]);
$qtype = assQuestion::_getQuestionType($question["question_id"]);
if (in_array($qtype, $qtypes))
{
$output .= $this->getQuestionStat($question["question_id"], FALSE, $qnum++);
}
}
$this->tpl->setVariable("QUESTION_EXPORT", $output);
}
else
{
if ($_GET["sync"]) // original-synchronisation
{
if ($_GET["sync"] == "yes")
ilUtil::sendInfo("Die Frage wurde im Test und im Fragenpool gespeichert und alle Testteilnehmer wurden neu bewertet.");
elseif ($_GET["sync"] == "no")
ilUtil::sendInfo("Die Frage wurde im Test gespeichert und alle Testteilnehmer wurden neu bewertet.");
$command = "list";
}
// Question save and participants score
$save_qst = 2;
if ($_REQUEST["score"])
{
$obj_scoring->saveQuestionAndUserResults($_POST);
$question = $this->object->createQuestionGUI("", $_POST["id"]);
if ($qtype == "assOrderingQuestion")
{
$save_qst = $obj_scoring->saveOrderingItemPoints($_POST);
}
$originalexists = $question->object->_questionExists($question->object->original_id);
if ($originalexists && assQuestion::_isWriteable($question->object->original_id, $ilUser->getId()))
{
if (($qtype == "assOrderingQuestion") && !$save_qst)
{
$command = "list";
}
else
{
$this->ctrl->setParameter($this, "q_id", $_POST["id"]);
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_qpl_sync_original.html", "Modules/TestQuestionPool");
$this->tpl->setCurrentBlock("adm_content");
$this->tpl->setVariable("BUTTON_YES", $this->lng->txt("yes"));
$this->tpl->setVariable("BUTTON_NO", $this->lng->txt("no"));
$this->tpl->setVariable("FORM_ACTION", $this->ctrl->getFormAction($this));
$this->tpl->setVariable("TEXT_SYNC", $this->lng->txt("confirm_sync_questions"));
$this->tpl->parseCurrentBlock();
}
}
elseif($save_qst)
{
ilUtil::sendInfo("Die Frage wurde im Test gespeichert und alle Testteilnehmer wurden neu bewertet.");
}
$this->ctrl->setParameter($this, "q_id", $qid);
$this->ctrl->setParameter($this, "command", "list");
}
if ($_REQUEST["add"] || $_REQUEST["del"])
{
$question = $this->object->createQuestionGUI("", $_POST["id"]);
if ($_REQUEST["add"] && $_POST["chb_add"])
{
$checkb = $_POST["chb_add"];
$par = $_POST["params1"];
$hint = $this->lng->txt("regrading_new_answers_hint");
$command = "add";
}
elseif ($_REQUEST["del"] && ($_POST["chb_del"] || $_POST["chb_del_subset"]))
{
if ($_POST["chb_del"])
$checkb = $_POST["chb_del"];
else
$checkb = $_POST["chb_del_subset"];
$par = $_POST["params2"];
$hint = "Um die Punkte zu aktualisieren, druecken Sie auf Frage und Punkte speichern.";
$command = "del";
}
$cnt = 0;
if (count($checkb))
foreach($par as $key => $value)
{
if ($checkb[$key] == "on")
{
if (preg_match("/(\d+)_(\d+)_(\d+)/", $value, $matches))
if ($command == "add")
{
if (preg_match("/(\d+)_(\d+)_(\d+)/", $value, $matches))
$gap_id = $matches[1];
$order = $matches[2];
$solutionId = $matches[3];
$answer_item = $obj_scoring->addQuestionAnswer($solutionId, $qtype);
if ($qtype == "assClozeTest")
{
include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
$answer = new assAnswerCloze($answer_item, 0, $order);
$question->object->gaps[$gap_id]->addItem($answer);
}
if ($qtype == "assTextSubset")
{
$order = $matches[2] + $cnt;
$question->object->addAnswer($answer_item, 0, $order);
}
}
if ($command == "del")
{
if (preg_match("/(\d+)_(\d+)/", $value, $matches))
$gap_id = $matches[1];
$order = $matches[2];
if ($qtype == "assClozeTest")
{
$question->object->gaps[$gap_id]->deleteItem($order);
}
if ($qtype == "assTextSubset")
{
$order = $order - $cnt;
$question->object->deleteAnswer($order);
}
}
$cnt++;
}
}
$question->object->saveToDb();
$this->ctrl->setParameter($this, "q_id", $_POST["id"]);
$this->ctrl->setParameter($this, "command", "list");
$this->ctrl->setParameter($this, "warn", $hint);
$this->ctrl->redirect($this, "scoreQuestion");
}
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_newscoring_question.html", "Modules/Test/newscoring");
$this->tpl->setVariable("FORMACTION", $this->ctrl->getLinkTarget($this, "scoreQuestion"));
if ($_GET["warn"])
$this->tpl->setVariable("WARNING", $_GET["warn"]);
// display question list
if ($command == "" OR ($_REQUEST["back"] > ""))
{
if ($this->object->isRandomTest())
{
$this->tpl->setCurrentBlock("qlist");
$this->tpl->setVariable("HINT", $this->lng->txt("regrading_random"));
$this->tpl->ParseCurrentBlock();
return;
}
$data =& $this->object->getCompleteEvaluationData(FALSE);
if (count($data->getParticipants()) == 0)
{
ilUtil::sendInfo($this->lng->txt("tst_no_evaluation_data"), true);
return;
}
$this->tpl->setCurrentBlock("qlist");
$this->tpl->setVariable("HINT", "<em>" . $this->lng->txt("regrading_hint") . "</em>");
$this->tpl->setVariable("HEADING", $this->lng->txt("regrading_list_of_questions"));
$this->tpl->setVariable("TXT_NUMBER", $this->lng->txt("regrading_number"));
$this->tpl->setVariable("TXT_QUESTION_TITLE", $this->lng->txt("regrading_question_title"));
$this->tpl->setVariable("TXT_QUESTION_TYPE", $this->lng->txt("regrading_question_type"));
$this->tpl->setVariable("TXT_SHOW_QUESTION_STATS", $this->lng->txt("regrading_show_question_stats"));
$testquestions =& $this->object->getTestQuestions();
$qnum = 1;
foreach ($testquestions as $quest)
{
$questionId = $quest["question_id"];
$qtype = assQuestion::_getQuestionType($questionId);
if (in_array($qtype, $qtypes))
{
$questionTitle = $quest["title"];
$question = $this->object->createQuestionGUI("", $questionId);
$this->tpl->setCurrentBlock("question");
$this->tpl->setVariable("QNUM", $qnum++);
$this->tpl->setVariable("TITLE", $questionTitle);
$href= $this->ctrl->getLinkTarget($this, "scoreQuestion")."&command=list&q_id=".$questionId;
$this->tpl->setVariable("HREF",$href);
$this->tpl->setVariable("QTYPE",$this->lng->txt($qtype));
$this->tpl->ParseCurrentBlock();
}
}
$this->tpl->ParseCurrentBlock();
}
elseif ($command == "list") // display selected question
{
$q_id = $_GET["q_id"] ? $_GET["q_id"] : $questionId;
$obj_scoring->loadTempTable($q_id);
if ($qtype == "assOrderingQuestion")
{
if ($save_qst == 0)
{
$mess = $this->lng->txt("regrading_maxpoints_error");
}
if ($save_qst == 2)
{
$itemPoints = $obj_scoring->loadOrderingItemPoints($q_id);
if (!$itemPoints[0])
{
$mess = $this->lng->txt("regrading_newstyle_help");
}
else
{
$mess = $this->lng->txt("regrading_oldstyle_help");
}
}
}
$out = $this->getQuestionStat($q_id, true);
$this->tpl->setVariable("QUESTION", $out);
}
}
}

+ Here is the call graph for this function:

ilTestNewScoringGUI::sync ( )

Confirm synchronisation with original questionpool.

Definition at line 825 of file class.ilTestNewScoringGUI.php.

References $_GET, and assQuestion\_getQuestionType().

{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$question = $this->object->createQuestionGUI("", $_GET["q_id"]);
$original_id = $question->object->original_id;
if ($original_id)
{
$question->object->syncWithOriginal();
$qtype = assQuestion::_getQuestionType($original_id);
if ($qtype == "assClozeTest")
{
$orig_question = $this->object->createQuestionGUI("", $original_id);
$orig_question->object->updateClozeTextFromGaps();
$orig_question->object->saveToDb();
}
}
$this->ctrl->setParameter($this, "q_id", $_GET["q_id"]);
$this->ctrl->setParameter($this, "sync", "yes");
$this->ctrl->redirect($this, "scoreQuestion");
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: