Restrict the Quiz Time Limit

Restrict the Quiz Time Limit

Colin Tennyson -
回帖数: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


回复Colin Tennyson

Re: Restrict the Quiz Time Limit

Tim Hunt -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 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
回复Tim Hunt

Re: Restrict the Quiz Time Limit

Colin Tennyson -
Thanks Tim.

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

Re: Restrict the Quiz Time Limit

Tim Hunt -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 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.

回复Tim Hunt

Re: Restrict the Quiz Time Limit

Colin Tennyson -
Hi Tim - Appreciate your response.

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

Thanks
回复Colin Tennyson

Re: Restrict the Quiz Time Limit

Tim Hunt -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 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.
回复Colin Tennyson

Re: Restrict the Quiz Time Limit

Rick Jerz -
Particularly helpful Moodlers的头像 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."