# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/mod/lesson/lang/en/lesson.php
--- moodle/mod/lesson/lang/en/lesson.php Base (1.12)
+++ moodle/mod/lesson/lang/en/lesson.php Locally Modified (Based On 1.12)
@@ -251,6 +251,7 @@
 $string['modattempts'] = 'Allow student review';
 $string['modattempts_help'] = 'If enabled, students can navigate through the lesson again from the start.';
 $string['modattemptsnoteacher'] = 'Student review only works for students.';
+$string['modattemptsnotenoughattempts'] = 'Lesson has not enough attempts set for a review.';
 $string['modulename'] = 'Lesson';
 $string['modulename_help'] = 'The lesson module enables the teacher to create an adaptive learning experience consisting of a series of pages containing questions.';
 $string['modulenameplural'] = 'Lessons';
Index: moodle/mod/lesson/renderer.php
--- moodle/mod/lesson/renderer.php Base (1.29)
+++ moodle/mod/lesson/renderer.php Locally Modified (Based On 1.29)
@@ -581,6 +581,7 @@
             $attributes['class'] = $class;
         }
         $output = html_writer::tag('p', $contents, $attributes);
+        return $output;
     }
     /**
      * Returns HTML to display add_highscores_form
Index: moodle/mod/lesson/view.php
--- moodle/mod/lesson/view.php Base (1.176)
+++ moodle/mod/lesson/view.php Locally Modified (Based On 1.176)
@@ -515,7 +515,7 @@
         $lessoncontent .= $OUTPUT->box_end();
     }
 
-    if ($lesson->modattempts && !$canmanage) {
+    if ($lesson->modattempts && !$canmanage && $lesson->maxattempts > 1) {
         // make sure if the student is reviewing, that he/she sees the same pages/page path that he/she saw the first time
         // look at the attempt records to find the first QUESTION page that the user answered, then use that page id
         // to pass to view again.  This is slick cause it wont call the empty($pageid) code
@@ -533,6 +533,8 @@
         $url = new moodle_url('/mod/lesson/view.php', array('id'=>$PAGE->cm->id, 'pageid'=>$pageid));
         $lessoncontent .= html_writer::link($url, get_string('reviewlesson', 'lesson'), array('class' => 'centerpadded lessonbutton standardbutton'));
 
+    } elseif ($lesson->modattempts && $canmanage && $lesson->maxattempts < 2) {
+        $lessoncontent .= $lessonoutput->paragraph(get_string("modattemptsnotenoughattempts", "lesson"), 'centerpadded');
     } elseif ($lesson->modattempts && $canmanage) {
         $lessoncontent .= $lessonoutput->paragraph(get_string("modattemptsnoteacher", "lesson"), 'centerpadded');
     }
