Merged changes from 1.5
This commit is contained in:
@@ -42,7 +42,7 @@
|
||||
// Fix the questiontext fields of old questions
|
||||
set_field('quiz_questions', 'questiontext', addslashes($parsableanswerdef), 'id', $wrapped->id);
|
||||
} else {
|
||||
$parsableanswerdef = $wrapped->questiontext;
|
||||
$parsableanswerdef = str_replace('&#', '&\#', $wrapped->questiontext);
|
||||
}
|
||||
$question->questiontext = str_replace("{#$key}", $parsableanswerdef, $question->questiontext);
|
||||
}
|
||||
|
||||
@@ -377,6 +377,10 @@ function quiz_qtype_multianswer_extract_question($text) {
|
||||
// Regexes are always awkard when defined but more comprehensible
|
||||
// when used as constants in the executive code
|
||||
|
||||
// Handle the entity encoded ampersand in entities (e.g. &lt; -> <)
|
||||
$text = preg_replace('/&(.{2,9}?;)/', '&${1}', $text);
|
||||
$text = stripslashes($text);
|
||||
|
||||
// ANSWER_ALTERNATIVE regexes
|
||||
define("ANSWER_ALTERNATIVE_FRACTION_REGEX",
|
||||
'=|%(-?[0-9]+)%');
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
}
|
||||
if (!empty($options->answers)) {
|
||||
$answersraw = get_records_list("quiz_answers", "id", $options->answers);
|
||||
|
||||
}
|
||||
for ($i=0 ; $i < QUIZ_MAX_NUMBER_ANSWERS ; $i++) {
|
||||
$answers[] = ""; // Make answer slots, default as blank
|
||||
|
||||
@@ -66,9 +66,9 @@ class quiz_multichoice_qtype extends quiz_default_questiontype {
|
||||
foreach ($question->answer as $key => $dataanswer) {
|
||||
if ($dataanswer != "") {
|
||||
if ($answer = array_shift($oldanswers)) { // Existing answer, so reuse it
|
||||
$answer->answer = $dataanswer;
|
||||
$answer->fraction = $question->fraction[$key];
|
||||
$answer->feedback = $question->feedback[$key];
|
||||
$answer->answer = $dataanswer;
|
||||
$answer->fraction = $question->fraction[$key];
|
||||
$answer->feedback = $question->feedback[$key];
|
||||
if (!update_record("quiz_answers", $answer)) {
|
||||
$result->error = "Could not update quiz answer! (id=$answer->id)";
|
||||
return $result;
|
||||
|
||||
@@ -171,7 +171,7 @@ class quiz_shortanswer_qtype extends quiz_default_questiontype {
|
||||
}
|
||||
|
||||
function grade_responses(&$question, &$state, $cmoptions) {
|
||||
$answers = &$question->options->answers;
|
||||
$answers = &$question->options->answers;
|
||||
$testedstate = clone($state);
|
||||
$teststate = clone($state);
|
||||
$state->raw_grade = 0;
|
||||
|
||||
Reference in New Issue
Block a user