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

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

Detailed Description

Represents a calculated question.

Definition at line 38 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 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.

Returns:
int the number of vaiants that this question has.

Reimplemented from question_definition.

Definition at line 77 of file question.php.

Returns:
string that can be used to seed the pseudo-random selection of a variant.

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(...).

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 qtype_numerical_question.

Definition at line 53 of file question.php.


Field Documentation

$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.


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