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

Public Member Functions | |
| __construct ($data=array(), $timecreated=null, $userid=null, $existingstepid=null) | |
| get_id () | |
| get_state () | |
| set_state ($state) | |
| get_fraction () | |
| set_fraction ($fraction) | |
| get_user_id () | |
| get_timecreated () | |
| has_qt_var ($name) | |
| get_qt_var ($name) | |
| set_qt_var ($name, $value) | |
| get_qt_files ($name, $contextid) | |
| prepare_response_files_draft_itemid ($name, $contextid) | |
| prepare_response_files_draft_itemid_with_text ($name, $contextid, $text) | |
| rewrite_response_pluginfile_urls ($text, $contextid, $name, $extras) | |
| get_qt_data () | |
| has_behaviour_var ($name) | |
| get_behaviour_var ($name) | |
| set_behaviour_var ($name, $value) | |
| get_behaviour_data () | |
| get_submitted_data () | |
| get_all_data () | |
Static Public Member Functions | |
| static | load_from_records ($records, $attemptstepid) |
Stores one step in a question_attempt.
The most important attributes of a step are the state, which is one of the question_state constants, the fraction, which may be null, or a number bewteen the attempt's minfraction and 1.0, and the array of submitted data, about which more later.
A step also tracks the time it was created, and the user responsible for creating it.
The submitted data is basically just an array of name => value pairs, with certain conventions about the to divide the variables into four = two times two categories.
Variables may either belong to the behaviour, in which case the name starts with a '-', or they may belong to the question type in which case they name does not start with a '-'.
Second, variables may either be ones that came form the original request, in which case the name does not start with an _, or they are cached values that were created during processing, in which case the name does start with an _.
That is, each name will start with one of '', '_'. '-' or '-_'. The remainder of the name should match the regex [a-z][a-z0-9]*.
These variables can be accessed with get_behaviour_var() and get_qt_var(),
Definition at line 66 of file questionattemptstep.php.
| __construct | ( | $ | data = array(), |
| $ | timecreated = null, |
||
| $ | userid = null, |
||
| $ | existingstepid = null |
||
| ) |
You should not need to call this constructor in your own code. Steps are normally created by question_attempt methods like question_attempt::process_action().
| array | $data | the submitted data that defines this step. |
| int | $timestamp | the time to record for the action. (If not given, use now.) |
| int | $userid | the user to attribute the aciton to. (If not given, use the current user.) |
| int | $existingstepid | if this step is going to replace an existing step (for example, during a regrade) this is the id of the previous step we are replacing. |
Definition at line 104 of file questionattemptstep.php.

| get_all_data | ( | ) |
Get all the data. behaviour variables have the - at the start of their name. This is only intended for internal use, for example by question_engine_data_mapper::insert_question_attempt_step(), however, it can ocasionally be useful in test code. It should not be considered part of the public API of this class.
| array | name => value pairs. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 365 of file questionattemptstep.php.

Get all the behaviour variables.
| array | name => value pairs. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 329 of file questionattemptstep.php.
| get_behaviour_var | ( | $ | name | ) |
| string | $name | the name of an behaviour variable to look for in the submitted data. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 305 of file questionattemptstep.php.


| get_fraction | ( | ) |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 154 of file questionattemptstep.php.

| get_id | ( | ) |
Definition at line 133 of file questionattemptstep.php.

| get_qt_data | ( | ) |
Get all the question type variables.
| array | name => value pairs. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 283 of file questionattemptstep.php.

| get_qt_files | ( | $ | name, |
| $ | contextid | ||
| ) |
Get the latest set of files for a particular question type variable of type question_attempt::PARAM_FILES.
| string | $name | the name of the associated variable. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 215 of file questionattemptstep.php.

| get_qt_var | ( | $ | name | ) |
| string | $name | the name of a question type variable to look for in the submitted data. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 188 of file questionattemptstep.php.


| get_state | ( | ) |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 138 of file questionattemptstep.php.

Get all the submitted data, but not the cached data. behaviour variables have the - at the start of their name. This is only really intended for use by question_attempt::regrade(), it should not be considered part of the public API.
| array | name => value pairs. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 346 of file questionattemptstep.php.

| get_timecreated | ( | ) |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 172 of file questionattemptstep.php.

| get_user_id | ( | ) |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 167 of file questionattemptstep.php.

| has_behaviour_var | ( | $ | name | ) |
| string | $name | the name of an behaviour variable to look for in the submitted data. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 297 of file questionattemptstep.php.

| has_qt_var | ( | $ | name | ) |
| string | $name | the name of a question type variable to look for in the submitted data. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 180 of file questionattemptstep.php.

| static load_from_records | ( | $ | records, |
| $ | attemptstepid | ||
| ) | [static] |
Create a question_attempt_step from records loaded from the database.
| Iterator | $records | Raw records loaded from the database. |
| int | $stepid | The id of the records to extract. |
Definition at line 375 of file questionattemptstep.php.


| prepare_response_files_draft_itemid | ( | $ | name, |
| $ | contextid | ||
| ) |
Prepare a draft file are for the files belonging the a response variable of this step.
| string | $name | the variable name the files belong to. |
| int | $contextid | the id of the context the quba belongs to. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 240 of file questionattemptstep.php.

| prepare_response_files_draft_itemid_with_text | ( | $ | name, |
| $ | contextid, | ||
| $ | text | ||
| ) |
Prepare a draft file are for the files belonging the a response variable of this step, while rewriting the URLs in some text.
| string | $name | the variable name the files belong to. |
| int | $contextid | the id of the context the quba belongs to. |
| string | $text | the text to update the URLs in. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 255 of file questionattemptstep.php.


| rewrite_response_pluginfile_urls | ( | $ | text, |
| $ | contextid, | ||
| $ | name, | ||
| $ | extras | ||
| ) |
Rewrite the @PLUGINFILE@ tokens in a response variable from this step that contains links to file. Normally you should probably call question_attempt::rewrite_response_pluginfile_urls() instead of calling this method directly.
| string | $text | the text to update the URLs in. |
| int | $contextid | the id of the context the quba belongs to. |
| string | $name | the variable name the files belong to. |
| array | $extra | extra file path components. |
Reimplemented in question_attempt_step_subquestion_adapter.
Definition at line 274 of file questionattemptstep.php.


| set_behaviour_var | ( | $ | name, |
| $ | value | ||
| ) |
Set a cached behaviour variable.
| string | $name | the name of the variable to set. Must match _[a-z][a-z0-9]*. |
| string | $value | the value to set. |
Reimplemented in question_attempt_step_subquestion_adapter, and question_attempt_step_read_only.
Definition at line 317 of file questionattemptstep.php.

| set_fraction | ( | $ | fraction | ) |
Set the fraction. Normally only called by behaviours.
| null | number | $fraction | the fraction to set. |
Reimplemented in question_attempt_step_subquestion_adapter, and question_attempt_step_read_only.
Definition at line 162 of file questionattemptstep.php.

| set_qt_var | ( | $ | name, |
| $ | value | ||
| ) |
Set a cached question type variable.
| string | $name | the name of the variable to set. Must match _[a-z][a-z0-9]*. |
| string | $value | the value to set. |
Reimplemented in question_attempt_step_subquestion_adapter, and question_attempt_step_read_only.
Definition at line 200 of file questionattemptstep.php.

| set_state | ( | $ | state | ) |
Set the state. Normally only called by behaviours.
| question_state | $state | one of the question_state constants. |
Reimplemented in question_attempt_step_subquestion_adapter, and question_attempt_step_read_only.
Definition at line 146 of file questionattemptstep.php.
