General developer forum

dont allow to student to restart lesson

 
Picture of Amin Farajzadeh
dont allow to student to restart lesson
 

when the student goes to lesson for the second time . lesson ask`s "Do you want to start at the last page you saw?"


but I want to force students to continue from last seen page.what should i do?


 
Average of ratings: -
Picture of Klaus K
Re: dont allow to student to restart lesson
 

I have the same issue... Is there any way to remove the question and force students to continue from the last page seen?

 
Average of ratings: -
Picture of Amin Farajzadeh
Re: dont allow to student to restart lesson
 

I done it with changing lesson`s code in view.php in this way:


    if (($lastpageseen !== false && ($lastpageseen != LESSON_EOL))) {
// End not reached. Check if the user left.
if ($lesson->left_during_timed_session($retries)) {

echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('leftduringtimedsession', 'lesson'));
if ($lesson->timelimit) {
if ($lesson->retake) {
$continuelink = new single_button(new moodle_url('/mod/lesson/view.php',
array('id' => $cm->id, 'pageid' => $lesson->firstpageid, 'startlastseen' => 'no')),
get_string('continue', 'lesson'), 'get');

echo html_writer::div($lessonoutput->message(get_string('leftduringtimed', 'lesson'), $continuelink),
'center leftduring');

} else {
$courselink = new single_button(new moodle_url('/course/view.php',
array('id' => $PAGE->course->id)), get_string('returntocourse', 'lesson'), 'get');

echo html_writer::div($lessonoutput->message(get_string('leftduringtimednoretake', 'lesson'), $courselink),
'center leftduring');
}
} else {
echo $lessonoutput->continue_links($lesson, $lastpageseen);
}
echo $lessonoutput->footer();
exit();
}
}

Changed to:

    if (($lastpageseen !== false && ($lastpageseen != lesson_EOL))) {
// End not reached. Check if the user left.
if ($lesson->left_during_timed_session($retries)) {

// echo $lessonoutput->header($lesson, $cm, '', false, null, get_string('leftduringtimedsession', 'lesson'));
if ($lesson->timelimit) {
if ($lesson->retake) {
$continuelink = new single_button(new moodle_url('/mod/lesson/view.php',
array('id' => $cm->id, 'pageid' => $lesson->firstpageid, 'startlastseen' => 'no')),
get_string('continue', 'lesson'), 'get');

//echo html_writer::div($lessonoutput->message(get_string('leftduringtimed', 'lesson'), $continuelink),
// 'center leftduring');

} else {
$courselink = new single_button(new moodle_url('/course/view.php',
array('id' => $PAGE->course->id)), get_string('returntocourse', 'lesson'), 'get');

//echo html_writer::div($lessonoutput->message(get_string('leftduringtimednoretake', 'lesson'), $courselink),
// 'center leftduring');
}
} else {
//echo $lessonoutput->continue_links($lesson, $lastpageseen);
}
//echo $lessonoutput->footer();
redirect(new moodle_url('/mod/lesson/view.php', array('id'=>$id, 'pageid'=>$lastpageseen, 'startlastseen'=>'yes')), get_string('yes'));
}
}


 
Average of ratings: Useful (2)
Picture of Klaus K
Re: dont allow to student to restart lesson
 

Thanks a lot, this is working great on desktop version! Unfortunately issue still exists on Moodle Mobile app. Is it possible to change Mobile app code somehow to make the same thing happen on mobile app also?

 
Average of ratings: -