Moodle  2.2.1
http://www.collinsharper.com
quizaccess_numattempts Class Reference
Inheritance diagram for quizaccess_numattempts:
Collaboration diagram for quizaccess_numattempts:

Public Member Functions

 description ()
 prevent_new_attempt ($numprevattempts, $lastattempt)
 is_finished ($numprevattempts, $lastattempt)

Static Public Member Functions

static make (quiz $quizobj, $timenow, $canignoretimelimits)

Detailed Description

A rule controlling the number of attempts allowed.

Definition at line 38 of file rule.php.


Member Function Documentation

Information, such as might be shown on the quiz view page, relating to this restriction. There is no obligation to return anything. If it is not appropriate to tell students about this rule, then just return ''.

Returns:
mixed a message, or array of messages, explaining the restriction (may be '' if no message is appropriate).

Reimplemented from quiz_access_rule_base.

Definition at line 49 of file rule.php.

is_finished ( numprevattempts,
lastattempt 
)

If this rule can determine that this user will never be allowed another attempt at this quiz, then return true. This is used so we can know whether to display a final grade on the view page. This will only be called if there is not a currently active attempt for this user.

Parameters:
int$numattemptsthe number of previous attempts this user has made.
object$lastattemptinformation about the user's last completed attempt.
Returns:
bool true if this rule means that this user will never be allowed another attempt at this quiz.

Reimplemented from quiz_access_rule_base.

Definition at line 60 of file rule.php.

static make ( quiz quizobj,
timenow,
canignoretimelimits 
) [static]

Return an appropriately configured instance of this rule, if it is applicable to the given quiz, otherwise return null.

Parameters:
quiz$quizobjinformation about the quiz in question.
int$timenowthe time that should be considered as 'now'.
bool$canignoretimelimitswhether the current user is exempt from time limits by the mod/quiz:ignoretimelimits capability.
Returns:
quiz_access_rule_base|null the rule, if applicable, else null.

Reimplemented from quiz_access_rule_base.

Definition at line 40 of file rule.php.

Here is the call graph for this function:

prevent_new_attempt ( numprevattempts,
lastattempt 
)

Whether or not a user should be allowed to start a new attempt at this quiz now.

Parameters:
int$numattemptsthe number of previous attempts this user has made.
object$lastattemptinformation about the user's last completed attempt.
Returns:
string false if access should be allowed, a message explaining the reason if access should be prevented.

Reimplemented from quiz_access_rule_base.

Definition at line 53 of file rule.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations