|
Moodle
2.2.1
http://www.collinsharper.com
|
This class keeps track of the various access rules that apply to a particular quiz, with convinient methods for seeing whether access is allowed.
Definition at line 37 of file accessmanager.php.
| __construct | ( | $ | quizobj, |
| $ | timenow, | ||
| $ | canignoretimelimits | ||
| ) |
Create an instance for a particular quiz.
| object | $quizobj | An instance of the class quiz from attemptlib.php. The quiz we will be controlling access to. |
| int | $timenow | The time to use as 'now'. |
| bool | $canignoretimelimits | Whether this user is exempt from time limits (has_capability('mod/quiz:ignoretimelimits', ...)). |
Definition at line 53 of file accessmanager.php.

| accumulate_messages | ( | $ | messages, |
| $ | new | ||
| ) | [protected] |
Accumulates an array of messages.
| array | $messages | the current list of messages. |
| string | array | $new | the new messages or messages. |
Definition at line 252 of file accessmanager.php.

| static add_settings_form_fields | ( | mod_quiz_mod_form $ | quizform, |
| MoodleQuickForm $ | mform | ||
| ) | [static] |
Add any form fields that the access rules require to the settings form.
Note that the standard plugins do not use this mechanism, becuase all their settings are stored in the quiz table.
| mod_quiz_mod_form | $quizform | the quiz settings form that is being built. |
| MoodleQuickForm | $mform | the wrapped MoodleQuickForm. |
Definition at line 105 of file accessmanager.php.

Definition at line 423 of file accessmanager.php.

| back_to_view_page | ( | $ | output, |
| $ | message = '' |
||
| ) |
Send the user back to the quiz view page. Normally this is just a redirect, but If we were in a secure window, we close this window, and reload the view window we came from.
This method does not return;
| mod_quiz_renderer | $output | the quiz renderer. |
| string | $message | optional message to output while redirecting. |
Definition at line 453 of file accessmanager.php.

Inform the rules that the current attempt is finished. This is use, for example by the password rule, to clear the flag in the session.
Definition at line 357 of file accessmanager.php.
| describe_rules | ( | ) |
Provide a description of the rules that apply to this quiz, such as is shown at the top of the quiz view page. Note that not all rules consider themselves important enough to output a description.
Definition at line 269 of file accessmanager.php.

Definition at line 238 of file accessmanager.php.
| static get_browser_security_choices | ( | ) | [static] |
The the options for the Browser security settings menu.
Definition at line 118 of file accessmanager.php.

| static get_load_sql | ( | $ | quizid, |
| $ | rules, | ||
| $ | basefields | ||
| ) | [static, protected] |
Build the SQL for loading all the access settings in one go.
| int | $quizid | the quiz id. |
| string | $basefields | initial part of the select list. |
Definition at line 150 of file accessmanager.php.

Definition at line 436 of file accessmanager.php.

| get_preflight_check_form | ( | moodle_url $ | url, |
| $ | attemptid | ||
| ) |
Build the form required to do the pre-flight checks.
| moodle_url | $url | the form action URL. |
| int | null | $attemptid | the id of the current attempt, if there is one, otherwise null. |
Definition at line 335 of file accessmanager.php.

| static get_rule_classes | ( | ) | [static, protected] |
Definition at line 92 of file accessmanager.php.


| is_finished | ( | $ | numprevattempts, |
| $ | lastattempt | ||
| ) |
Do any of the rules mean that this student will no be allowed any further attempts at this quiz. Used, for example, to change the label by the grade displayed on the view page from 'your current grade is' to 'your final grade is'.
| int | $numattempts | the number of previous attempts this user has made. |
| object | $lastattempt | information about the user's last completed attempt. |
Definition at line 373 of file accessmanager.php.
| is_preflight_check_required | ( | $ | attemptid | ) |
| int | null | $attemptid | the id of the current attempt, if there is one, otherwise null. |
Definition at line 319 of file accessmanager.php.
| static load_quiz_and_settings | ( | $ | quizid | ) | [static] |
Load the quiz settings and any settings required by the access rules. We try to do this with a single DB query.
Note that the standard plugins do not use this mechanism, becuase all their settings are stored in the quiz table.
| int | $quizid | the quiz id. |
Definition at line 218 of file accessmanager.php.


| static load_settings | ( | $ | quizid | ) | [static] |
Load any settings required by the access rules. We try to do this with a single DB query.
Note that the standard plugins do not use this mechanism, becuase all their settings are stored in the quiz table.
| int | $quizid | the quiz id. |
Definition at line 189 of file accessmanager.php.


| make_review_link | ( | $ | attempt, |
| $ | reviewoptions, | ||
| $ | output | ||
| ) |
Make some text into a link to review the quiz, if that is appropriate.
| string | $linktext | some text. |
| object | $attempt | the attempt object |
Definition at line 470 of file accessmanager.php.

| make_rules | ( | $ | quizobj, |
| $ | timenow, | ||
| $ | canignoretimelimits | ||
| ) | [protected] |
Make all the rules relevant to a particular quiz.
| quiz | $quizobj | information about the quiz in question. |
| int | $timenow | the time that should be considered as 'now'. |
| bool | $canignoretimelimits | whether the current user is exempt from time limits by the mod/quiz:ignoretimelimits capability. |
Definition at line 67 of file accessmanager.php.

| notify_preflight_check_passed | ( | $ | attemptid | ) |
The pre-flight check has passed. This is a chance to record that fact in some way.
| int | null | $attemptid | the id of the current attempt, if there is one, otherwise null. |
Definition at line 347 of file accessmanager.php.
| prevent_access | ( | ) |
Whether the user should be blocked from starting a new attempt or continuing an attempt now. If there are any restrictions in force now, return an array of reasons why access should be blocked. If access is OK, return false.
Definition at line 305 of file accessmanager.php.

| prevent_new_attempt | ( | $ | numprevattempts, |
| $ | lastattempt | ||
| ) |
Whether or not a user should be allowed to start a new attempt at this quiz now. If there are any restrictions in force now, return an array of reasons why access should be blocked. If access is OK, return false.
| int | $numattempts | the number of previous attempts this user has made. |
| object | false | $lastattempt | information about the user's last completed attempt. if there is not a previous attempt, the false is passed. |
Definition at line 288 of file accessmanager.php.

| static save_settings | ( | $ | quiz | ) | [static] |
Save any submitted settings when the quiz settings form is submitted.
Note that the standard plugins do not use this mechanism, becuase all their settings are stored in the quiz table.
| object | $quiz | the data from the quiz form, including $quiz->id which is the is of the quiz being saved. |
Definition at line 135 of file accessmanager.php.

| setup_attempt_page | ( | $ | page | ) |
Sets up the attempt (review or summary) page with any properties required by the access rules.
| moodle_page | $page | the page object to initialise. |
Definition at line 388 of file accessmanager.php.
| show_attempt_timer_if_needed | ( | $ | attempt, |
| $ | timenow, | ||
| $ | output | ||
| ) |
Will cause the attempt time to start counting down after the page has loaded, if that is necessary.
| object | $attempt | the data from the relevant quiz_attempts row. |
| int | $timenow | the time to consider as 'now'. |
| mod_quiz_renderer | $output | the quiz renderer. |
Definition at line 402 of file accessmanager.php.
$quizobj [protected] |
Definition at line 39 of file accessmanager.php.
$rules = array() [protected] |
Definition at line 43 of file accessmanager.php.
$timenow [protected] |
Definition at line 41 of file accessmanager.php.