Quiz access rule sub-plugins
Quiz access rule sub-plugins extend the ability to add conditions a user must meet to attempt a given quiz.
The following rules are readily available as part of Moodle core:
quizaccess_delaybetweenattempts
quizaccess_ipaddress
quizaccess_numattempts
quizaccess_offlineattempts
quizaccess_openclosedate
quizaccess_password
quizaccess_seb
quizaccess_securewindow
quizaccess_timelimit
File structure
Quiz access rule sub-plugins are located in the /mod/quiz/accessrule
directory. A plugin should not include any custom files outside of it's own plugin folder.
Each plugin is in a separate subdirectory and consists of a number of mandatory files and any other files the developer is going to use.
View an example directory layout for the quizaccess_delaybetweenattempts
plugin.
Some of the important files for the format plugintype are described below. See the common plugin files documentation for details of other files which may be useful in your plugin.
rule.php
Rule definition class
File path: /rule.php
The rule class defines the behaviour of your rule and how it will restrict access for users attempting a quiz.
Please refer to the inline phpdocs of the mod_quiz::access_rule_base class for detailed descriptions of the functions and meaning.
View example
Rule definition class with override
File path: /rule.php
Most quiz settings can be overridden on a per user and/or group level and you can extend this ability to your rule as well. To make your rule overridable, you must implement the rule_overridable
interface in your rule class definition.
Please refer to the inline phpdocs of the mod_quiz::rule_overridable interface for detailed descriptions of the functions and meaning.
View example
Implementing rule_overridable
is not required but can enhance the usability of the rule.