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

Public Member Functions

 start_attempt (question_attempt_step $step, $variant)
 apply_attempt_state (question_attempt_step $step)
 get_question_summary ()
 summarise_response (array $response)
 classify_response (array $response)
 clear_wrong_from_response (array $response)
 get_num_parts_right (array $response)
 get_expected_data ()
 get_correct_response ()
 get_right_choice_for ($stemid)
 is_complete_response (array $response)
 is_gradable_response (array $response)
 get_validation_error (array $response)
 is_same_response (array $prevresponse, array $newresponse)
 grade_response (array $response)
 compute_final_grade ($responses, $totaltries)
 get_stem_order ()
 get_choice_order ()
 check_file_access ($qa, $options, $component, $filearea, $args, $forcedownload)

Data Fields

 $shufflestems
 $correctfeedback
 $correctfeedbackformat
 $partiallycorrectfeedback
 $partiallycorrectfeedbackformat
 $incorrectfeedback
 $incorrectfeedbackformat
 $stems
 $choices
 $right

Protected Member Functions

 set_choiceorder ($choiceorder)
 field ($key)

Protected Attributes

 $stemorder
 $choiceorder

Detailed Description

Represents a matching question.

Definition at line 36 of file question.php.


Member Function Documentation

When an in-progress question_attempt is re-loaded from the database, this method is called so that the question can re-initialise its internal state as needed by this attempt.

For example, the multiple choice question type needs to set the order of the choices to the order that was set up when start_attempt was called originally. All the information required to do this should be in the $step object, which is the first step of the question_attempt being loaded.

Parameters:
question_attempt_stepThe first step of the question_attempt being loaded.

Reimplemented from question_definition.

Definition at line 72 of file question.php.

Here is the call graph for this function:

check_file_access ( qa,
options,
component,
filearea,
args,
forcedownload 
)

Checks whether the users is allow to be served a particular file.

Parameters:
question_attempt$qathe question attempt being displayed.
question_display_options$optionsthe options that control display of the question.
string$componentthe name of the component we are serving files for.
string$fileareathe name of the file area.
array$argsthe remaining bits of the file path.
bool$forcedownloadwhether the user must be forced to download the file.
Returns:
bool true if the user can access this file.

Reimplemented from question_definition.

Definition at line 274 of file question.php.

Here is the call graph for this function:

classify_response ( array response)

Categorise the student's response according to the categories defined by get_possible_responses.

Parameters:
$responsea response, as might be passed to grade_response().
Returns:
array subpartid => question_classified_response objects. returns an empty array if no analysis is possible.

Reimplemented from question_with_responses.

Definition at line 118 of file question.php.

Here is the call graph for this function:

Given a response, rest the parts that are wrong.

Parameters:
array$responsea response
Returns:
array a cleaned up response with the wrong bits reset.

Reimplemented from question_definition.

Definition at line 142 of file question.php.

Here is the call graph for this function:

compute_final_grade ( responses,
totaltries 
)

Work out a final grade for this attempt, taking into account all the tries the student made.

Parameters:
array$responsesthe response for each try. Each element of this array is a response array, as would be passed to grade_response(). There may be between 1 and $totaltries responses.
int$totaltriesThe maximum number of tries allowed.
Returns:
numeric the fraction that should be awarded for this sequence of response.

Implements question_automatically_gradable_with_countback.

Definition at line 241 of file question.php.

Here is the call graph for this function:

field ( key) [protected]
Parameters:
int$keystem number
Returns:
string the question-type variable name.

Definition at line 172 of file question.php.

Here is the caller graph for this function:

Definition at line 270 of file question.php.

What data would need to be submitted to get this question correct. If there is more than one correct answer, this method should just return one possibility. If it is not possible to compute a correct response, this method should return null.

Returns:
array|null parameter name => value.

Reimplemented from question_definition.

Definition at line 184 of file question.php.

Here is the call graph for this function:

What data may be included in the form submission when a student submits this question in its current state?

This information is used in calls to optional_param. The parameter name has question_attempt::get_field_prefix() automatically prepended.

Returns:
array|string variable name => PARAM_... constant, or, as a special case that should only be used in unavoidable, the constant question_attempt::USE_RAW_DATA meaning take all the raw submitted data belonging to this question.

