This is an adapter class that wraps a {.
More...
|
| | __construct ($realqas, $extraprefix) |
| | Constructor.
|
| |
| | add_full_user_object (stdClass $user) |
| | Update full user information for step.
|
| |
| | add_prefix ($field) |
| | Add the extra prefix to a field name.
|
| |
| | filter_array ($data) |
| | Filter some data to keep only those entries where the key contains extraprefix, and remove the extra prefix from the reutrned arrary.
|
| |
| | 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_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.
|
| |
| | remove_prefix ($field) |
| | Remove the extra prefix from a field name if it is present.
|
| |
| | 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_qt_var ($name, $value) |
| | Set a cached question type variable.
|
| |
| | set_state ($state) |
| | Set the state.
|
| |
|
|
string | $extraprefix |
| | the exta prefix on fields we work with.
|
| |
|
question_attempt_step | $realstep |
| | the step we are wrapping.
|
| |
This is an adapter class that wraps a {.
- See also
- question_attempt_step} and modifies the get/set_*_data methods so that they operate only on the parts that belong to a particular subquestion, as indicated by an extra prefix.
- Copyright
- 2010 The Open University
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
◆ __construct()
| question_attempt_step_subquestion_adapter::__construct |
( |
|
$realqas, |
|
|
|
$extraprefix |
|
) |
| |
Constructor.
- Parameters
-
| question_attempt_step | $realqas | the step to wrap. (Can be null if you just want to call add/remove.prefix.) |
| string | $extraprefix | the extra prefix that is used for date fields. |
◆ add_full_user_object()
| question_attempt_step::add_full_user_object |
( |
stdClass |
$user | ) |
|
|
inherited |
Update full user information for step.
- Parameters
-
| stdClass | $user | Full user object. |
- Exceptions
-
◆ add_prefix()
| question_attempt_step_subquestion_adapter::add_prefix |
( |
|
$field | ) |
|
Add the extra prefix to a field name.
- Parameters
-
| string | $field | the plain field name. |
- Return values
-
| string | the field name with the extra bit of prefix added. |
◆ filter_array()
| question_attempt_step_subquestion_adapter::filter_array |
( |
|
$data | ) |
|
Filter some data to keep only those entries where the key contains extraprefix, and remove the extra prefix from the reutrned arrary.
- Parameters
-
| array | $data | some of the data stored in this step. |
- Return values
-
| array | the data with the keys ajusted using { |
- See also
- remove_prefix()}.
◆ get_all_data()
| question_attempt_step_subquestion_adapter::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 {
- 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
-
| array | name => value pairs. |
Reimplemented from question_attempt_step.
◆ get_behaviour_data()
| question_attempt_step_subquestion_adapter::get_behaviour_data |
( |
| ) |
|
Get all the behaviour variables.
- Return values
-
| array | name => 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 from question_attempt_step.
◆ get_behaviour_var()
| question_attempt_step_subquestion_adapter::get_behaviour_var |
( |
|
$name | ) |
|
- Parameters
-
| string | $name | the name of a behaviour variable to look for in the submitted data. |
- Return values
-
| string | the requested variable, or null if the variable is not set. |
Reimplemented from question_attempt_step.
◆ get_fraction()
| question_attempt_step_subquestion_adapter::get_fraction |
( |
| ) |
|
- Return values
-
| null|number | the fraction (grade on a scale of minfraction .. maxfraction, normally 0..1), or null if this step has not been marked. |
Reimplemented from question_attempt_step.
◆ get_id()
| question_attempt_step::get_id |
( |
| ) |
|
|
inherited |
- Return values
-
| int|null | The 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 | $name | the name of the variable to set. [a-z][a-z0-9]*. |
- Return values
-
| string | the value to set previously, or null if this variable was never set. |
◆ get_qt_data()
| question_attempt_step_subquestion_adapter::get_qt_data |
( |
| ) |
|
Get all the question type variables.
- Parameters
-
| array | name => value pairs. |
Reimplemented from question_attempt_step.
◆ get_qt_files()
| question_attempt_step_subquestion_adapter::get_qt_files |
( |
|
$name, |
|
|
|
$contextid |
|
) |
| |
Get the latest set of files for a particular question type variable of type question_attempt::PARAM_FILES.
- Parameters
-
| string | $name | the name of the associated variable. |
| int | $contextid | contextid of the question attempt |
- Return values
-
- See also
- stored_files}.
Reimplemented from question_attempt_step.
◆ get_qt_var()
| question_attempt_step_subquestion_adapter::get_qt_var |
( |
|
$name | ) |
|
- Parameters
-
| string | $name | the name of a question type variable to look for in the submitted data. |
- Return values
-
| string | the requested variable, or null if the variable is not set. |
Reimplemented from question_attempt_step.
◆ get_state()
| question_attempt_step_subquestion_adapter::get_state |
( |
| ) |
|
◆ get_submitted_data()
| question_attempt_step_subquestion_adapter::get_submitted_data |
( |
| ) |
|
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
-
| array | name => value pairs. |
Reimplemented from question_attempt_step.
◆ get_timecreated()
| question_attempt_step_subquestion_adapter::get_timecreated |
( |
| ) |
|
◆ get_user()
| question_attempt_step::get_user |
( |
| ) |
|
|
inherited |
Return the full user object.
- Return values
-
| stdClass | Get full user object. |
◆ get_user_fullname()
| question_attempt_step::get_user_fullname |
( |
| ) |
|
|
inherited |
Get full name of user who did action.
- Return values
-
◆ get_user_id()
| question_attempt_step_subquestion_adapter::get_user_id |
( |
| ) |
|
- Return values
-
| int | the id of the user resonsible for creating this step. |
Reimplemented from question_attempt_step.
◆ has_behaviour_var()
| question_attempt_step_subquestion_adapter::has_behaviour_var |
( |
|
$name | ) |
|
- Parameters
-
| string | $name | the name of a behaviour variable to look for in the submitted data. |
- Return values
-
| bool | whether a variable with this name exists in the question type data. |
Reimplemented from question_attempt_step.
◆ 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 | $name | the name of the variable to set. [a-z][a-z0-9]*. |
- Return values
-
| bool | the value to set previously, or null if this variable was never set. |
◆ has_qt_var()
| question_attempt_step_subquestion_adapter::has_qt_var |
( |
|
$name | ) |
|
- Parameters
-
| string | $name | the name of a question type variable to look for in the submitted data. |
- Return values
-
| bool | whether a variable with this name exists in the question type data. |
Reimplemented from question_attempt_step.
◆ 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 | $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. |
- Return values
-
◆ prepare_response_files_draft_itemid()
| question_attempt_step_subquestion_adapter::prepare_response_files_draft_itemid |
( |
|
$name, |
|
|
|
$contextid |
|
) |
| |
Prepare a draft file are for the files belonging the a response variable of this step.
- Parameters
-
| string | $name | the variable name the files belong to. |
| int | $contextid | the id of the context the quba belongs to. |
- Return values
-
Reimplemented from question_attempt_step.
◆ prepare_response_files_draft_itemid_with_text()
| question_attempt_step_subquestion_adapter::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.
- Parameters
-
| 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. |
- Return values
-
| array(int,string) | the draft itemid and the text with URLs rewritten. |
Reimplemented from question_attempt_step.
◆ remove_prefix()
| question_attempt_step_subquestion_adapter::remove_prefix |
( |
|
$field | ) |
|
Remove the extra prefix from a field name if it is present.
- Parameters
-
| string | $field | the extended field name. |
- Return values
-
| string | the field name with the extra bit of prefix removed, or null if the extre prefix was not present. |
◆ rewrite_response_pluginfile_urls()
| question_attempt_step_subquestion_adapter::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 {
- See also
- question_attempt::rewrite_response_pluginfile_urls()} instead of calling this method directly.
- Parameters
-
| 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. |
- Return values
-
| string | the rewritten text. |
Reimplemented from question_attempt_step.
◆ set_behaviour_var()
| question_attempt_step_subquestion_adapter::set_behaviour_var |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
Set a cached behaviour variable.
- Parameters
-
| string | $name | the name of the variable to set. Must match _[a-z][a-z0-9]*. |
| string | $value | the value to set. |
Reimplemented from question_attempt_step.
◆ set_fraction()
| question_attempt_step_subquestion_adapter::set_fraction |
( |
|
$fraction | ) |
|
Set the fraction.
Normally only called by behaviours.
- Parameters
-
| null | number | $fraction | the fraction to set. |
Reimplemented from question_attempt_step.
◆ 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 | $name | the name of the variable to set. [a-z][a-z0-9]*. |
| string | $value | the value to set. |
◆ set_qt_var()
| question_attempt_step_subquestion_adapter::set_qt_var |
( |
|
$name, |
|
|
|
$value |
|
) |
| |
Set a cached question type variable.
- Parameters
-
| string | $name | the name of the variable to set. Must match _[a-z][a-z0-9]*. |
| string | $value | the value to set. |
Reimplemented from question_attempt_step.
◆ set_state()
| question_attempt_step_subquestion_adapter::set_state |
( |
|
$state | ) |
|
The documentation for this class was generated from the following file: