Hello all,
When a lesson is dependent on time spent in a previous lesson, and the user does not spend the appropriate amount of time, mod/lesson/view.php returns this message:
You must complete the following condition(s) in (lesson name) before you can proceed.
Spend at least (the dependency time set) minutes in the lesson.
I would like to know if it is possible to notify the student how much time he has spent in the lesson.
Example: ...Spend at least 25 minutes in the lesson. You have spent 22 minutes in the lesson.
We're using version 1.9.5
Thank you!
Hello Amy,
Good idea! If you have admin access to your moodle site (or are on friendly terms with your admin
) you can make the following small change in file moodle/mod/lesson/view.php, around line 145 in current moodle 1.9.8 version:
change
to
Joseph
I have opened report MDL-22105 in the bug tracker for interested people to vote.
Good idea! If you have admin access to your moodle site (or are on friendly terms with your admin

change
// collect all of our error statements
if (!$timespent) {
$errors[] = get_string('timespenterror', 'lesson', $conditions->timespent);
}
if (!$timespent) {
$errors[] = get_string('timespenterror', 'lesson', $conditions->timespent);
}
to
// collect all of our error statements
if (!$timespent) {
$minutesspent = round($duration/60, 2);
$errors[] = get_string('timespenterror', 'lesson', $conditions->timespent).'<br />'.get_string('timespentminutes', 'lesson').': '.$minutesspent;
}
if (!$timespent) {
$minutesspent = round($duration/60, 2);
$errors[] = get_string('timespenterror', 'lesson', $conditions->timespent).'<br />'.get_string('timespentminutes', 'lesson').': '.$minutesspent;
}
Joseph
I have opened report MDL-22105 in the bug tracker for interested people to vote.

Hi again,
I'm back with a new issue. I'm not sure this one can be resolved as easily as the last one but if you don't ask...
I have a Lesson Dependency on a lesson for time spent in a previous lesson and I added the code above to moodle/mod/lesson/view.php and it works perfectly. (You must complete the following condition(s)... you have spent "x" minutes)..
Now I have a need to make the lesson dependent on two factors, one being time spent in a lesson, the second being a score of 80% or better on a quiz before the lesson may be accessed. I used an activity lock for the grade requirement, but when I do that, the activity lock message overrides the "you must spend "x" amount of time" message and the only requirement that shows when the lesson has been clicked is "you must score at least 80%" on quiz "quizname" before you may proceed. The time requirement is gone. (paraphrased). Is it possible to show both messages? I realize activity locking and lesson dependencies are two different animals, but I can't make activity locking require time spent, and I can't make lesson dependency require more than one item.
thanks in advance! Moodle is awesome.
I'm back with a new issue. I'm not sure this one can be resolved as easily as the last one but if you don't ask...
I have a Lesson Dependency on a lesson for time spent in a previous lesson and I added the code above to moodle/mod/lesson/view.php and it works perfectly. (You must complete the following condition(s)... you have spent "x" minutes)..
Now I have a need to make the lesson dependent on two factors, one being time spent in a lesson, the second being a score of 80% or better on a quiz before the lesson may be accessed. I used an activity lock for the grade requirement, but when I do that, the activity lock message overrides the "you must spend "x" amount of time" message and the only requirement that shows when the lesson has been clicked is "you must score at least 80%" on quiz "quizname" before you may proceed. The time requirement is gone. (paraphrased). Is it possible to show both messages? I realize activity locking and lesson dependencies are two different animals, but I can't make activity locking require time spent, and I can't make lesson dependency require more than one item.
thanks in advance! Moodle is awesome.
Hmmm
1. I'm wondering how frustrated learners might be if they complete a Lesson assigned a 15 minute allocation and they complete it in 10 minutes. Does this mean they have to go back to the completed Lesson and 'twiddle their thumbs' for 5 minutes before they can move on? Anyway, that's an aside!
2. I'm not sure you can make the Lesson dependent on two activities. But do you really need to? If activity B (e.g. Quiz) cannot be done until activity A (Lesson 1) is completed, then you have both conditions achieved before activity C (next Lesson) anyway?
Stuart
1. I'm wondering how frustrated learners might be if they complete a Lesson assigned a 15 minute allocation and they complete it in 10 minutes. Does this mean they have to go back to the completed Lesson and 'twiddle their thumbs' for 5 minutes before they can move on? Anyway, that's an aside!
2. I'm not sure you can make the Lesson dependent on two activities. But do you really need to? If activity B (e.g. Quiz) cannot be done until activity A (Lesson 1) is completed, then you have both conditions achieved before activity C (next Lesson) anyway?
Stuart
You know, I have read many posts on the topic of the "wrongness" in forcing time spent and how it is not geared towards learning. I agree. The reason I have the need is the age-old argument of "the regulators". I've read some forums that are actually pretty humorous, poking fun at the idea. Unfortunately it is not something I can laugh at wholeheartedly because it is my job to ensure we are compliant with the regulations. I suspect there are many schools similar to mine that have gravitated towards Moodle for the very fact that it offers so much, and it is open source. Many small schools simply can't afford to pay for an LMS, whether it be on a per-student basis or an outrageous flat fee. I was surprised at the cost when I started my research over a year ago. Here in the U.S., many businesses have been hit very hard and schools like ours have closed their doors or are struggling to survive.
I had hopes for 2.0 having more of the features that we need for "enforcement", (what a dirty word) after having read some of the documentation it appears that Moodle is moving in the other direction, for example, the lesson conditions based on time spent are going by the wayside from what I can tell. It makes me believe that I am attempting to force a square peg in a round hole.
As for frustration, the students are familiar with being forced to do X, Y, and Z because that is all they have known, and it likely does cause frustration if there is not enough material in a lesson to justify the time (and the student actually reads the material). Do I justify this thinking? Not really. The regulators do not look upon our students as "learners". They are numbers, and they are either compliant or non-compliant. I think regulations are an attempt to enforce learning, but the end result is not the desired one.
Giving the student the choice to go ahead and complete the quiz prior to spending the time in the lesson was an attempt at allowing a little more freedom to the student as these particular regulations do not force the order of the items, just both conditions must be met prior to completion. I did as you suggested and took the course down a linear path, it satisfies the regulations and presents a clear path to our students.
Thank you!
I had hopes for 2.0 having more of the features that we need for "enforcement", (what a dirty word) after having read some of the documentation it appears that Moodle is moving in the other direction, for example, the lesson conditions based on time spent are going by the wayside from what I can tell. It makes me believe that I am attempting to force a square peg in a round hole.
As for frustration, the students are familiar with being forced to do X, Y, and Z because that is all they have known, and it likely does cause frustration if there is not enough material in a lesson to justify the time (and the student actually reads the material). Do I justify this thinking? Not really. The regulators do not look upon our students as "learners". They are numbers, and they are either compliant or non-compliant. I think regulations are an attempt to enforce learning, but the end result is not the desired one.
Giving the student the choice to go ahead and complete the quiz prior to spending the time in the lesson was an attempt at allowing a little more freedom to the student as these particular regulations do not force the order of the items, just both conditions must be met prior to completion. I did as you suggested and took the course down a linear path, it satisfies the regulations and presents a clear path to our students.
Thank you!
Hi Amy
You know, we see this type of question/scenario a lot in the Business Users Forum here on Moodle.org. And it is just a natural organisational tension between education and training (over simplification, but you know what I mean).
Moodle does not force a specific way of working, and there are ways of creating linear content (e.g. Lessons) and conditional activities - and these do go some way towards enabling us to create defined pathways through material, and there is nothing necessarily bad about this in the correct context - a perfect example being something like Health and Safety training, or some compliance requirement.
Ultimately, in my mind, I believe that IF the content is interesting, engaging, clear, and well assessed, the linear/controlled approach has quite a small impact on the overall quality of learning. At least that's how it should be
Stu.
You know, we see this type of question/scenario a lot in the Business Users Forum here on Moodle.org. And it is just a natural organisational tension between education and training (over simplification, but you know what I mean).
Moodle does not force a specific way of working, and there are ways of creating linear content (e.g. Lessons) and conditional activities - and these do go some way towards enabling us to create defined pathways through material, and there is nothing necessarily bad about this in the correct context - a perfect example being something like Health and Safety training, or some compliance requirement.
Ultimately, in my mind, I believe that IF the content is interesting, engaging, clear, and well assessed, the linear/controlled approach has quite a small impact on the overall quality of learning. At least that's how it should be
Stu.
Thanks Amy,
Every year or so, I crawl up on the same FYI soapbox, to remind educators that many regulators maintain the view: "seat time + test score = certification".
Ooops, got to run. I do not want to be tardy to the professional development workshop "Real Innovations in Education: Flatland Revisited" and miss the signin sheet.
Chris
Every year or so, I crawl up on the same FYI soapbox, to remind educators that many regulators maintain the view: "seat time + test score = certification".
Ooops, got to run. I do not want to be tardy to the professional development workshop "Real Innovations in Education: Flatland Revisited" and miss the signin sheet.
Chris
Hi Amy,
first thanks for your explainations about your needs and your resiliency about the "wrongness"
The lesson module already keep into account 2 or 3 conditions in parallel. Your problem is that you want a Dependency of a Quiz not a lesson. A technically simple but maybe long to do solution, is to transform your quiz in a lesson.
Another solution, wich will require some modifications of the lesson, is to duplicate and to modify the code for the depedency "gradebetterthan" in the file that Joseph point to you and in mod/lesson/mod.html to add a fourth condition that will apply to the quiz results. That may require much more time than to transform your quiz in a lesson but that may be more usefull to others moodlers.
I hope it may help.
Salutations from Québec,
Bernard
first thanks for your explainations about your needs and your resiliency about the "wrongness"
The lesson module already keep into account 2 or 3 conditions in parallel. Your problem is that you want a Dependency of a Quiz not a lesson. A technically simple but maybe long to do solution, is to transform your quiz in a lesson.
Another solution, wich will require some modifications of the lesson, is to duplicate and to modify the code for the depedency "gradebetterthan" in the file that Joseph point to you and in mod/lesson/mod.html to add a fourth condition that will apply to the quiz results. That may require much more time than to transform your quiz in a lesson but that may be more usefull to others moodlers.
I hope it may help.
Salutations from Québec,
Bernard
Thank you both Bernard and Stu,
I would like to correct my previous statement about Moodle 2.0; I installed the latest preview and was happy to find that the lesson dependency on time spent is still there. I can move forward with Moodle and I'm very excited about it.
I believe the suggestion is very helpful with modifying the files and I'll try that when I'm feeling brave! I'm not an expert at code by any means but I firmly believe in the motto "Essayons".
Thanks again,
Amy
I would like to correct my previous statement about Moodle 2.0; I installed the latest preview and was happy to find that the lesson dependency on time spent is still there. I can move forward with Moodle and I'm very excited about it.
I believe the suggestion is very helpful with modifying the files and I'll try that when I'm feeling brave! I'm not an expert at code by any means but I firmly believe in the motto "Essayons".
Thanks again,
Amy