Reimplemented from question_definition.

Definition at line 176 of file question.php.

Here is the call graph for this function:

get_num_parts_right ( array response)

Return the number of subparts of this response that are right.

Parameters:
array$responsea response
Returns:
array with two elements, the number of correct subparts, and the total number of subparts.

Reimplemented from question_definition.

Definition at line 152 of file question.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Generate a brief, plain-text, summary of this question. This is used by various reports. This should show the particular variant of the question as presented to students. For example, the calculated quetsion type would fill in the particular numbers that were presented to the student. This method will return null if such a summary is not possible, or inappropriate.

Returns:
string|null a plain text summary of this question.

Reimplemented from question_definition.

Definition at line 89 of file question.php.

Here is the call graph for this function:

get_right_choice_for ( stemid)

Definition at line 192 of file question.php.

Here is the caller graph for this function:

Definition at line 266 of file question.php.

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.

Implements question_automatically_gradable.

Definition at line 217 of file question.php.

Here is the call graph for this function:

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.

Implements question_automatically_gradable.

Definition at line 235 of file question.php.

Here is the call graph for this function:

is_complete_response ( array response)

Used by many of the behaviours, to work out whether the student's response to the question is complete. That is, whether the question attempt should move to the COMPLETE or INCOMPLETE state.

Parameters:
array$responseresponses, as returned by question_attempt_step::get_qt_data().
Returns:
bool whether this response is a complete answer to this question.

Implements question_manually_gradable.

Definition at line 200 of file question.php.

Here is the call graph for this function:

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.

Reimplemented from question_graded_automatically.

Definition at line 208 of file question.php.

Here is the call graph for this function:

is_same_response ( array prevresponse,
array newresponse 
)

Use by many of the behaviours to determine whether the student's response has changed. This is normally used to determine that a new set of responses can safely be discarded.

Parameters:
array$prevresponsethe responses previously recorded for this question, as returned by question_attempt_step::get_qt_data()
array$newresponsethe new responses, in the same format.
Returns:
bool whether the two sets of responses are the same - that is whether the new set of responses can safely be discarded.

Implements question_manually_gradable.

Definition at line 224 of file question.php.

Here is the call graph for this function:

set_choiceorder ( choiceorder) [protected]

Helper method used by both start_attempt() and apply_attempt_state().

Parameters:
array$choiceorderthe choices, in order.

Definition at line 82 of file question.php.

Here is the caller graph for this function:

start_attempt ( question_attempt_step step,
variant 
)

Start a new attempt at this question, storing any information that will be needed later in the step.

This is where the question can do any initialisation required on a per-attempt basis. For example, this is where the multiple choice question type randomly shuffles the choices (if that option is set).

Any information about how the question has been set up for this attempt should be stored in the $step, by calling $step->set_qt_var(...).

Parameters:
question_attempt_stepThe first step of the question_attempt being started. Can be used to store state.
int$varantwhich variant of this question to start. Will be between 1 and get_num_variants() inclusive.

Reimplemented from question_definition.

Definition at line 59 of file question.php.

Here is the call graph for this function:

summarise_response ( array response)

Produce a plain text summary of a response.

Parameters:
$responsea response, as might be passed to grade_response().
Returns:
string a plain text summary of that response, that could be used in reports.

Implements question_manually_gradable.

Definition at line 103 of file question.php.

Here is the call graph for this function:


Field Documentation

$choiceorder [protected]

Definition at line 57 of file question.php.

$choices

Definition at line 50 of file question.php.

$correctfeedback

Definition at line 40 of file question.php.

$correctfeedbackformat

Definition at line 41 of file question.php.

$incorrectfeedback

Definition at line 44 of file question.php.

$incorrectfeedbackformat

Definition at line 45 of file question.php.

$partiallycorrectfeedback

Definition at line 42 of file question.php.

$partiallycorrectfeedbackformat

Definition at line 43 of file question.php.

Definition at line 52 of file question.php.

$shufflestems

Definition at line 38 of file question.php.

$stemorder [protected]

Definition at line 55 of file question.php.

$stems

Definition at line 48 of file question.php.


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