Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Makes some protected methods of question_attempt public to facilitate testing. More...
Public Member Functions | |
add_step (question_attempt_step $step) | |
Add a step to this question attempt. | |
can_finish_during_attempt () | |
Whether this attempt at this question could be completed just by the student interacting with the question, before finish() is called. | |
check_file_access ($options, $component, $filearea, $args, $forcedownload) | |
Checks whether the users is allow to be served a particular file. | |
classify_response ($whichtries=self::LAST_TRY) | |
Break down a student response by sub part and classification. | |
discard_autosaved_step () | |
Discard any auto-saved data belonging to this question attempt. | |
finish ($timestamp=null, $userid=null) | |
Perform a finish action on this question attempt. | |
format_fraction_as_mark ($fraction, $dp) | |
The a mark, formatted to the stated number of decimal places. | |
format_mark ($dp) | |
The current mark, formatted to the stated number of decimal places. | |
format_max_mark ($dp) | |
The maximum mark for this question attempt, formatted to the stated number of decimal places. | |
fraction_to_mark ($fraction) | |
get_all_submitted_qt_vars ($postdata) | |
Get all the submitted question type data for this question, whithout checking that it is valid or cleaning it in any way. | |
get_applicable_hint () | |
Return the hint that applies to the question in its current state, or null. | |
get_behaviour ($requirequestioninitialised=true) | |
For internal use only. | |
get_behaviour_field_name ($varname) | |
Get the name (in the sense a HTML name="" attribute, or a $_POST variable name) to use for a question_type variable belonging to this question_attempt. | |
get_behaviour_name () | |
get_control_field_name ($varname) | |
Get the name (in the sense a HTML name="" attribute, or a $_POST variable name) to use for a control variables belonging to this question_attempt. | |
get_correct_response () | |
Get a set of response data for this question attempt that would get the best possible mark. | |
get_current_manual_comment () | |
This is used by the manual grading code, particularly in association with validation. | |
get_current_manual_mark () | |
This is used by the manual grading code, particularly in association with validation. | |
get_database_id () | |
get_field_prefix () | |
Get the prefix added to variable names to give field names for this question attempt. | |
get_flag_field_name () | |
Get the name (in the sense a HTML name="" attribute, or a $_POST variable name) to use for the field that indicates whether this question is flagged. | |
get_fraction () | |
Get the current fraction of this question attempt. | |
get_full_qa () | |
This method exists so that question_attempt_with_restricted_history can override it. | |
get_full_step_iterator () | |
The same as get_step_iterator(). | |
get_last_action_time () | |
get_last_behaviour_var ($name, $default=null) | |
Get the latest value of a particular behaviour variable. | |
get_last_qt_data ($default=array()) | |
Get the qt data from the latest step that has any qt data. | |
get_last_qt_files ($name, $contextid) | |
Get the latest set of files for a particular question type variable of type question_attempt\PARAM_FILES. | |
get_last_qt_var ($name, $default=null) | |
Get the latest value of a particular question type variable. | |
get_last_step () | |
Return the latest step in this question_attempt. | |
get_last_step_with_behaviour_var ($name) | |
Get the last step with a particular behaviour variable set. | |
get_last_step_with_qt_var ($name) | |
Get the last step with a particular question type varialbe set. | |
get_manual_comment () | |
get_mark () | |
get_max_fraction () | |
get_max_mark () | |
get_metadata ($name) | |
Return one of the bits of metadata for a this question attempt. | |
get_min_fraction () | |
get_num_steps () | |
Get the number of steps in this attempt. | |
get_outer_question_div_unique_id () | |
When the question is rendered, this unique id is added to the outer div of the question. | |
get_qt_field_name ($varname) | |
Get the name (in the sense a HTML name="" attribute, or a $_POST variable name) to use for a question_type variable belonging to this question_attempt. | |
get_question ($requirequestioninitialised=true) | |
Get the question that is being attempted. | |
get_question_id () | |
Get the id of the question being attempted. | |
get_question_summary () | |
get_response_file_url (stored_file $file) | |
Get the URL of a file that belongs to a response variable of this question_attempt. | |
get_response_summary () | |
get_reverse_step_iterator () | |
get_right_answer_summary () | |
get_sequence_check_count () | |
Get the number of real steps in this attempt. | |
get_slot () | |
get_state () | |
Get the current state of this question attempt. | |
get_state_class ($showcorrectness) | |
get_state_string ($showcorrectness) | |
get_step ($i) | |
Get one of the steps in this attempt. | |
get_step_iterator () | |
get_steps_with_submitted_response_iterator () | |
Allow access to steps with responses submitted by students for grading in a question attempt. | |
get_submitted_data ($postdata=null) | |
Get all the sumbitted data belonging to this question attempt from the current request. | |
get_submitted_var ($name, $type, $postdata=null) | |
Get a particular parameter from the current request. | |
get_usage_id () | |
get_variant () | |
Get the variant of the question being used in a given slot. | |
has_autosaved_step () | |
has_manual_comment () | |
has_marks () | |
is_flagged () | |
manual_grade ($comment, $mark, $commentformat=null, $timestamp=null, $userid=null) | |
Perform a manual grading action on this attempt. | |
prepare_response_files_draft_itemid ($name, $contextid) | |
Prepare a draft file are for the files belonging the a response variable of this question attempt. | |
process_action ($submitteddata, $timestamp=null, $userid=null, $existingstepid=null) | |
Perform the action described by $submitteddata. | |
process_autosave ($submitteddata, $timestamp=null, $userid=null) | |
Process an autosave. | |
regrade (question_attempt $oldqa, $finished) | |
Perform a regrade. | |
render ($options, $number, $page=null) | |
Get the core_question_renderer, in collaboration with appropriate qbehaviour_renderer and qtype_renderer subclasses, to generate the HTML to display this question attempt in its current state. | |
render_at_step ($seq, $options, $number, $preferredbehaviour) | |
Like render_question() but displays the question at the past step indicated by $seq, rather than showing the latest step. | |
render_head_html ($page=null) | |
Generate any bits of HTML that needs to go in the <head> tag when this question attempt is displayed in the body. | |
rewrite_pluginfile_urls ($text, $component, $filearea, $itemid) | |
Calls question_rewrite_question_urls() with appropriate parameters for content belonging to this question. | |
rewrite_response_pluginfile_urls ($text, $contextid, $name, question_attempt_step $step) | |
Calls question_rewrite_question_urls() with appropriate parameters for content belonging to responses to this question. | |
select_variant (question_variant_selection_strategy $variantstrategy) | |
Use a strategy to pick a variant. | |
set_behaviour (question_behaviour $behaviour) | |
set_database_id ($id) | |
For internal use only. | |
set_flagged ($flagged) | |
Set the flagged state of this question. | |
set_max_fraction ($fraction) | |
set_max_mark ($maxmark) | |
Change the max mark for this question_attempt. | |
set_metadata ($name, $value) | |
Set some metadata for this question attempt. | |
set_min_fraction ($fraction) | |
set_observer ($observer) | |
You should almost certainly not call this method from your code. | |
set_question_summary ($questionsummary) | |
Change the quetsion summary. | |
set_slot ($slot) | |
Set the number used to identify this question_attempt within the usage. | |
set_usage_id ($usageid) | |
Set the id of the question_usage_by_activity we belong to. | |
start ($preferredbehaviour, $variant, $submitteddata=array(), $timestamp=null, $userid=null, $existingstepid=null) | |
Start this question attempt. | |
start_based_on (question_attempt $oldqa) | |
Start this question attempt, starting from the point that the previous attempt $oldqa had reached. | |
summarise_action (question_attempt_step $step) | |
Produce a plain-text summary of what the user did during a step. | |
validate_can_regrade_with_other_version (question_definition $otherversion) | |
Verify if this question_attempt in can be regraded with that other question version. | |
validate_manual_mark ($currentmark) | |
Validate the manual mark for a question. | |
Static Public Member Functions | |
static | load_from_records ($records, $questionattemptid, question_usage_observer $observer, $preferredbehaviour) |
Create a question_attempt_step from records loaded from the database. | |
Public Attributes | |
int | $timemodified = null |
last modified time. | |
string const | ALL_TRIES = 'alltries' |
means all tries at a question during an attempt by a user. | |
const | DISCARD = false |
string const | FIRST_TRY = 'firsttry' |
means first try at a question during an attempt by a user. | |
const | KEEP = true |
#+ Constants used by the intereaction models to indicate whether the current pending step should be kept or discarded. | |
string const | LAST_TRY = 'lasttry' |
means last try at a question during an attempt by a user. | |
string const | PARAM_FILES = 'paramfiles' |
special value to indicate a response variable that is uploaded files. | |
string const | PARAM_MARK = PARAM_RAW_TRIMMED |
Should not longer be used. | |
string const | PARAM_RAW_FILES = 'paramrawfiles' |
special value to indicate a response variable that is uploaded files. | |
bool const | QUESTION_STATE_APPLIED = true |
used to manage the lazy-initialisation of question objects. | |
bool const | QUESTION_STATE_NOT_APPLIED = false |
used to manage the lazy-initialisation of question objects. | |
string const | USE_RAW_DATA = 'use raw data' |
this is a magic value that question types can return from question_definition::get_expected_data(). | |
Protected Member Functions | |
add_autosaved_step (question_attempt_step $step) | |
Add an auto-saved step to this question attempt. | |
check_qt_var_name_restrictions ($expected) | |
Ensure that no reserved prefixes are being used by installed question types. | |
convert_autosaved_step_to_real_step () | |
If there is an autosaved step, convert it into a real save, so that it is preserved. | |
ensure_question_initialised () | |
This method is part of the lazy-initialisation of question objects. | |
extra_file_path_components () | |
Helper function used by rewrite_pluginfile_urls() and rewrite_response_pluginfile_urls(). | |
get_attempt_state_data_to_regrade_with_version (question_attempt_step $oldstep, question_definition $otherversion) | |
Helper used by regrading. | |
get_expected_data ($expected, $postdata, $extraprefix) | |
Get any data from the request that matches the list of expected params. | |
get_resume_data () | |
Used by start_based_on() to get the data needed to start a new attempt from the point this attempt has go to. | |
process_response_files ($name, $draftidname, $postdata=null, $text=null) | |
Handle a submitted variable representing uploaded files. | |
Protected Attributes | |
question_attempt_step | $autosavedstep = null |
if, when we loaded the step from the DB, there was an autosaved step, we save a pointer to it here. | |
question_behaviour | $behaviour = null |
the behaviour controlling this attempt. | |
boolean | $flagged = false |
whether the user has flagged this attempt within the usage. | |
integer | $id = null |
if this attempts is stored in the question_attempts table, the id of that row. | |
float | $maxfraction = null |
the maximum fraction that can be scored at this question, so the maximum mark is $this->maxfraction * $this->maxmark. | |
float | $maxmark |
the maximum mark that can be scored at this question. | |
float | $minfraction = null |
the minimum fraction that can be scored at this question, so the minimum mark is $this->minfraction * $this->maxmark. | |
question_usage_observer | $observer |
tracks changes to the useage this attempt is part of. | |
question_definition | $question |
the question this is an attempt at. | |
bool | $questioninitialised |
tracks whether $question has had question_definition::start_attempt() or question_definition::apply_attempt_state() called. | |
string | $questionsummary = null |
plain text summary of the variant of the question the student saw. | |
string | $responsesummary = null |
plain text summary of the response the student gave. | |
string | $rightanswer = null |
plain text summary of the correct response to this question variant the student saw. | |
integer | $slot = null |
the number used to identify this question_attempt within the usage. | |
array | $steps = array() |
of . | |
integer string | $usageid |
the id of the question_usage_by_activity we belong to. | |
int | $variant |
which variant of the question to use. | |
Makes some protected methods of question_attempt public to facilitate testing.
|
protectedinherited |
Add an auto-saved step to this question attempt.
We mark auto-saved steps by changing saving the step number with a - sign.
question_attempt_step | $step | the new step. |
testable_question_attempt::add_step | ( | question_attempt_step | $step | ) |
Add a step to this question attempt.
question_attempt_step | $step | the new step. |
Reimplemented from question_attempt.
|
inherited |
Whether this attempt at this question could be completed just by the student interacting with the question, before finish() is called.
boolean | whether this attempt can finish naturally. |
|
inherited |
Checks whether the users is allow to be served a particular file.
question_display_options | $options | the options that control display of the question. |
string | $component | the name of the component we are serving files for. |
string | $filearea | the name of the file area. |
array | $args | the remaining bits of the file path. |
bool | $forcedownload | whether the user must be forced to download the file. |
bool | true if the user can access this file. |
|
protectedinherited |
Ensure that no reserved prefixes are being used by installed question types.
array | $expected | An array of question type variables |
|
inherited |
Break down a student response by sub part and classification.
See also question::classify_response. Used for response analysis.
string | $whichtries | which tries to analyse for response analysis. Will be one of question_attempt\FIRST_TRY, LAST_TRY or ALL_TRIES. Defaults to question_attempt\LAST_TRY. |
question_classified_response[]|question_classified_response[][] | If $whichtries is question_attempt\FIRST_TRY or LAST_TRY index is subpartid and values are question_classified_response instances. If $whichtries is question_attempt\ALL_TRIES then first key is submitted response no and the second key is subpartid. |
|
protectedinherited |
This method is part of the lazy-initialisation of question objects.
Methods which require $this->question to be fully initialised (to have had init_first_step or apply_attempt_state called on it) should call this method before proceeding.
|
protectedinherited |
Helper function used by rewrite_pluginfile_urls() and rewrite_response_pluginfile_urls().
array | ids that need to go into the file paths. |
|
inherited |
Perform a finish action on this question attempt.
This corresponds to an external finish action, for example the user pressing Submit all and finish in the quiz, rather than using one of the controls that is part of the question.
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.) |
|
inherited |
The a mark, formatted to the stated number of decimal places.
Uses format_float() to format floats according to the current locale.
number | $fraction | a fraction. |
int | $dp | number of decimal places. |
string | formatted mark. |
|
inherited |
The current mark, formatted to the stated number of decimal places.
Uses format_float() to format floats according to the current locale.
int | $dp | number of decimal places. |
string | formatted mark. |
|
inherited |
The maximum mark for this question attempt, formatted to the stated number of decimal places.
Uses format_float() to format floats according to the current locale.
int | $dp | number of decimal places. |
string | formatted maximum mark. |
|
inherited |
number | null | $fraction | a fraction. |
number|null | the corresponding mark. |
|
inherited |
Get all the submitted question type data for this question, whithout checking that it is valid or cleaning it in any way.
null | array | $postdata | null to use real post data, otherwise an array of data to use. |
array | name => value. |
|
inherited |
Return the hint that applies to the question in its current state, or null.
question_hint|null |
|
protectedinherited |
Helper used by regrading.
Get the data from the first step of the old attempt and, if necessary, update it to be suitable for use with the other version of the question.
question_attempt_step | $oldstep | First step at an attempt at $otherversion of this question. |
question_definition | $otherversion | Another version of the question being attempted. |
array | updated data required to restart an attempt with the current version of this question. |
|
inherited |
For internal use only.
bool | $requirequestioninitialised | set this to false if you don't need the behaviour initialised, which may improve performance. |
question_behaviour | the behaviour that is controlling this attempt. |
|
inherited |
Get the name (in the sense a HTML name="" attribute, or a $_POST variable name) to use for a question_type variable belonging to this question_attempt.
See the comment on question_attempt_step for an explanation of question type and behaviour variables.
string | $varname | The short form of the variable name. |
string | The field name to use. |
|
inherited |
string | the name of the behaviour that is controlling this attempt. |
|
inherited |
Get the name (in the sense a HTML name="" attribute, or a $_POST variable name) to use for a control variables belonging to this question_attempt.
Examples are :sequencecheck and :flagged
string | $varname | The short form of the variable name. |
string | The field name to use. |
|
inherited |
Get a set of response data for this question attempt that would get the best possible mark.
If it is not possible to compute a correct response, this method should return null.
array|null | name => value pairs that could be passed to process_action(). |
|
inherited |
This is used by the manual grading code, particularly in association with validation.
If there is a comment submitted in the request, then use that, otherwise use the latest comment for this question.
array | with three elements, comment, commentformat and mark. |
|
inherited |
This is used by the manual grading code, particularly in association with validation.
It gets the current manual mark for a question, in exactly the string form that the teacher entered it, if possible. This may come from the current POST request, if there is one, otherwise from the database.
string | the current manual mark for this question, in the format the teacher typed, if possible. |
|
inherited |
int | the id of row for this question_attempt, if it is stored in the database. null if not. |
|
protectedinherited |
Get any data from the request that matches the list of expected params.
array | $expected | variable name => PARAM_... constant. |
null | array | $postdata | null to use real post data, otherwise an array of data to use. |
string | $extraprefix | '-' or ''. |
array | name => value. |
|
inherited |
Get the prefix added to variable names to give field names for this question attempt.
You should not use this method directly. This is an implementation detail anyway, but if you must access it, use question_usage_by_activity::get_field_prefix().
string | The field name to use. |
|
inherited |
Get the name (in the sense a HTML name="" attribute, or a $_POST variable name) to use for the field that indicates whether this question is flagged.
string | The field name to use. |
|
inherited |
Get the current fraction of this question attempt.
That is, the fraction of the latest step, or null if this question has not yet been graded.
number | the current fraction. |
|
inherited |
This method exists so that question_attempt_with_restricted_history can override it.
You should not normally need to call it.
question_attempt | return ourself. |
Reimplemented in question_attempt_with_restricted_history.
|
inherited |
The same as get_step_iterator().
However, for a question_attempt_with_restricted_history this returns the full list of steps, while get_step_iterator() returns only the limited history.
question_attempt_step_iterator | for iterating over the steps in this attempt, in order. |
Reimplemented in question_attempt_with_restricted_history.
|
inherited |
int | the timestamp of the most recent step in this question attempt. |
|
inherited |
Get the latest value of a particular behaviour variable.
That is, get the value from the latest step that has it set. Return null if it is not set in any step.
string | $name | the name of the variable to get. |
mixed | default the value to return in the variable has never been set. (Optional, defaults to null.) |
mixed | string value, or $default if it has never been set. |
|
inherited |
Get the qt data from the latest step that has any qt data.
Return $default array if it is no step has qt data.
mixed | default the value to return no step has qt data. (Optional, defaults to an empty array.) |
array|mixed | the data, or $default if there is not any. |
|
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. |
int | $contextid | the context to which the files are linked. |
array | of stored_files. |
|
inherited |
Get the latest value of a particular question type variable.
That is, get the value from the latest step that has it set. Return null if it is not set in any step.
string | $name | the name of the variable to get. |
mixed | default the value to return in the variable has never been set. (Optional, defaults to null.) |
mixed | string value, or $default if it has never been set. |
|
inherited |
Return the latest step in this question_attempt.
For internal/test code use only.
question_attempt_step |
|
inherited |
Get the last step with a particular behaviour variable set.
string | $name | the name of the variable to get. |
question_attempt_step | the last step, or a step with no variables if there was not a real step. |
|
inherited |
Get the last step with a particular question type varialbe set.
string | $name | the name of the variable to get. |
question_attempt_step | the last step, or a step with no variables if there was not a real step. |
|
inherited |
array(string,int) | the most recent manual comment that was added to this question, the FORMAT_... it is and the step itself. |
|
inherited |
number | the current mark for this question. get_fraction() * get_max_mark(). |
|
inherited |
float | the maximum mark possible for this question attempt. |
|
inherited |
float | the maximum mark possible for this question attempt. In fact, this is not strictly the maximum, becuase get_max_fraction may return a number greater than 1. It might be better to think of this as a question weight. |
|
inherited |
Return one of the bits of metadata for a this question attempt.
string | $name | the name of the metadata variable to return. |
string | the value of that metadata variable. |
|
inherited |
float | the maximum mark possible for this question attempt. |
|
inherited |
Get the number of steps in this attempt.
For internal/test code use only.
int | the number of steps we currently have. |
|
inherited |
When the question is rendered, this unique id is added to the outer div of the question.
It can be used to uniquely reference the question from JavaScript.
string | id added to the outer when the question is rendered. |
|
inherited |
Get the name (in the sense a HTML name="" attribute, or a $_POST variable name) to use for a question_type variable belonging to this question_attempt.
See the comment on question_attempt_step for an explanation of question type and behaviour variables.
string | $varname | The short form of the variable name. |
string | The field name to use. |
|
inherited |
Get the question that is being attempted.
bool | $requirequestioninitialised | set this to false if you don't need the behaviour initialised, which may improve performance. |
question_definition | the question this is an attempt at. |
|
inherited |
Get the id of the question being attempted.
int | question id. |
|
inherited |
string | a simple textual summary of the question that was asked. |
|
inherited |
Get the URL of a file that belongs to a response variable of this question_attempt.
stored_file | $file | the file to link to. |
string | the URL of that file. |
|
inherited |
string | a simple textual summary of response given. |
|
protectedinherited |
Used by start_based_on() to get the data needed to start a new attempt from the point this attempt has go to.
array | name => value pairs. |
|
inherited |
question_attempt_reverse_step_iterator | for iterating over the steps in this attempt, in reverse order. |
|
inherited |
string | a simple textual summary of the correct resonse. |
|
inherited |
Get the number of real steps in this attempt.
This is put as a hidden field in the HTML, so that when we receive some data to process, then we can check that it came from the question in the state we are now it.
int | a number that summarises the current state of this question attempt. |
|
inherited |
int | the number used to identify this question_attempt within the usage. |
|
inherited |
Get the current state of this question attempt.
That is, the state of the latest step.
question_state |
|
inherited |
bool | $showcorrectness | Whether right/partial/wrong states should be distinguised. |
string | a CSS class name for the current state. |
|
inherited |
bool | $showcorrectness | Whether right/partial/wrong states should be distinguised. |
string | A brief textual description of the current state. |
|
inherited |
Get one of the steps in this attempt.
int | $i | the step number, which counts from 0. |
question_attempt_step |
|
inherited |
question_attempt_step_iterator | for iterating over the steps in this attempt, in order. |
|
inherited |
Allow access to steps with responses submitted by students for grading in a question attempt.
question_attempt_steps_with_submitted_response_iterator | to access all steps with submitted data for questions that allow multiple submissions that count towards grade, per attempt. |
|
inherited |
Get all the sumbitted data belonging to this question attempt from the current request.
array | $postdata | (optional, only inteded for testing use) take the data from this array, instead of from $_POST. |
array | name => value pairs that could be passed to process_action(). |
|
inherited |
Get a particular parameter from the current request.
A wrapper round optional_param(), except that the results is returned without slashes.
string | $name | the paramter name. |
int | $type | one of the standard PARAM_... constants, or one of the special extra constands defined by this class. |
array | $postdata | (optional, only inteded for testing use) take the data from this array, instead of from $_POST. |
mixed | the requested value. |
|
inherited |
int|string | the id of the question_usage_by_activity we belong to. |
|
inherited |
Get the variant of the question being used in a given slot.
int | the variant number. |
|
inherited |
boolean | whether this question_attempt has autosaved data from some time in the past. |
|
inherited |
bool | Whether this question attempt has had a manual comment added. |
|
inherited |
bool | whether this question attempt has a non-zero maximum mark. |
|
inherited |
bool | whether this question is currently flagged. |
|
staticinherited |
Create a question_attempt_step from records loaded from the database.
For internal use only.
Iterator | $records | Raw records loaded from the database. |
int | $questionattemptid | The id of the question_attempt to extract. |
question_usage_observer | $observer | the observer that will be monitoring changes in us. |
string | $preferredbehaviour | the preferred behaviour under which we are operating. |
question_attempt | The newly constructed question_attempt. |
|
inherited |
Perform a manual grading action on this attempt.
string | $comment | the comment being added. |
float | $mark | the new mark. If null, then only a comment is added. |
int | $commentformat | the FORMAT_... for $comment. Must be given. |
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.) |
|
inherited |
Prepare a draft file are for the files belonging the a response variable of this question attempt.
The draft area is populated with the files from the most recent step having files.
string | $name | the variable name the files belong to. |
int | $contextid | the id of the context the quba belongs to. |
int | the draft itemid. |
|
inherited |
Perform the action described by $submitteddata.
array | $submitteddata | the submitted data the determines the action. |
int | $timestamp | the time to record for the action. (If not given, use now.) |
int | $userid | the user to attribute the action to. (If not given, use the current user.) |
int | $existingstepid | used by the regrade code. |
Reimplemented in question_attempt_with_restricted_history.
|
inherited |
Process an autosave.
array | $submitteddata | the submitted data the determines the action. |
int | $timestamp | the time to record for the action. (If not given, use now.) |
int | $userid | the user to attribute the action to. (If not given, use the current user.) |
bool | whether anything was saved. |
|
protectedinherited |
Handle a submitted variable representing uploaded files.
string | $name | the field name. |
string | $draftidname | the field name holding the draft file area id. |
array | $postdata | (optional, only inteded for testing use) take the data from this array, instead of from $_POST. At the moment, this behaves as if there were no files. |
string | $text | optional reponse text. |
question_file_saver | that can be used to save the files later. |
|
inherited |
Perform a regrade.
This replays all the actions from $oldqa into this attempt.
question_attempt | $oldqa | the attempt to regrade. |
bool | $finished | whether the question attempt should be forced to be finished after the regrade, or whether it may still be in progress (default false). |
|
inherited |
Get the core_question_renderer, in collaboration with appropriate qbehaviour_renderer and qtype_renderer subclasses, to generate the HTML to display this question attempt in its current state.
question_display_options | $options | controls how the question is rendered. |
string | null | $number | The question number to display. |
moodle_page | null | $page | the page the question is being redered to. (Optional. Defaults to $PAGE.) |
string | HTML fragment representing the question. |
|
inherited |
Like render_question() but displays the question at the past step indicated by $seq, rather than showing the latest step.
int | $seq | the seq number of the past state to display. |
question_display_options | $options | controls how the question is rendered. |
string | null | $number | The question number to display. 'i' is a special value that gets displayed as Information. Null means no number is displayed. |
string | $preferredbehaviour | the preferred behaviour. It is slightly annoying that this needs to be passed, but unavoidable for now. |
string | HTML fragment representing the question. |
|
inherited |
Generate any bits of HTML that needs to go in the <head> tag when this question attempt is displayed in the body.
string | HTML fragment. |
|
inherited |
Calls question_rewrite_question_urls() with appropriate parameters for content belonging to this question.
string | $text | the content to output. |
string | $component | the component name (normally 'question' or 'qtype_...') |
string | $filearea | the name of the file area. |
int | $itemid | the item id. |
string | the content with the URLs rewritten. |
|
inherited |
Calls question_rewrite_question_urls() with appropriate parameters for content belonging to responses to this question.
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. |
question_attempt_step | $step | the step the response is coming from. |
string | the content with the URLs rewritten. |
|
inherited |
Use a strategy to pick a variant.
question_variant_selection_strategy | $variantstrategy | a strategy. |
int | the selected variant. |
|
inherited |
For internal use only.
Set the id of the corresponding database row.
int | $id | the id of row for this question_attempt, if it is stored in the database. |
Reimplemented in question_attempt_with_restricted_history.
|
inherited |
Set the flagged state of this question.
bool | $flagged | the new state. |
Reimplemented in question_attempt_with_restricted_history.
|
inherited |
Change the max mark for this question_attempt.
float | $maxmark | the new max mark. |
|
inherited |
Set some metadata for this question attempt.
string | $name | the name of the metadata variable to return. |
string | $value | the value to set that metadata variable to. |
|
inherited |
You should almost certainly not call this method from your code.
It is for internal use only.
question_usage_observer | that should be used to tracking changes made to this qa. |
|
inherited |
Change the quetsion summary.
Note, that this is almost never necessary. This method was only added to work around a limitation of the Opaque protocol, which only sends questionLine at the end of an attempt.
string | $questionsummary | the new summary to set. |
Reimplemented in question_attempt_with_restricted_history.
|
inherited |
Set the number used to identify this question_attempt within the usage.
For internal use only.
int | $slot |
Reimplemented in question_attempt_with_restricted_history.
|
inherited |
Set the id of the question_usage_by_activity we belong to.
For internal use only.
int|string | the new id. |
Reimplemented in question_attempt_with_restricted_history.
|
inherited |
Start this question attempt.
You should not call this method directly. Call question_usage_by_activity::start_question() instead.
string | question_behaviour | $preferredbehaviour | the name of the desired archetypal behaviour, or an actual behaviour instance. |
int | $variant | the variant of the question to start. Between 1 and $this->get_question()->get_num_variants() inclusive. |
array | $submitteddata | optional, used when re-starting to keep the same initial state. |
int | $timestamp | optional, the timstamp to record for this action. Defaults to now. |
int | $userid | optional, the user to attribute this action to. Defaults to the current user. |
int | $existingstepid | optional, 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. |
Reimplemented in question_attempt_with_restricted_history.
|
inherited |
Start this question attempt, starting from the point that the previous attempt $oldqa had reached.
You should not call this method directly. Call question_usage_by_activity::start_question_based_on() instead.
question_attempt | $oldqa | a previous attempt at this quetsion that defines the starting point. |
|
inherited |
Produce a plain-text summary of what the user did during a step.
question_attempt_step | $step | the step in question. |
string | a summary of what was done during that step. |
|
inherited |
Verify if this question_attempt in can be regraded with that other question version.
question_definition | $otherversion | a different version of the question to use in the regrade. |
string|null | null if the regrade can proceed, else a reason why not. |
|
inherited |
Validate the manual mark for a question.
string | $currentmark | the user input (e.g. '1,0', '1,0' or 'invalid'. |
string | any errors with the value, or '' if it is OK. |
|
protectedinherited |
if, when we loaded the step from the DB, there was an autosaved step, we save a pointer to it here.
(It is also added to the $steps array.)
|
protectedinherited |
the behaviour controlling this attempt.
null until start() is called.
|
protectedinherited |
the maximum mark that can be scored at this question.
Actually, this is only really a nominal maximum. It might be better thought of as the question weight.
|
protectedinherited |
plain text summary of the variant of the question the student saw.
Intended for reporting purposes.
|
protectedinherited |
plain text summary of the response the student gave.
Intended for reporting purposes.
|
protectedinherited |
plain text summary of the correct response to this question variant the student saw.
The format should be similar to responsesummary. Intended for reporting purposes.
|
protectedinherited |
of .
The steps in this attempt.
|
inherited |
means all tries at a question during an attempt by a user.
Constant used when calling classify response.
|
inherited |
means first try at a question during an attempt by a user.
Constant used when calling classify response.
|
inherited |
means last try at a question during an attempt by a user.
Constant used when calling classify response.
|
inherited |
Should not longer be used.