dont allow to student to restart lesson

dont allow to student to restart lesson

by Amin Farajzadeh -
Number of replies: 3

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: -
In reply to Amin Farajzadeh

Re: dont allow to student to restart lesson

by Klaus K -

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

In reply to Klaus K

Re: dont allow to student to restart lesson

by Amin Farajzadeh -

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)
In reply to Amin Farajzadeh

Re: dont allow to student to restart lesson

by Klaus K -

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?