Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
|
A subclass of question_attempt_step used when processing a new submission. More...
Public Member Functions | |
get_all_data () | |
Get all the data. More... | |
get_behaviour_data () | |
Get all the behaviour variables. More... | |
get_behaviour_var ($name) | |
get_fraction () | |
get_id () | |
get_metadata_var ($name) | |
Get a metadata variable. More... | |
get_new_response_summary () | |
Get the new response summary, if there is one. More... | |
get_new_variant_number () | |
Get the new variant number, if there is one. More... | |
get_qt_data () | |
Get all the question type variables. More... | |
get_qt_files ($name, $contextid) | |
Get the latest set of files for a particular question type variable of type question_attempt::PARAM_FILES. More... | |
get_qt_var ($name) | |
get_state () | |
get_submitted_data () | |
Get all the submitted data, but not the cached data. More... | |
get_timecreated () | |
get_user_id () | |
has_behaviour_var ($name) | |
has_metadata_var ($name) | |
Whether this step has a metadata variable. More... | |
has_qt_var ($name) | |
prepare_response_files_draft_itemid ($name, $contextid) | |
Prepare a draft file are for the files belonging the a response variable of this step. More... | |
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. More... | |
response_summary_changed () | |
Whether this processing this step has changed the response summary. More... | |
rewrite_response_pluginfile_urls ($text, $contextid, $name, $extras) | |
Rewrite the @PLUGINFILE@ tokens in a response variable from this step that contains links to file. More... | |
set_behaviour_var ($name, $value) | |
Set a cached behaviour variable. More... | |
set_fraction ($fraction) | |
Set the fraction. More... | |
set_metadata_var ($name, $value) | |
Set a metadata variable. More... | |
set_new_response_summary ($responsesummary) | |
If as a result of processing this step, the response summary for the question attempt should changed, you should call this method to set the new summary. More... | |
set_new_variant_number ($variant) | |
If as a result of processing this step, you identify that this variant of the question is actually identical to the another one, you may change the variant number recorded, in order to give better statistics. More... | |
set_qt_var ($name, $value) | |
Set a cached question type variable. More... | |
set_state ($state) | |
Set the state. More... | |
variant_number_changed () | |
Whether this processing this step has changed the variant number. More... | |
Static Public Member Functions | |
static | load_from_records ($records, $attemptstepid, $qtype=null) |
Create a question_attempt_step from records loaded from the database. More... | |
Protected Attributes | |
string | $newresponsesummary = null |
the new response summary, if there is one. | |
int | $newvariant = null |
the new variant number, if there is one. | |
A subclass of question_attempt_step used when processing a new submission.
When we are processing some new submitted data, which may or may not lead to a new step being added to the question_usage_by_activity we create an instance of this class. which is then passed to the question behaviour and question type for processing. At the end of processing we then may, or may not, keep it.
|
inherited |
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 occasionally 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.
|
inherited |
Get all the behaviour variables.
array | name => value pairs. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
string | $name | the name of a behaviour variable to look for in the submitted data. |
string | the requested variable, or null if the variable is not set. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
null|number | the fraction (grade on a scale of minfraction .. maxfraction, normally 0..1), or null if this step has not been marked. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
int|null | The id of this step in the database. null if this step is not stored in the database. |
|
inherited |
Get a metadata variable.
Do not call this method directly from your code. It is for internal use only. You should call question_usage::get_question_attempt_metadata().
string | $name | the name of the variable to set. [a-z][a-z0-9]*. |
string | the value to set previously, or null if this variable was never set. |
question_attempt_pending_step::get_new_response_summary | ( | ) |
Get the new response summary, if there is one.
string | the new response summary, or null if it has not changed. |
question_attempt_pending_step::get_new_variant_number | ( | ) |
Get the new variant number, if there is one.
int | the new variant number, or null if it has not changed. |
|
inherited |
Get all the question type variables.
array | name => value pairs. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
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. |
array | of stored_files. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
string | $name | the name of a question type variable to look for in the submitted data. |
string | the requested variable, or null if the variable is not set. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
question_state | The state after this step. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
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.
|
inherited |
int | the timestamp when this step was created. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
int | the id of the user resonsible for creating this step. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
string | $name | the name of a behaviour variable to look for in the submitted data. |
bool | whether a variable with this name exists in the question type data. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
Whether this step has a metadata variable.
Do not call this method directly from your code. It is for internal use only. You should call question_usage::get_question_attempt_metadata().
string | $name | the name of the variable to set. [a-z][a-z0-9]*. |
bool | the value to set previously, or null if this variable was never set. |
|
inherited |
string | $name | the name of a question type variable to look for in the submitted data. |
bool | whether a variable with this name exists in the question type data. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
staticinherited |
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. |
string | $qtype | The question type of which this is an attempt. If not given, each record must include a qtype field. |
question_attempt_step | The newly constructed question_attempt_step. |
|
inherited |
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. |
int | the draft itemid. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
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. |
array(int,string) | the draft itemid and the text with URLs rewritten. |
Reimplemented in question_attempt_step_subquestion_adapter.
question_attempt_pending_step::response_summary_changed | ( | ) |
Whether this processing this step has changed the response summary.
bool | true if there is a new response summary. |
|
inherited |
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. |
string | the rewritten text. |
Reimplemented in question_attempt_step_subquestion_adapter.
|
inherited |
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_read_only, and question_attempt_step_subquestion_adapter.
|
inherited |
Set the fraction.
Normally only called by behaviours.
null | number | $fraction | the fraction to set. |
Reimplemented in question_attempt_step_read_only, and question_attempt_step_subquestion_adapter.
|
inherited |
Set a metadata variable.
Do not call this method directly from your code. It is for internal use only. You should call question_usage::set_question_attempt_metadata().
string | $name | the name of the variable to set. [a-z][a-z0-9]*. |
string | $value | the value to set. |
question_attempt_pending_step::set_new_response_summary | ( | $responsesummary | ) |
If as a result of processing this step, the response summary for the question attempt should changed, you should call this method to set the new summary.
string | $responsesummary | the new response summary. |
question_attempt_pending_step::set_new_variant_number | ( | $variant | ) |
If as a result of processing this step, you identify that this variant of the question is actually identical to the another one, you may change the variant number recorded, in order to give better statistics.
For an example see qbehaviour_opaque.
int | $variant | the new variant number. |
|
inherited |
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_read_only, and question_attempt_step_subquestion_adapter.
|
inherited |
Set the state.
Normally only called by behaviours.
question_state | $state | one of the question_state constants. |
Reimplemented in question_attempt_step_read_only, and question_attempt_step_subquestion_adapter.
question_attempt_pending_step::variant_number_changed | ( | ) |
Whether this processing this step has changed the variant number.
bool | true if there is a new variant number. |