Browse files

Merge branch 'MDL-26486_m21' of git://github.com/rwijaya/moodle into …

…MOODLE_21_STABLE
  • Loading branch information...
2 parents f6705d6 + 03fb10d commit c6e321ccaf15270b787954b4698928d52bde4b0e @nebgor nebgor committed Oct 3, 2011
Showing with 12 additions and 15 deletions.
  1. +11 −14 mod/lesson/pagetypes/matching.php
  2. +1 −1 mod/lesson/pagetypes/shortanswer.php
View
25 mod/lesson/pagetypes/matching.php
@@ -383,26 +383,23 @@ public function report_answers($answerpage, $answerdata, $useranswer, $pagestats
} else {
$answerdata->response = $answer->response;
}
+ if ($this->lesson->custom) {
+ $answerdata->score = get_string("pointsearned", "lesson").": ".$answer->score;
+ } else {
+ $answerdata->score = get_string("receivedcredit", "lesson");
+ }
} elseif ($n == 1 && $useranswer != NULL && !$useranswer->correct) {
if ($answer->response == NULL && $useranswer != NULL) {
$answerdata->response = get_string("thatsthewronganswer", "lesson");
} else {
$answerdata->response = $answer->response;
}
- } elseif ($n > 1) {
- if ($n == 2 && $useranswer != NULL && $useranswer->correct) {
- if ($this->lesson->custom) {
- $answerdata->score = get_string("pointsearned", "lesson").": ".$answer->score;
- } else {
- $answerdata->score = get_string("receivedcredit", "lesson");
- }
- } elseif ($n == 3 && $useranswer != NULL && !$useranswer->correct) {
- if ($this->lesson->custom) {
- $answerdata->score = get_string("pointsearned", "lesson").": ".$answer->score;
- } else {
- $answerdata->score = get_string("didnotreceivecredit", "lesson");
- }
+ if ($this->lesson->custom) {
+ $answerdata->score = get_string("pointsearned", "lesson").": ".$answer->score;
+ } else {
+ $answerdata->score = get_string("didnotreceivecredit", "lesson");
}
+ } elseif ($n > 1) {
$data = "<select disabled=\"disabled\"><option selected=\"selected\">".strip_tags(format_string($answer->answer))."</option></select>";
if ($useranswer != NULL) {
$userresponse = explode(",", $useranswer->useranswer);
@@ -427,7 +424,7 @@ public function report_answers($answerpage, $answerdata, $useranswer, $pagestats
$percent = get_string("nooneansweredthisquestion", "lesson");
}
} else {
- $percent = "";
+ $percent = '';
}
$answerdata->answers[] = array($data, $percent);
View
2 mod/lesson/pagetypes/shortanswer.php
@@ -260,7 +260,7 @@ public function report_answers($answerpage, $answerdata, $useranswer, $pagestats
$answerdata->answers[] = array(get_string("nooneansweredthisquestion", "lesson"), " ");
}
$i++;
- } else if ($useranswer != null && ($answer->id == $useranswer->answerid || ($answer == end($answers) && empty($answerdata)))) {
+ } else if ($useranswer != null && ($answer->id == $useranswer->answerid || $answer == end($answers))) {
// get in here when what the user entered is not one of the answers
$data = '<input type="text" size="50" disabled="disabled" readonly="readonly" value="'.s($useranswer->useranswer).'">';
if (isset($pagestats[$this->properties->id][$useranswer->useranswer])) {

0 comments on commit c6e321c

Please sign in to comment.