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

Public Member Functions

 is_compatible_question (question_definition $question)
 summarise_action (question_attempt_step $step)
 init_first_step (question_attempt_step $step, $variant)
 process_action (question_attempt_pending_step $pendingstep)
 get_min_fraction ()

Detailed Description

Fake question behaviour that is used when the actual behaviour is not available.

Imagine, for example, that a quiz attempt has been restored from another Moodle site with more behaviours installed, or an behaviour that used to be available in this site has been uninstalled. Obviously all we can do is have some code to prevent fatal errors.

The approach we take is: The rendering code is still implemented, as far as possible. A warning is shown that behaviour specific bits may be missing. Any attempt to process anything causes an exception to be thrown.

Definition at line 47 of file behaviour.php.


Member Function Documentation

What is the minimum fraction that can be scored for this question. Normally this will be based on $this->question->get_min_fraction(), but may be modified in some way by the model.

Returns:
number the minimum fraction when this question is attempted under this model.

Reimplemented from question_behaviour.

Definition at line 67 of file behaviour.php.

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 57 of file behaviour.php.

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.

Definition at line 49 of file behaviour.php.

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 62 of file behaviour.php.

Reimplemented from question_behaviour.

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