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

Public Member Functions

 __construct (question_usage_by_activity $quba)
 notify_modified ()
 notify_attempt_modified (question_attempt $qa)
 notify_attempt_added (question_attempt $qa)
 notify_step_added (question_attempt_step $step, question_attempt $qa, $seq)
 notify_step_modified (question_attempt_step $step, question_attempt $qa, $seq)
 notify_step_deleted (question_attempt_step $step, question_attempt $qa)
 save (question_engine_data_mapper $dm)

Protected Member Functions

 is_step_added (question_attempt_step $step)
 is_step_modified (question_attempt_step $step)
 is_step_deleted (question_attempt_step $step)

Protected Attributes

 $quba
 $modified = false
 $attemptsmodified = array()
 $attemptsadded = array()
 $stepsadded = array()
 $stepsmodified = array()
 $stepsdeleted = array()

Detailed Description

Implementation of the unit of work pattern for the question engine.

See http://martinfowler.com/eaaCatalog/unitOfWork.html. This tracks all the changes to a question_usage_by_activity, and its constituent parts, so that the changes can be saved to the database when save() is called.

Definition at line 1006 of file datalib.php.


Constructor & Destructor Documentation

Constructor.

Parameters:
question_usage_by_activity$qubathe usage to track.

Definition at line 1047 of file datalib.php.


Member Function Documentation

is_step_added ( question_attempt_step step) [protected]
Parameters:
question_attempt_step$stepa step
Returns:
int|false if the step is in the list of steps to be added, return the key, otherwise return false.

Definition at line 1145 of file datalib.php.

Here is the caller graph for this function:

is_step_deleted ( question_attempt_step step) [protected]
Parameters:
question_attempt_step$stepa step
Returns:
bool whether the step is in the list of steps to be deleted.

Definition at line 1174 of file datalib.php.

Here is the caller graph for this function:

is_step_modified ( question_attempt_step step) [protected]
Parameters:
question_attempt_step$stepa step
Returns:
int|false if the step is in the list of steps to be modified, return the key, otherwise return false.

Definition at line 1160 of file datalib.php.

Here is the caller graph for this function:

Called when a new question attempt is added to this usage.

Parameters:
question_attempt$qathe newly added question attempt.

Implements question_usage_observer.

Definition at line 1062 of file datalib.php.

Here is the call graph for this function:

Called when the fields of a question attempt in this usage are modified.

Parameters:
question_attempt$qathe newly added question attempt.

Implements question_usage_observer.

Definition at line 1055 of file datalib.php.

Here is the call graph for this function:

Called when a field of the question_usage_by_activity is changed.

Implements question_usage_observer.

Definition at line 1051 of file datalib.php.

notify_step_added ( question_attempt_step step,
question_attempt qa,
seq 
)

Called when a new step is added to a question attempt in this usage.

Parameters:
question_attempt_step$stepthe new step.
question_attempt$qathe usage it is being added to.
int$seqthe sequence number of the new step.

Implements question_usage_observer.

Definition at line 1066 of file datalib.php.

Here is the call graph for this function:

Called when a new step is updated in a question attempt in this usage.

Parameters:
question_attempt_step$stepthe step to delete.
question_attempt$qathe usage it is being added to.

Implements question_usage_observer.

Definition at line 1118 of file datalib.php.

Here is the call graph for this function:

Called when a new step is updated in a question attempt in this usage.

Parameters:
question_attempt_step$stepthe step that was updated.
question_attempt$qathe usage it is being added to.
int$seqthe sequence number of the new step.

Implements question_usage_observer.

Definition at line 1097 of file datalib.php.

Here is the call graph for this function:

Write all the changes we have recorded to the database.

Parameters:
question_engine_data_mapper$dmthe mapper to use to update the database.

Definition at line 1187 of file datalib.php.

Here is the call graph for this function:


Field Documentation

$attemptsadded = array() [protected]

Definition at line 1023 of file datalib.php.

$attemptsmodified = array() [protected]

Definition at line 1017 of file datalib.php.

$modified = false [protected]

Definition at line 1011 of file datalib.php.

$quba [protected]

Definition at line 1008 of file datalib.php.

$stepsadded = array() [protected]

Definition at line 1029 of file datalib.php.

$stepsdeleted = array() [protected]

Definition at line 1041 of file datalib.php.

$stepsmodified = array() [protected]

Definition at line 1035 of file datalib.php.


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