Issue Options: Required minutes in course...where does it verify the information?

Issue Options: Required minutes in course...where does it verify the information?

by Cindy Weber -
Number of replies: 3

If minutes are required before the 2.4 certificate is issued, where does the certificate module verify 'time spent'?..a database entry, first access? where?   

Average of ratings: -
In reply to Cindy Weber

Re: Issue Options: Required minutes in course...where does it verify the information?

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Cindy,

There is a field in the certificate table called 'requiredtime' that sets this value. This is then checked in view.php to ensure that the time has been met. However, if the user has the capability 'mod/certificate:manage' then the time is ignored and they are allowed access.

Regards,

Mark

In reply to Mark Nelson

Re: Issue Options: Required minutes in course...where does it verify the information?

by Cindy Weber -

Thank you Mark!  So how does the certificate module know how long the user has been logged in? I want my students (or at least the administrator) to be able to check their time and see if they have been in the course long enough to generate a certificate.  With courses 90 hours long, with certificates that can't be generated for 12 days, I want them to be able to verify their time.  I first had them click on their name and look at their profile for a time, but the first access....last access was a little confusing.  I didn't know for sure when they were getting logged out.   I then used the 'attendance register' because that allowed them to log time when they were reading offline.  I didn't think that the certificate's 'required time' would use it though.  Do you have a suggestion that will enable a student (or even the administrator) to check (or even tweak by the administrator) the time logged by a students so we know when the student is able to print a certificate?

I have included your code, because I thought maybe you could use it to give me a hint about where it is verifying the student's time against the required time.

/ Check if the user can view the certificate
if ($certificate->requiredtime && !has_capability('mod/certificate:manage', $context)) {
    if (certificate_get_course_time($course->id) < ($certificate->requiredtime * 60)) {
        $a = new stdClass;
        $a->requiredtime = $certificate->requiredtime;
        notice(get_string('requiredtimenotmet', 'certificate', $a), "$CFG->wwwroot/course/view.php?id=$course->id");
        die;
    }
}

In reply to Cindy Weber

Re: Issue Options: Required minutes in course...where does it verify the information?

by Mark Nelson -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Cindy,

There is no way to get an exact time the user has spent. Currently it looks at the log table and adds the time between any course actions in the log table per session. Please view the function certificate_get_course_time for more detail.

Regards,

Mark