From 494f645bf4db46f7d938d78f51a9c27682f40cb3 Mon Sep 17 00:00:00 2001 From: Rossiani Wijaya Date: Wed, 29 Jun 2011 18:34:54 +0800 Subject: [PATCH] MDL-27955 lesson module (m20): fixed error for reviewing lesson and update string to continue or finish reviewing --- mod/lesson/continue.php | 23 +++++++++++------ mod/lesson/lang/en/lesson.php | 4 +++ mod/lesson/locallib.php | 6 +++-- mod/lesson/pagetypes/essay.php | 34 ++++++++++++++++++++----- mod/lesson/pagetypes/matching.php | 38 ++++++++++++++++++++++------ mod/lesson/pagetypes/multichoice.php | 19 +++++++++++--- mod/lesson/pagetypes/shortanswer.php | 22 +++++++++++++--- mod/lesson/pagetypes/truefalse.php | 29 +++++++++++++++++---- mod/lesson/styles.css | 3 ++- mod/lesson/view.php | 35 ++++++++++++++++--------- 10 files changed, 162 insertions(+), 51 deletions(-) diff --git a/mod/lesson/continue.php b/mod/lesson/continue.php index d207aaee0d0..384cb472791 100644 --- a/mod/lesson/continue.php +++ b/mod/lesson/continue.php @@ -67,6 +67,13 @@ if (!$canmanage) { // record answer (if necessary) and show response (if none say if answer is correct or not) $page = $lesson->load_page(required_param('pageid', PARAM_INT)); + +$userhasgrade = $DB->count_records("lesson_grades", array("lessonid"=>$lesson->id, "userid"=>$USER->id)); +$reviewmode = false; +if ($userhasgrade && !$lesson->retake) { + $reviewmode = true; +} + // Check the page has answers [MDL-25632] if (count($page->answers) > 0) { $result = $page->record_attempt($context); @@ -80,7 +87,7 @@ if (count($page->answers) > 0) { if (isset($USER->modattempts[$lesson->id])) { // make sure if the student is reviewing, that he/she sees the same pages/page path that he/she saw the first time - if ($USER->modattempts[$lesson->id] == $page->id && $page->nextpageid == 0) { // remember, this session variable holds the pageid of the last page that the user saw + if ($USER->modattempts[$lesson->id]->pageid == $page->id && $page->nextpageid == 0) { // remember, this session variable holds the pageid of the last page that the user saw $result->newpageid = LESSON_EOL; } else { $nretakes = $DB->count_records("lesson_grades", array("lessonid"=>$lesson->id, "userid"=>$USER->id)); @@ -153,11 +160,11 @@ if ($canmanage) { } } // Report attempts remaining -if ($result->attemptsremaining != 0 && !$lesson->review) { +if ($result->attemptsremaining != 0 && !$lesson->review && !$reviewmode) { $lesson->add_message(get_string('attemptsremaining', 'lesson', $result->attemptsremaining)); } // Report if max attempts reached -if ($result->maxattemptsreached != 0 && !$lesson->review) { +if ($result->maxattemptsreached != 0 && !$lesson->review && !$reviewmode) { $lesson->add_message('('.get_string("maximumnumberofattemptsreached", "lesson").')'); } @@ -172,7 +179,7 @@ if ($lesson->displayleft) { echo ''; } // This calculates and prints the ongoing score message -if ($lesson->ongoing) { +if ($lesson->ongoing && !$reviewmode) { echo $lessonoutput->ongoing_score($lesson); } echo $result->feedback; @@ -180,17 +187,17 @@ echo $result->feedback; // User is modifying attempts - save button and some instructions if (isset($USER->modattempts[$lesson->id])) { $url = $CFG->wwwroot.'/mod/lesson/view.php'; - $content = $OUTPUT->box(get_string("savechangesandeol", "lesson"), 'center'); + $content = $OUTPUT->box(get_string("gotoendoflesson", "lesson"), 'center'); $content .= $OUTPUT->box(get_string("or", "lesson"), 'center'); - $content .= $OUTPUT->box(get_string("continuetoanswer", "lesson"), 'center'); + $content .= $OUTPUT->box(get_string("continuetonextpage", "lesson"), 'center'); $content .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'id', 'value'=>$cm->id)); $content .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'pageid', 'value'=>LESSON_EOL)); - $content .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'submit', 'value'=>get_string('savechanges', 'lesson'))); + $content .= html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'submit', 'value'=>get_string('finish', 'lesson'))); echo html_writer::tag('form', "
$content
", array('method'=>'post', 'action'=>$url)); } // Review button back -if ($lesson->review && !$result->correctanswer && !$result->noanswer && !$result->isessayquestion) { +if (!$result->correctanswer && !$result->noanswer && !$result->isessayquestion && !$reviewmode) { $url = $CFG->wwwroot.'/mod/lesson/view.php'; $content = html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'id', 'value'=>$cm->id)); $content .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'pageid', 'value'=>$page->id)); diff --git a/mod/lesson/lang/en/lesson.php b/mod/lesson/lang/en/lesson.php index 0ec7cbf93ee..46a931857e3 100644 --- a/mod/lesson/lang/en/lesson.php +++ b/mod/lesson/lang/en/lesson.php @@ -109,6 +109,7 @@ $string['confirmdeletionofthispage'] = 'Confirm deletion of this page'; $string['congratulations'] = 'Congratulations - end of lesson reached'; $string['continue'] = 'Continue'; $string['continuetoanswer'] = 'Continue to change answers.'; +$string['continuetonextpage'] = 'Continue to next page.'; $string['correctanswerjump'] = 'Correct answer jump'; $string['correctanswerscore'] = 'Correct answer score'; $string['correctresponse'] = 'Correct response'; @@ -166,11 +167,13 @@ $string['essayemailsubject'] = 'Your grade for {$a} question'; $string['essays'] = 'Essays'; $string['essayscore'] = 'Essay score'; $string['fileformat'] = 'File format'; +$string['finish'] = 'Finish'; $string['firstanswershould'] = 'First answer should jump to the "Correct" page'; $string['firstwrong'] = 'Unfortunately you cannot earn this one point, because your response was not correct. Would you like to keep guessing, just for the sheer joy of learning (but for no point credit)?'; $string['flowcontrol'] = 'Flow control'; $string['full'] = 'Expanded'; $string['general'] = 'General'; +$string['gotoendoflesson'] = 'Go to the end of the lesson'; $string['grade'] = 'Grade'; $string['gradebetterthan'] = 'Grade better than (%)'; $string['gradebetterthanerror'] = 'Earn a grade better than {$a} percent'; @@ -377,6 +380,7 @@ $string['studentattemptlesson'] = '{$a->lastname}, {$a->firstname}\'s attempt nu $string['studentname'] = '{$a} Name'; $string['studentoneminwarning'] = 'Warning: You have 1 minute or less to finish the lesson.'; $string['studentresponse'] = '{$a}\'s response'; +$string['submit'] = 'Submit'; $string['submitname'] = 'Submit name'; $string['teacherjumpwarning'] = 'An {$a->cluster} jump or an {$a->unseen} jump is being used in this lesson. The next page jump will be used instead. Login as a student to test these jumps.'; $string['teacherongoingwarning'] = 'Ongoing score is only displayed for student. Login as a student to test ongoing score'; diff --git a/mod/lesson/locallib.php b/mod/lesson/locallib.php index b4fb01e7a15..ccbca89ed8b 100644 --- a/mod/lesson/locallib.php +++ b/mod/lesson/locallib.php @@ -1961,13 +1961,15 @@ abstract class lesson_page extends lesson_base { $attempt->retry = $nretakes - 1; // they are going through on review, $nretakes will be too high } - $DB->insert_record("lesson_attempts", $attempt); + if ($this->lesson->retake || (!$this->lesson->retake && $nretakes == 0)) { + $DB->insert_record("lesson_attempts", $attempt); + } // "number of attempts remaining" message if $this->lesson->maxattempts > 1 // displaying of message(s) is at the end of page for more ergonomic display if (!$result->correctanswer && ($result->newpageid == 0)) { // wrong answer and student is stuck on this page - check how many attempts // the student has had at this page/question - $nattempts = $DB->count_records("lesson_attempts", array("pageid"=>$this->properties->id, "userid"=>$USER->id, "retry" => $nretakes)); + $nattempts = $DB->count_records("lesson_attempts", array("pageid"=>$this->properties->id, "userid"=>$USER->id, "retry" => $attempt->retry)); // retreive the number of attempts left counter for displaying at bottom of feedback page if ($nattempts >= $this->lesson->maxattempts) { if ($this->lesson->maxattempts > 1) { // don't bother with message if only one attempt diff --git a/mod/lesson/pagetypes/essay.php b/mod/lesson/pagetypes/essay.php index 2f7d4f9b485..b1c8136d024 100644 --- a/mod/lesson/pagetypes/essay.php +++ b/mod/lesson/pagetypes/essay.php @@ -51,14 +51,14 @@ class lesson_page_type_essay extends lesson_page { public function display($renderer, $attempt) { global $PAGE, $CFG, $USER; - $mform = new lesson_display_answer_form_essay($CFG->wwwroot.'/mod/lesson/continue.php', array('contents'=>$this->get_contents())); + $mform = new lesson_display_answer_form_essay($CFG->wwwroot.'/mod/lesson/continue.php', array('contents'=>$this->get_contents(), 'lessonid'=>$this->lesson->id)); $data = new stdClass; $data->id = $PAGE->cm->id; $data->pageid = $this->properties->id; if (isset($USER->modattempts[$this->lesson->id])) { $essayinfo = unserialize($attempt->useranswer); - $data->answer = array('text'=>$essayinfo->answer, 'format'=>FORMAT_HTML); + $data->answer = $essayinfo->answer; } $mform->set_data($data); return $mform->display(); @@ -252,6 +252,20 @@ class lesson_display_answer_form_essay extends moodleform { $mform = $this->_form; $contents = $this->_customdata['contents']; + $hasattempt = false; + $attrs = ''; + $useranswer = ''; + $useranswerraw = ''; + if (isset($this->_customdata['lessonid'])) { + $lessonid = $this->_customdata['lessonid']; + if (isset($USER->modattempts[$lessonid]->useranswer) && !empty($USER->modattempts[$lessonid]->useranswer)) { + $attrs = array('disabled' => 'disabled'); + $hasattempt = true; + $useranswer = unserialize($USER->modattempts[$lessonid]->useranswer); + $useranswer = htmlspecialchars_decode($useranswer->answer, ENT_QUOTES); + } + } + $mform->addElement('header', 'pageheader'); $mform->addElement('html', $OUTPUT->container($contents, 'contents')); @@ -266,10 +280,16 @@ class lesson_display_answer_form_essay extends moodleform { $mform->addElement('hidden', 'pageid'); $mform->setType('pageid', PARAM_INT); - $mform->addElement('editor', 'answer', get_string('youranswer', 'lesson'), null, null); - $mform->setType('answer', PARAM_RAW); - - $this->add_action_buttons(null, get_string("pleaseenteryouranswerinthebox", "lesson")); + if ($hasattempt) { + $mform->addElement('hidden', 'answer', $useranswerraw); + $mform->setType('answer', PARAM_CLEANHTML); + $mform->addElement('html', $OUTPUT->container(get_string('youranswer', 'lesson'), 'youranswer')); + $mform->addElement('html', $OUTPUT->container($useranswer, 'reviewessay')); + $this->add_action_buttons(null, get_string("nextpage", "lesson")); + } else { + $mform->addElement('editor', 'answer', get_string('youranswer', 'lesson'), null, null); + $mform->setType('answer', PARAM_RAW); + $this->add_action_buttons(null, get_string("submit", "lesson")); + } } - } diff --git a/mod/lesson/pagetypes/matching.php b/mod/lesson/pagetypes/matching.php index 3e40c63f92a..e9ffa09428c 100644 --- a/mod/lesson/pagetypes/matching.php +++ b/mod/lesson/pagetypes/matching.php @@ -61,7 +61,13 @@ class lesson_page_type_matching extends lesson_page { protected function make_answer_form($attempt=null) { global $USER, $CFG; // don't shuffle answers (could be an option??) - $answers = array_slice($this->get_answers(), 2); + $getanswers = array_slice($this->get_answers(), 2); + + $answers = array(); + foreach ($getanswers as $getanswer) { + $answers[$getanswer->id] = $getanswer; + } + $responses = array(); foreach ($answers as $answer) { // get all the response @@ -487,6 +493,13 @@ class lesson_display_answer_form_matching extends moodleform { $mform->addElement('html', $OUTPUT->container($contents, 'contents')); + $hasattempt = false; + $disabled = ''; + if (isset($useranswers) && !empty($useranswers)) { + $hasattempt = true; + $disabled = array('disabled' => 'disabled'); + } + $options = new stdClass; $options->para = false; $options->noclean = true; @@ -501,19 +514,28 @@ class lesson_display_answer_form_matching extends moodleform { foreach ($answers as $answer) { $mform->addElement('html', '
'); if ($answer->response != NULL) { - $mform->addElement('select', 'response['.$answer->id.']', format_text($answer->answer,$answer->answerformat,$options), $responseoptions); - $mform->setType('response['.$answer->id.']', PARAM_TEXT); - if (isset($USER->modattempts[$lessonid])) { - $mform->setDefault('response['.$answer->id.']', htmlspecialchars(trim($answers[$useranswers[$i]]->response))); //TODO: this is suspicious + $responseid = 'response['.$answer->id.']'; + if ($hasattempt) { + $responseid = 'response_'.$answer->id; + $mform->addElement('hidden', 'response['.$answer->id.']', htmlspecialchars(trim($answers[$useranswers[$i]]->response))); + $mform->setType('response['.$answer->id.']', PARAM_TEXT); + } + $mform->addElement('select', $responseid, format_text($answer->answer,$answer->answerformat,$options), $responseoptions, $disabled); + $mform->setType($responseid, PARAM_TEXT); + if ($hasattempt) { + $mform->setDefault($responseid, htmlspecialchars(trim($answers[$useranswers[$i]]->response))); //TODO: this is suspicious } else { - $mform->setDefault('response['.$answer->id.']', 'answeroption'); + $mform->setDefault($responseid, 'answeroption'); } } $mform->addElement('html', '
'); $i++; } - - $this->add_action_buttons(null, get_string("pleasematchtheabovepairs", "lesson")); + if ($hasattempt) { + $this->add_action_buttons(null, get_string("nextpage", "lesson")); + } else { + $this->add_action_buttons(null, get_string("submit", "lesson")); + } } } diff --git a/mod/lesson/pagetypes/multichoice.php b/mod/lesson/pagetypes/multichoice.php index f29268fe679..078af8950be 100644 --- a/mod/lesson/pagetypes/multichoice.php +++ b/mod/lesson/pagetypes/multichoice.php @@ -490,6 +490,13 @@ class lesson_display_answer_form_multichoice_singleanswer extends moodleform { $mform->addElement('html', $OUTPUT->container($contents, 'contents')); + $hasattempt = false; + $disabled = ''; + if (isset($USER->modattempts[$lessonid]) && !empty($USER->modattempts[$lessonid])) { + $hasattempt = true; + $disabled = array('disabled' => 'disabled'); + } + $options = new stdClass; $options->para = false; $options->noclean = true; @@ -503,16 +510,20 @@ class lesson_display_answer_form_multichoice_singleanswer extends moodleform { $i = 0; foreach ($answers as $answer) { $mform->addElement('html', '
'); - $mform->addElement('radio','answerid',null,format_text($answer->answer, $answer->answerformat, $options),$answer->id); + $mform->addElement('radio','answerid',null,format_text($answer->answer, $answer->answerformat, $options),$answer->id, $disabled); $mform->setType('answer'.$i, PARAM_INT); - if (isset($USER->modattempts[$lessonid]) && $answer->id == $USER->modattempts[$lessonid]->answerid) { - $mform->setDefault('answerid', true); + if ($hasattempt && $answer->id == $USER->modattempts[$lessonid]->answerid) { + $mform->setDefault('answerid', $USER->modattempts[$lessonid]->answerid); } $mform->addElement('html', '
'); $i++; } - $this->add_action_buttons(null, get_string("pleasecheckoneanswer", "lesson")); + if ($hasattempt) { + $this->add_action_buttons(null, get_string("nextpage", "lesson")); + } else { + $this->add_action_buttons(null, get_string("submit", "lesson")); + } } } diff --git a/mod/lesson/pagetypes/shortanswer.php b/mod/lesson/pagetypes/shortanswer.php index 9e5c0f56021..8681fdf73cc 100644 --- a/mod/lesson/pagetypes/shortanswer.php +++ b/mod/lesson/pagetypes/shortanswer.php @@ -50,7 +50,7 @@ class lesson_page_type_shortanswer extends lesson_page { } public function display($renderer, $attempt) { global $USER, $CFG, $PAGE; - $mform = new lesson_display_answer_form_shortanswer($CFG->wwwroot.'/mod/lesson/continue.php', array('contents'=>$this->get_contents())); + $mform = new lesson_display_answer_form_shortanswer($CFG->wwwroot.'/mod/lesson/continue.php', array('contents'=>$this->get_contents(), 'lessonid'=>$this->lesson->id)); $data = new stdClass; $data->id = $PAGE->cm->id; $data->pageid = $this->properties->id; @@ -328,10 +328,20 @@ class lesson_add_page_form_shortanswer extends lesson_add_page_form_base { class lesson_display_answer_form_shortanswer extends moodleform { public function definition() { - global $OUTPUT; + global $OUTPUT, $USER; $mform = $this->_form; $contents = $this->_customdata['contents']; + $hasattempt = false; + $attrs = array('size'=>'50', 'maxlength'=>'200'); + if (isset($this->_customdata['lessonid'])) { + $lessonid = $this->_customdata['lessonid']; + if (isset($USER->modattempts[$lessonid]->useranswer)) { + $attrs['readonly'] = 'readonly'; + $hasattempt = true; + } + } + $mform->addElement('header', 'pageheader'); $mform->addElement('html', $OUTPUT->container($contents, 'contents')); @@ -346,10 +356,14 @@ class lesson_display_answer_form_shortanswer extends moodleform { $mform->addElement('hidden', 'pageid'); $mform->setType('pageid', PARAM_INT); - $mform->addElement('text', 'answer', get_string('youranswer', 'lesson'), array('size'=>'50', 'maxlength'=>'200')); + $mform->addElement('text', 'answer', get_string('youranswer', 'lesson'), $attrs); $mform->setType('answer', PARAM_TEXT); - $this->add_action_buttons(null, get_string("pleaseenteryouranswerinthebox", "lesson")); + if ($hasattempt) { + $this->add_action_buttons(null, get_string("nextpage", "lesson")); + } else { + $this->add_action_buttons(null, get_string("submit", "lesson")); + } } } diff --git a/mod/lesson/pagetypes/truefalse.php b/mod/lesson/pagetypes/truefalse.php index 61a1a7e343d..6b8977bfb1d 100644 --- a/mod/lesson/pagetypes/truefalse.php +++ b/mod/lesson/pagetypes/truefalse.php @@ -303,6 +303,13 @@ class lesson_display_answer_form_truefalse extends moodleform { $mform->addElement('html', $OUTPUT->container($contents, 'contents')); + $hasattempt = false; + $disabled = ''; + if (isset($USER->modattempts[$lessonid]) && !empty($USER->modattempts[$lessonid])) { + $hasattempt = true; + $disabled = array('disabled' => 'disabled'); + } + $options = new stdClass(); $options->para = false; $options->noclean = true; @@ -316,16 +323,28 @@ class lesson_display_answer_form_truefalse extends moodleform { $i = 0; foreach ($answers as $answer) { $mform->addElement('html', '
'); - $mform->addElement('radio', 'answerid', null, format_text($answer->answer, $answer->answerformat, $options), $answer->id); - $mform->setType('answerid', PARAM_INT); - if (isset($USER->modattempts[$lessonid]) && $answer->id == $attempt->answerid) { - $mform->setDefault('answerid', true); + $ansid = 'answerid'; + if ($hasattempt) { + $ansid = 'answer_id'; + } + + $mform->addElement('radio', $ansid, null, format_text($answer->answer, $answer->answerformat, $options), $answer->id, $disabled); + $mform->setType($ansid, PARAM_INT); + if ($hasattempt && $answer->id == $USER->modattempts[$lessonid]->answerid) { + $mform->setDefault($ansid, $attempt->answerid); + $mform->addElement('hidden', 'answerid', $answer->id); + $mform->setType('answerid', PARAM_INT); } $mform->addElement('html', '
'); $i++; } - $this->add_action_buttons(null, get_string("pleasecheckoneanswer", "lesson")); + if ($hasattempt) { + $this->add_action_buttons(null, get_string("nextpage", "lesson")); + } else { + $this->add_action_buttons(null, get_string("submit", "lesson")); + } + } } diff --git a/mod/lesson/styles.css b/mod/lesson/styles.css index 99028da116e..fd4541aec93 100644 --- a/mod/lesson/styles.css +++ b/mod/lesson/styles.css @@ -28,4 +28,5 @@ /** * Style for view.php **/ -#page-mod-lesson-view .password-form .submitbutton {display: inline;} \ No newline at end of file +#page-mod-lesson-view .password-form .submitbutton {display: inline;} +.path-mod-lesson .reviewessay {width:40%; border:1px solid #DDDDDD; background-color: #EEEEEE;} diff --git a/mod/lesson/view.php b/mod/lesson/view.php index c82d5895dcd..855b7556861 100644 --- a/mod/lesson/view.php +++ b/mod/lesson/view.php @@ -60,6 +60,12 @@ $canmanage = has_capability('mod/lesson:manage', $context); $lessonoutput = $PAGE->get_renderer('mod_lesson'); +$reviewmode = false; +$userhasgrade = $DB->count_records("lesson_grades", array("lessonid"=>$lesson->id, "userid"=>$USER->id)); +if ($userhasgrade && !$lesson->retake) { + $reviewmode = true; +} + /// Check these for students only TODO: Find a better method for doing this! /// Check lesson availability /// Check for password @@ -316,11 +322,14 @@ if ($pageid != LESSON_EOL) { $a->minquestions = $lesson->minquestions; $lesson->add_message(get_string('numberofpagesviewednotice', 'lesson', $a)); } - $lesson->add_message(get_string("numberofcorrectanswers", "lesson", $gradeinfo->earned), 'notify'); + $a = new stdClass; $a->grade = number_format($gradeinfo->grade * $lesson->grade / 100, 1); $a->total = $lesson->grade; - $lesson->add_message(get_string('yourcurrentgradeisoutof', 'lesson', $a), 'notify'); + if (!$reviewmode && !$lesson->retake){ + $lesson->add_message(get_string("numberofcorrectanswers", "lesson", $gradeinfo->earned), 'notify'); + $lesson->add_message(get_string('yourcurrentgradeisoutof', 'lesson', $a), 'notify'); + } } } } else { @@ -356,6 +365,7 @@ if ($pageid != LESSON_EOL) { print_error('cannotfindpreattempt', 'lesson'); } $attempt = end($attempts); + $USER->modattempts[$lesson->id] = $attempt; } else { $attempt = false; } @@ -387,7 +397,7 @@ if ($pageid != LESSON_EOL) { echo $OUTPUT->heading(get_string('attempt', 'lesson', $retries)); } /// This calculates and prints the ongoing score - if ($lesson->ongoing && !empty($pageid)) { + if ($lesson->ongoing && !empty($pageid) && !$reviewmode) { echo $lessonoutput->ongoing_score($lesson); } if ($lesson->displayleft) { @@ -538,17 +548,18 @@ if ($pageid != LESSON_EOL) { // $ntries is decremented above if (!$attempts = $lesson->get_attempts($ntries)) { $attempts = array(); + $url = new moodle_url('/mod/lesson/view.php', array('id'=>$PAGE->cm->id)); + } else { + $firstattempt = current($attempts); + $pageid = $firstattempt->pageid; + // IF the student wishes to review, need to know the last question page that the student answered. This will help to make + // sure that the student can leave the lesson via pushing the continue button. + $lastattempt = end($attempts); + $USER->modattempts[$lesson->id] = $lastattempt->pageid; + + $url = new moodle_url('/mod/lesson/view.php', array('id'=>$PAGE->cm->id, 'pageid'=>$pageid)); } - $firstattempt = current($attempts); - $pageid = $firstattempt->pageid; - // IF the student wishes to review, need to know the last question page that the student answered. This will help to make - // sure that the student can leave the lesson via pushing the continue button. - $lastattempt = end($attempts); - $USER->modattempts[$lesson->id] = $lastattempt->pageid; - - $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) { $lessoncontent .= $lessonoutput->paragraph(get_string("modattemptsnoteacher", "lesson"), 'centerpadded'); }