Moodle  2.2.1
http://www.collinsharper.com
question_automatically_gradable Interface Reference
Inheritance diagram for question_automatically_gradable:
Collaboration diagram for question_automatically_gradable:

Public Member Functions

 is_gradable_response (array $response)
 get_validation_error (array $response)
 grade_response (array $response)
 get_hint ($hintnumber, question_attempt $qa)
 get_right_answer_summary ()

Detailed Description

Interface that a question_definition must implement to be usable by the various automatic grading behaviours.

Definition at line 470 of file questionbase.php.


Member Function Documentation

get_hint ( hintnumber,
question_attempt qa 
)

Get one of the question hints. The question_attempt is passed in case the question type wants to do something complex. For example, the multiple choice with multiple responses question type will turn off most of the hint options if the student has selected too many opitions.

Parameters:
int$hintnumberWhich hint to display. Indexed starting from 0
question_attempt$qaThe question_attempt.

Implemented in question_graded_automatically, qtype_multichoice_multi_question, and qtype_missingtype_question.

Generate a brief, plain-text, summary of the correct answer to this question. This is used by various reports, and can also be useful when testing. This method will return null if such a summary is not possible, or inappropriate.

Returns:
string|null a plain text summary of the right answer to this question.

Implemented in question_graded_automatically, and qtype_missingtype_question.

get_validation_error ( array response)

In situations where is_gradable_response() returns false, this method should generate a description of what the problem is.

Returns:
string the message.

Implemented in qtype_multichoice_multi_question, qtype_multichoice_single_question, qtype_match_question, qtype_multianswer_question, qtype_numerical_question, qtype_truefalse_question, qtype_shortanswer_question, and qtype_missingtype_question.

grade_response ( array response)

Grade a response to the question, returning a fraction between get_min_fraction() and 1.0, and the corresponding question_state right, partial or wrong.

Parameters:
array$responseresponses, as returned by question_attempt_step::get_qt_data().
Returns:
array (number, integer) the fraction, and the state.

Implemented in question_graded_by_strategy, qtype_multichoice_multi_question, qtype_match_question, qtype_numerical_question, qtype_multianswer_question, qtype_multichoice_single_question, qtype_truefalse_question, and qtype_missingtype_question.

Here is the caller graph for this function:

is_gradable_response ( array response)

Use by many of the behaviours to determine whether the student has provided enough of an answer for the question to be graded automatically, or whether it must be considered aborted.

Parameters:
array$responseresponses, as returned by question_attempt_step::get_qt_data().
Returns:
bool whether this response can be graded.

Implemented in question_graded_automatically, qtype_multichoice_multi_question, qtype_match_question, qtype_multichoice_single_question, qtype_multianswer_question, qtype_numerical_question, and qtype_missingtype_question.


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