Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
question_attempt_pending_step Class Reference

A subclass of {. More...

Inheritance diagram for question_attempt_pending_step:
question_attempt_step

Public Member Functions

 add_full_user_object (stdClass $user)
 Update full user information for step.
 
 get_all_data ()
 Get all the data.
 
 get_behaviour_data ()
 Get all the behaviour variables.
 
 get_behaviour_var ($name)
 
 get_fraction ()
 
 get_id ()
 
 get_metadata_var ($name)
 Get a metadata variable.
 
 get_new_response_summary ()
 Get the new response summary, if there is one.
 
 get_new_variant_number ()
 Get the new variant number, if there is one.
 
 get_qt_data ()
 Get all the question type variables.
 
 get_qt_files ($name, $contextid)
 Get the latest set of files for a particular question type variable of type question_attempt\PARAM_FILES.
 
 get_qt_var ($name)
 
 get_state ()
 
 get_submitted_data ()
 Get all the submitted data, but not the cached data.
 
 get_timecreated ()
 
 get_user ()
 Return the full user object.
 
 get_user_fullname ()
 Get full name of user who did action.
 
 get_user_id ()
 
 has_behaviour_var ($name)
 
 has_metadata_var ($name)
 Whether this step has a metadata variable.
 
 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.
 
 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.
 
 response_summary_changed ()
 Whether this processing this step has changed the response summary.
 
 rewrite_response_pluginfile_urls ($text, $contextid, $name, $extras)
 Rewrite the @PLUGINFILE@ tokens in a response variable from this step that contains links to file.
 
 set_behaviour_var ($name, $value)
 Set a cached behaviour variable.
 
 set_fraction ($fraction)
 Set the fraction.
 
 set_metadata_var ($name, $value)
 Set a metadata variable.
 
 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.
 
 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.
 
 set_qt_var ($name, $value)
 Set a cached question type variable.
 
 set_state ($state)
 Set the state.
 
 variant_number_changed ()
 Whether this processing this step has changed the variant number.
 

Static Public Member Functions

static load_from_records ($records, $attemptstepid, $qtype=null)
 Create a question_attempt_step from records loaded from the database.
 

Protected Attributes

string $newresponsesummary = null
 the new response summary, if there is one.
 
int $newvariant = null
 the new variant number, if there is one.
 

Detailed Description

A subclass of {.

See also
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 {

See also
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.
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ add_full_user_object()

question_attempt_step::add_full_user_object ( stdClass $user)
inherited

Update full user information for step.

Parameters
stdClass$userFull user object.
Exceptions
coding_exception

◆ get_all_data()

question_attempt_step::get_all_data ( )
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 {

See also
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.
Parameters
arrayname => value pairs.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ get_behaviour_data()

question_attempt_step::get_behaviour_data ( )
inherited

Get all the behaviour variables.

Return values
arrayname => value pairs. NOTE! the name has the leading - stripped off. (If you don't understand the note, read the comment at the top of this class :-))

Reimplemented in question_attempt_step_subquestion_adapter.

◆ get_behaviour_var()

question_attempt_step::get_behaviour_var ( $name)
inherited
Parameters
string$namethe name of a behaviour variable to look for in the submitted data.
Return values
stringthe requested variable, or null if the variable is not set.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ get_fraction()

question_attempt_step::get_fraction ( )
inherited
Return values
null|numberthe 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.

◆ get_id()

question_attempt_step::get_id ( )
inherited
Return values
int|nullThe id of this step in the database. null if this step is not stored in the database.

◆ get_metadata_var()

question_attempt_step::get_metadata_var ( $name)
inherited

Get a metadata variable.

Do not call this method directly from your code. It is for internal use only. You should call {

See also
question_usage\get_question_attempt_metadata()}.
Parameters
string$namethe name of the variable to set. [a-z][a-z0-9]*.
Return values
stringthe value to set previously, or null if this variable was never set.

◆ get_new_response_summary()

question_attempt_pending_step::get_new_response_summary ( )

Get the new response summary, if there is one.

Return values
stringthe new response summary, or null if it has not changed.

◆ get_new_variant_number()

question_attempt_pending_step::get_new_variant_number ( )

Get the new variant number, if there is one.

Return values
intthe new variant number, or null if it has not changed.

◆ get_qt_data()

question_attempt_step::get_qt_data ( )
inherited

Get all the question type variables.

Parameters
arrayname => value pairs.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ get_qt_files()

question_attempt_step::get_qt_files ( $name,
$contextid )
inherited

Get the latest set of files for a particular question type variable of type question_attempt\PARAM_FILES.

Parameters
string$namethe name of the associated variable.
int$contextidcontextid of the question attempt
Return values
arrayof {
See also
stored_files}.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ get_qt_var()

question_attempt_step::get_qt_var ( $name)
inherited
Parameters
string$namethe name of a question type variable to look for in the submitted data.
Return values
stringthe requested variable, or null if the variable is not set.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ get_state()

question_attempt_step::get_state ( )
inherited
Return values
question_stateThe state after this step.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ get_submitted_data()

question_attempt_step::get_submitted_data ( )
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 {

See also
question_attempt\regrade()}, it should not be considered part of the public API.
Parameters
arrayname => value pairs.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ get_timecreated()

question_attempt_step::get_timecreated ( )
inherited
Return values
intthe timestamp when this step was created.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ get_user()

question_attempt_step::get_user ( )
inherited

Return the full user object.

Return values
null|stdClassGet full user object.

◆ get_user_fullname()

question_attempt_step::get_user_fullname ( )
inherited

Get full name of user who did action.

Return values
stringfull name of user.

◆ get_user_id()

question_attempt_step::get_user_id ( )
inherited
Return values
intthe id of the user resonsible for creating this step.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ has_behaviour_var()

question_attempt_step::has_behaviour_var ( $name)
inherited
Parameters
string$namethe name of a behaviour variable to look for in the submitted data.
Return values
boolwhether a variable with this name exists in the question type data.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ has_metadata_var()

question_attempt_step::has_metadata_var ( $name)
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 {

See also
question_usage\get_question_attempt_metadata()}.
Parameters
string$namethe name of the variable to set. [a-z][a-z0-9]*.
Return values
boolthe value to set previously, or null if this variable was never set.

◆ has_qt_var()

question_attempt_step::has_qt_var ( $name)
inherited
Parameters
string$namethe name of a question type variable to look for in the submitted data.
Return values
boolwhether a variable with this name exists in the question type data.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ load_from_records()

static question_attempt_step::load_from_records ( $records,
$attemptstepid,
$qtype = null )
staticinherited

Create a question_attempt_step from records loaded from the database.

Parameters
Iterator$recordsRaw records loaded from the database.
int$stepidThe id of the records to extract.
string$qtypeThe question type of which this is an attempt. If not given, each record must include a qtype field.
Return values
question_attempt_stepThe newly constructed question_attempt_step.

◆ prepare_response_files_draft_itemid()

question_attempt_step::prepare_response_files_draft_itemid ( $name,
$contextid )
inherited

Prepare a draft file are for the files belonging the a response variable of this step.

Parameters
string$namethe variable name the files belong to.
int$contextidthe id of the context the quba belongs to.
Return values
intthe draft itemid.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ prepare_response_files_draft_itemid_with_text()

question_attempt_step::prepare_response_files_draft_itemid_with_text ( $name,
$contextid,
$text )
inherited

Prepare a draft file are for the files belonging the a response variable of this step, while rewriting the URLs in some text.

Parameters
string$namethe variable name the files belong to.
int$contextidthe id of the context the quba belongs to.
string | null$textthe text to update the URLs in.
Return values
array(int,string)the draft itemid and the text with URLs rewritten.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ response_summary_changed()

question_attempt_pending_step::response_summary_changed ( )

Whether this processing this step has changed the response summary.

Return values
booltrue if there is a new response summary.

◆ rewrite_response_pluginfile_urls()

question_attempt_step::rewrite_response_pluginfile_urls ( $text,
$contextid,
$name,
$extras )
inherited

Rewrite the @PLUGINFILE@ tokens in a response variable from this step that contains links to file.

Normally you should probably call {

See also
question_attempt\rewrite_response_pluginfile_urls()} instead of calling this method directly.
Parameters
string$textthe text to update the URLs in.
int$contextidthe id of the context the quba belongs to.
string$namethe variable name the files belong to.
array$extrasextra file path components.
Return values
stringthe rewritten text.

Reimplemented in question_attempt_step_subquestion_adapter.

◆ set_behaviour_var()

question_attempt_step::set_behaviour_var ( $name,
$value )
inherited

Set a cached behaviour variable.

Parameters
string$namethe name of the variable to set. Must match _[a-z][a-z0-9]*.
string$valuethe value to set.

Reimplemented in question_attempt_step_read_only, and question_attempt_step_subquestion_adapter.

◆ set_fraction()

question_attempt_step::set_fraction ( $fraction)
inherited

Set the fraction.

Normally only called by behaviours.

Parameters
null | number$fractionthe fraction to set.

Reimplemented in question_attempt_step_read_only, and question_attempt_step_subquestion_adapter.

◆ set_metadata_var()

question_attempt_step::set_metadata_var ( $name,
$value )
inherited

Set a metadata variable.

Do not call this method directly from your code. It is for internal use only. You should call {

See also
question_usage\set_question_attempt_metadata()}.
Parameters
string$namethe name of the variable to set. [a-z][a-z0-9]*.
string$valuethe value to set.

◆ set_new_response_summary()

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.

Parameters
string$responsesummarythe new response summary.

◆ set_new_variant_number()

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.

Parameters
int$variantthe new variant number.

◆ set_qt_var()

question_attempt_step::set_qt_var ( $name,
$value )
inherited

Set a cached question type variable.

Parameters
string$namethe name of the variable to set. Must match _[a-z][a-z0-9]*.
string$valuethe value to set.

Reimplemented in question_attempt_step_read_only, and question_attempt_step_subquestion_adapter.

◆ set_state()

question_attempt_step::set_state ( $state)
inherited

Set the state.

Normally only called by behaviours.

Parameters
question_state$stateone of the {
See also
question_state} constants.

Reimplemented in question_attempt_step_read_only, and question_attempt_step_subquestion_adapter.

◆ variant_number_changed()

question_attempt_pending_step::variant_number_changed ( )

Whether this processing this step has changed the variant number.

Return values
booltrue if there is a new variant number.

The documentation for this class was generated from the following file: