Restrict the Quiz Time Limit

Restrict the Quiz Time Limit

by Colin Tennyson -
Number of replies: 6

Hello Moodle users,

I have an odd scenario and looking for some adivce.

I manage a Moodle system where we host several governing mandated programs. These programs allow for certain time limits for each quiz\test and exam. Even though I have set the individual exam "time limit" our instructors can still edit the quiz "time limit" option. ( Resulting in a compliance issue )

Does Moodle have any option where I can hard code the exam time limit and the instructor cannot edit\alter ?

thanks


Average of ratings: -
In reply to Colin Tennyson

Re: Restrict the Quiz Time Limit

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Not as standard.

If you really need this, you could develop a new quiz access rule plugin. https://docs.moodle.org/dev/Quiz_access_rules
In reply to Tim Hunt

Re: Restrict the Quiz Time Limit

by Colin Tennyson -
Thanks Tim.

I would require a set time limit for each quiz, which could not be edited. Does that make sense ?
In reply to Colin Tennyson

Re: Restrict the Quiz Time Limit

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Right, so the kind of thing your access rule plugin could do is:

  1. Define a new capability quizaccess:locktimelimit:canedit - only given to Manager role by default (or whatever you want).
  2. In the add_settings_form_fields method, I think you just need to do something like:
    if (!has_capability('quizaccess:locktimelimit:canedit', $quizform->get_context()) {
    $mform->hardFreeze('timelimit');
    }
In fact, I think that is all you need. Then you can use roles to control who can edit quiz time limits.

In reply to Tim Hunt

Re: Restrict the Quiz Time Limit

by Colin Tennyson -
Hi Tim - Appreciate your response.

Where would I add this capability for Managers ?
Any additional guidance or steps would be great !

Thanks
In reply to Colin Tennyson

Re: Restrict the Quiz Time Limit

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, you do need to know the basics of creating a Moodle plugin, before you can then follow the specifics of creating a quiz access rule. Fortunately, there is now a 'Moodle Plugin Development Basics' course at https://learn.moodle.org.
Average of ratings: Useful (1)
In reply to Colin Tennyson

Re: Restrict the Quiz Time Limit

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
"Even though I have set the individual exam "time limit" our instructors can still edit the quiz "time limit" option. ( Resulting in a compliance issue)"

Might you tell your instructors "Don't do that!" Or "If you change the quiz time, you will be fined for non-compliance and your paycheck will be lower."