|
Moodle
2.2.1
http://www.collinsharper.com
|


Public Member Functions | |
| start_attempt (question_attempt_step $step, $variant) | |
| apply_attempt_state (question_attempt_step $step) | |
| calculate_all_expressions () | |
| get_num_variants () | |
| get_variants_selection_seed () | |
Data Fields | |
| $datasetloader | |
| $vs | |
| $synchronised | |
Represents a calculated question.
Definition at line 38 of file question.php.
| apply_attempt_state | ( | question_attempt_step $ | step | ) |
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.
| question_attempt_step | The first step of the question_attempt being loaded. |
Reimplemented from qtype_numerical_question.
Definition at line 58 of file question.php.
Replace all the expression in the question definition with the values computed from the selected dataset by calling $this->vs->calculate() and $this->vs->replace_expressions_in_text() on the parts of the question that require it.
Implements qtype_calculated_question_with_expressions.
Definition at line 63 of file question.php.
| get_num_variants | ( | ) |
Reimplemented from question_definition.
Definition at line 77 of file question.php.
Reimplemented from question_definition.
Definition at line 81 of file question.php.
| 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(...).
| question_attempt_step | The first step of the question_attempt being started. Can be used to store state. | |
| int | $varant | which variant of this question to start. Will be between 1 and get_num_variants() inclusive. |
Reimplemented from qtype_numerical_question.
Definition at line 53 of file question.php.
| $datasetloader |
Definition at line 42 of file question.php.
| $synchronised |
Definition at line 51 of file question.php.
| $vs |
Definition at line 45 of file question.php.