MDL-27955 lesson module (m20): fixed error for reviewing lesson and update string to continue or finish reviewing
This commit is contained in:
+15
-8
@@ -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 '<a name="maincontent" id="maincontent" title="'.get_string('anchortitle', 'lesson').'"></a>';
|
||||
}
|
||||
// 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', "<div>$content</div>", 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));
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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', '<div class="answeroption">');
|
||||
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', '</div>');
|
||||
$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"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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', '<div class="answeroption">');
|
||||
$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', '</div>');
|
||||
$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"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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', '<div class="answeroption">');
|
||||
$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', '</div>');
|
||||
$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"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,4 +28,5 @@
|
||||
/**
|
||||
* Style for view.php
|
||||
**/
|
||||
#page-mod-lesson-view .password-form .submitbutton {display: inline;}
|
||||
#page-mod-lesson-view .password-form .submitbutton {display: inline;}
|
||||
.path-mod-lesson .reviewessay {width:40%; border:1px solid #DDDDDD; background-color: #EEEEEE;}
|
||||
|
||||
+23
-12
@@ -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');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user