Merge branch 'MDL-34102' of git://github.com/jmvedrine/moodle
authorDavid Monllao <davidm@moodle.com>
Tue, 12 May 2015 04:08:30 +0000 (12:08 +0800)
committerDavid Monllao <davidm@moodle.com>
Tue, 12 May 2015 04:08:30 +0000 (12:08 +0800)
mod/lesson/locallib.php

index 693bab5..2dfd017 100644 (file)
@@ -2520,38 +2520,40 @@ abstract class lesson_page extends lesson_base {
                         $result->feedback = $OUTPUT->box(get_string("secondpluswrong", "lesson"), 'feedback');
                     }
                 } else {
-                    $class = 'response';
-                    if ($result->correctanswer) {
-                        $class .= ' correct'; //CSS over-ride this if they exist (!important)
-                    } else if (!$result->isessayquestion) {
-                        $class .= ' incorrect'; //CSS over-ride this if they exist (!important)
-                    }
-                    $options = new stdClass;
-                    $options->noclean = true;
-                    $options->para = true;
-                    $options->overflowdiv = true;
-                    $options->context = $context;
-
-                    $result->feedback = $OUTPUT->box(format_text($this->get_contents(), $this->properties->contentsformat, $options), 'generalbox boxaligncenter');
-                    if (isset($result->studentanswerformat)) {
-                        // This is the student's answer so it should be cleaned.
-                        $studentanswer = format_text($result->studentanswer, $result->studentanswerformat,
-                                array('context' => $context, 'para' => true));
-                    } else {
-                        $studentanswer = format_string($result->studentanswer);
-                    }
-                    $result->feedback .= '<div class="correctanswer generalbox"><em>'
-                            . get_string("youranswer", "lesson").'</em> : ' . $studentanswer;
-                    if (isset($result->responseformat)) {
-                        $result->response = file_rewrite_pluginfile_urls($result->response, 'pluginfile.php', $context->id,
+                    $result->feedback = '';
+                }
+                $class = 'response';
+                if ($result->correctanswer) {
+                    $class .= ' correct'; // CSS over-ride this if they exist (!important).
+                } else if (!$result->isessayquestion) {
+                    $class .= ' incorrect'; // CSS over-ride this if they exist (!important).
+                }
+                $options = new stdClass;
+                $options->noclean = true;
+                $options->para = true;
+                $options->overflowdiv = true;
+                $options->context = $context;
+
+                $result->feedback .= $OUTPUT->box(format_text($this->get_contents(), $this->properties->contentsformat, $options),
+                        'generalbox boxaligncenter');
+                if (isset($result->studentanswerformat)) {
+                    // This is the student's answer so it should be cleaned.
+                    $studentanswer = format_text($result->studentanswer, $result->studentanswerformat,
+                            array('context' => $context, 'para' => true));
+                } else {
+                    $studentanswer = format_string($result->studentanswer);
+                }
+                $result->feedback .= '<div class="correctanswer generalbox"><em>'
+                        . get_string("youranswer", "lesson").'</em> : ' . $studentanswer;
+                if (isset($result->responseformat)) {
+                    $result->response = file_rewrite_pluginfile_urls($result->response, 'pluginfile.php', $context->id,
                             'mod_lesson', 'page_responses', $result->answerid);
-                        $result->feedback .= $OUTPUT->box(format_text($result->response, $result->responseformat, $options)
+                    $result->feedback .= $OUTPUT->box(format_text($result->response, $result->responseformat, $options)
                             , $class);
-                    } else {
-                        $result->feedback .= $OUTPUT->box($result->response, $class);
-                    }
-                    $result->feedback .= '</div>';
+                } else {
+                    $result->feedback .= $OUTPUT->box($result->response, $class);
                 }
+                $result->feedback .= '</div>';
             }
         }