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

Public Member Functions

 is_compatible_question (question_definition $question)
 get_right_answer_summary ()
 adjust_display_options (question_display_options $options)
 get_applicable_hint ()
 get_expected_data ()
 get_expected_qt_data ()
 get_state_string ($showcorrectness)
 init_first_step (question_attempt_step $step, $variant)
 process_action (question_attempt_pending_step $pendingstep)
 summarise_action (question_attempt_step $step)
 process_try_again (question_attempt_pending_step $pendingstep)
 process_submit (question_attempt_pending_step $pendingstep)
 process_finish (question_attempt_pending_step $pendingstep)
 process_save (question_attempt_pending_step $pendingstep)

Data Fields

const IS_ARCHETYPAL = true
const READONLY_EXCEPT_TRY_AGAIN = 23485299

Protected Member Functions

 is_try_again_state ()
 adjust_fraction ($fraction, question_attempt_pending_step $pendingstep)

Detailed Description

Question behaviour for the interactive model.

Each question has a submit button next to it which the student can use to submit it. Once the qustion is submitted, it is not possible for the student to change their answer any more, but the student gets full feedback straight away.

Definition at line 42 of file behaviour.php.


Member Function Documentation

Make any changes to the display options before a question is rendered, so that it can be displayed in a way that is appropriate for the statue it is currently in. For example, by default, if the question is finished, we ensure that it is only ever displayed read-only.

Parameters:
question_display_options$optionsthe options to adjust. Just change the properties of this object - objects are passed by referece.

Reimplemented from question_behaviour.

Definition at line 72 of file behaviour.php.

Here is the call graph for this function:

adjust_fraction ( fraction,
question_attempt_pending_step pendingstep 
) [protected]

Reimplemented in qbehaviour_interactivecountback.

Definition at line 211 of file behaviour.php.

Here is the caller graph for this function:

Get the most applicable hint for the question in its current state.

Returns:
question_hint the most applicable hint, or null, if none.

Reimplemented from question_behaviour.

Definition at line 98 of file behaviour.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Return an array of the behaviour variables that could be submitted as part of a question of this type, with their types, so they can be properly cleaned.

Returns:
array variable name => PARAM_... constant.

Reimplemented from question_behaviour.

Definition at line 106 of file behaviour.php.

Here is the call graph for this function:

Return an array of question type variables for the question in its current state. Normally, if adjust_display_options() would set question_display_options::$readonly to true, then this method should return an empty array, otherwise it should return $this->question->get_expected_data(). Thus, there should be little need to override this method.

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

Definition at line 119 of file behaviour.php.

Here is the call graph for this function:

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.

Reimplemented from question_behaviour.

Definition at line 59 of file behaviour.php.

get_state_string ( showcorrectness)

Generate a brief textual description of the current state of the question, normally displayed under the question number.

Parameters:
bool$showcorrectnessWhether right/partial/wrong states should be distinguised.
Returns:
string a brief summary of the current state of the qestion attempt.

Reimplemented from question_behaviour.

Definition at line 127 of file behaviour.php.

Here is the call graph for this function:

init_first_step ( question_attempt_step step,
variant 
)

Initialise the first step in a question attempt when a new question_attempt is being started.

This method must call $this->question->start_attempt($step), and may perform additional processing if the model requries it.

Parameters:
question_attempt_step$stepthe first step of the question_attempt being started.
int$variantwhich variant of the question to use.

Reimplemented from question_behaviour.

Definition at line 141 of file behaviour.php.

Here is the call graph for this function:

Some behaviours can only work with certing types of question. This method allows the behaviour to verify that a question is compatible.

This implementation is only provided for backwards-compatibility. You should override this method if you are implementing a behaviour.

Parameters:
question_definition$questionthe question.

Reimplemented from question_behaviour.

Reimplemented in qbehaviour_interactivecountback.

Definition at line 55 of file behaviour.php.

is_try_again_state ( ) [protected]
Returns:
bool are we are currently in the try_again state.

Definition at line 66 of file behaviour.php.

Here is the caller graph for this function:

The main entry point for processing an action.

All the various operations that can be performed on a question_attempt get channeled through this function, except for question_attempt::start() which goes to init_first_step(). question_attempt::finish() becomes an action with im vars finish => 1, and manual comment/grade becomes an action with im vars comment => comment text, and mark => ..., max_mark => ... if the question is graded.

This method should first determine whether the action is significant. For example, if no actual action is being performed, but instead the current responses are being saved, and there has been no change since the last set of responses that were saved, this the action is not significatn. In this case, this method should return question_attempt::DISCARD. Otherwise it should return question_attempt::KEEP.

If the action is significant, this method should also perform any necessary updates to $pendingstep. For example, it should call question_attempt_step::set_state() to set the state that results from this action, and if this is a grading action, it should call question_attempt_step::set_fraction().

This method can also call question_attempt_step::set_behaviour_var() to store additional infomation. There are two main uses for this. This can be used to store the result of any randomisation done. It is important to store the result of randomisation once, and then in future use the same outcome if the actions are ever replayed. This is how regrading works. The other use is to cache the result of expensive computations performed on the raw response data, so that subsequent display and review of the question does not have to repeat the same expensive computations.

Often this method is implemented as a dispatching method that examines the pending step to determine the kind of action being performed, and then calls a more specific method like process_save() or process_comment(). Look at some of the standard behaviours for examples.

Parameters:
question_attempt_pending_step$pendingstepa partially initialised step containing all the information about the action that is being peformed. This information can be accessed using question_attempt_step::get_behaviour_var().
Returns:
bool either question_attempt::KEEP or question_attempt::DISCARD

Reimplemented from question_behaviour.

Definition at line 146 of file behaviour.php.

Here is the call graph for this function:

Definition at line 220 of file behaviour.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Implementation of processing a save action that should be suitable for most subclasses.

Parameters:
question_attempt_pending_step$pendingstepa partially initialised step containing all the information about the action that is being peformed.
Returns:
bool either question_attempt::KEEP or question_attempt::DISCARD

Reimplemented from question_behaviour_with_save.

Definition at line 238 of file behaviour.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 186 of file behaviour.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 181 of file behaviour.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from question_behaviour.

Definition at line 167 of file behaviour.php.

Here is the call graph for this function:


Field Documentation

Reimplemented from question_behaviour.

Reimplemented in qbehaviour_interactivecountback.

Definition at line 43 of file behaviour.php.

const READONLY_EXCEPT_TRY_AGAIN = 23485299

Definition at line 53 of file behaviour.php.


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