Moodle  2.2.1
http://www.collinsharper.com
question_attempt Class Reference
Inheritance diagram for question_attempt:

Public Member Functions

 __construct (question_definition $question, $usageid, question_usage_observer $observer=null, $maxmark=null)
 get_full_qa ()
 get_question ()
 get_variant ()
 set_slot ($slot)
 get_slot ()
 get_database_id ()
 set_database_id ($id)
 set_observer ($observer)
 get_usage_id ()
 set_usage_id ($usageid)
 get_behaviour_name ()
 get_behaviour ()
 set_flagged ($flagged)
 is_flagged ()
 get_flag_field_name ()
 get_qt_field_name ($varname)
 get_behaviour_field_name ($varname)
 get_control_field_name ($varname)
 get_field_prefix ()
 get_step ($i)
 get_num_steps ()
 get_last_step ()
 get_step_iterator ()
 get_full_step_iterator ()
 get_reverse_step_iterator ()
 get_last_qt_data ($default=array())
 get_last_step_with_qt_var ($name)
 get_last_step_with_behaviour_var ($name)
 get_last_qt_var ($name, $default=null)
 get_last_qt_files ($name, $contextid)
 get_response_file_url (stored_file $file)
 prepare_response_files_draft_itemid ($name, $contextid)
 get_last_behaviour_var ($name, $default=null)
 get_state ()
 get_state_string ($showcorrectness)
 get_state_class ($showcorrectness)
 get_last_action_time ()
 get_fraction ()
 has_marks ()
 get_mark ()
 get_current_manual_mark ()
 fraction_to_mark ($fraction)
 get_max_mark ()
 get_min_fraction ()
 format_mark ($dp)
 format_fraction_as_mark ($fraction, $dp)
 format_max_mark ($dp)
 get_applicable_hint ()
 summarise_action (question_attempt_step $step)
 rewrite_pluginfile_urls ($text, $component, $filearea, $itemid)
 rewrite_response_pluginfile_urls ($text, $contextid, $name, question_attempt_step $step)
 render ($options, $number, $page=null)
 render_head_html ($page=null)
 render_at_step ($seq, $options, $number, $preferredbehaviour)
 check_file_access ($options, $component, $filearea, $args, $forcedownload)
 select_variant (question_variant_selection_strategy $variantstrategy)
 start ($preferredbehaviour, $variant, $submitteddata=array(), $timestamp=null, $userid=null, $existingstepid=null)
 start_based_on (question_attempt $oldqa)
 get_submitted_var ($name, $type, $postdata=null)
 get_submitted_data ($postdata=null)
 get_correct_response ()
 set_question_summary ($questionsummary)
 get_question_summary ()
 get_response_summary ()
 get_right_answer_summary ()
 process_action ($submitteddata, $timestamp=null, $userid=null, $existingstepid=null)
 finish ($timestamp=null, $userid=null)
 regrade (question_attempt $oldqa, $finished)
 manual_grade ($comment, $mark, $timestamp=null, $userid=null)
 has_manual_comment ()
 get_manual_comment ()
 classify_response ()

Static Public Member Functions

static load_from_records ($records, $questionattemptid, question_usage_observer $observer, $preferredbehaviour)

Data Fields

const USE_RAW_DATA = 'use raw data'
const PARAM_MARK = 'parammark'
const PARAM_FILES = 'paramfiles'
const PARAM_CLEANHTML_FILES = 'paramcleanhtmlfiles'
const KEEP = true
const DISCARD = false

Protected Member Functions

 extra_file_path_components ()
 add_step (question_attempt_step $step)
 get_resume_data ()
 process_response_files ($name, $draftidname, $postdata=null, $text=null)
 get_expected_data ($expected, $postdata, $extraprefix)
 get_all_submitted_qt_vars ($postdata)

Protected Attributes

 $id = null
 $usageid
 $slot = null
 $behaviour = null
 $question
 $variant
 $maxmark
 $minfraction = null
 $questionsummary = null
 $responsesummary = null
 $rightanswer = null
 $steps = array()
 $flagged = false
 $observer

Detailed Description

Tracks an attempt at one particular question in a question_usage_by_activity.

Most calling code should need to access objects of this class. They should be able to do everything through the usage interface. This class is an internal implementation detail of the question engine.

Instances of this class correspond to rows in the question_attempts table, and a collection of question_attempt_steps. Question inteaction models and question types do work with question_attempt objects.

Definition at line 44 of file questionattempt.php.


Constructor & Destructor Documentation

__construct ( question_definition question,
usageid,
question_usage_observer observer = null,
maxmark = null 
)

#@- Create a new question_attempt. Normally you should create question_attempts indirectly, by calling question_usage_by_activity::add_question().

Parameters:
question_definition$questionthe question this is an attempt at.
int | string$usageidThe id of the question_usage_by_activity we belong to. Used by get_field_prefix().
question_usage_observer$observertracks changes to the useage this attempt is part of. (Optional, a question_usage_null_observer is used if one is not passed.
number$maxmarkthe maximum grade for this question_attempt. If not passed, $question->defaultmark is used.

Definition at line 148 of file questionattempt.php.


Member Function Documentation

add_step ( question_attempt_step step) [protected]

Add a step to this question attempt.

Parameters:
question_attempt_step$stepthe new step.

Reimplemented in question_attempt_with_restricted_history.

Definition at line 785 of file questionattempt.php.

Here is the caller graph for this function:

check_file_access ( options,
component,
filearea,
args,
forcedownload 
)

Checks whether the users is allow to be served a particular file.

Parameters:
question_display_options$optionsthe options that control display of the question.
string$componentthe name of the component we are serving files for.
string$fileareathe name of the file area.
array$argsthe remaining bits of the file path.
bool$forcedownloadwhether the user must be forced to download the file.
Returns:
bool true if the user can access this file.

Definition at line 777 of file questionattempt.php.

Returns:
array subpartid => object with fields ->responseclassid matches one of the values returned from quetion_type::get_possible_responses. ->response the actual response the student gave to this part, as a string. ->fraction the credit awarded for this subpart, may be null. returns an empty array if no analysis is possible.

Definition at line 1151 of file questionattempt.php.

Here is the caller graph for this function:

extra_file_path_components ( ) [protected]

Helper function used by rewrite_pluginfile_urls() and rewrite_response_pluginfile_urls().

Returns:
array ids that need to go into the file paths.

Definition at line 685 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

finish ( timestamp = null,
userid = null 
)

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.

Parameters:
int$timestampthe time to record for the action. (If not given, use now.)
int$useridthe user to attribute the aciton to. (If not given, use the current user.)

Definition at line 1074 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

format_fraction_as_mark ( fraction,
dp 
)

The current mark, formatted to the stated number of decimal places. Uses format_float() to format floats according to the current locale.

Parameters:
int$dpnumber of decimal places.
Returns:
string formatted mark.

Definition at line 648 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

format_mark ( dp)

The current mark, formatted to the stated number of decimal places. Uses format_float() to format floats according to the current locale.

Parameters:
int$dpnumber of decimal places.
Returns:
string formatted mark.

Definition at line 638 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

format_max_mark ( dp)

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.

Parameters:
int$dpnumber of decimal places.
Returns:
string formatted maximum mark.

Definition at line 659 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

fraction_to_mark ( fraction)
Parameters:
number | null$fractiona fraction.
Returns:
number|null the corresponding mark.

Definition at line 612 of file questionattempt.php.

Here is the caller graph for this function:

get_all_submitted_qt_vars ( postdata) [protected]

Get all the submitted question type data for this question, whithout checking that it is valid or cleaning it in any way.

Returns:
array name => value.

Definition at line 961 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Return the hint that applies to the question in its current state, or null.

Returns:
question_hint|null

Definition at line 667 of file questionattempt.php.

Here is the caller graph for this function:

For internal use only.

Returns:
question_behaviour the behaviour that is controlling this attempt.

Definition at line 248 of file questionattempt.php.

Here is the caller graph for this function:

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.

See the comment on question_attempt_step for an explanation of question type and behaviour variables.

Parameters:
$varnameThe short form of the variable name.
Returns:
string The field name to use.

Definition at line 300 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
string the name of the behaviour that is controlling this attempt.

Definition at line 240 of file questionattempt.php.

Here is the caller graph for this function:

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.

Examples are :sequencecheck and :flagged

Parameters:
$varnameThe short form of the variable name.
Returns:
string The field name to use.

Definition at line 313 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Returns:
array|null name => value pairs that could be passed to process_action().

Definition at line 1005 of file questionattempt.php.

This is used by the manual grading code, particularly in association with validation. If there is a mark submitted in the request, then use that, otherwise use the latest mark for this question.

Returns:
number the current mark for this question. get_fraction() * get_max_mark().

Definition at line 599 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
int the id of row for this question_attempt, if it is stored in the database. null if not.

Definition at line 203 of file questionattempt.php.

Here is the caller graph for this function:

get_expected_data ( expected,
postdata,
extraprefix 
) [protected]

Get any data from the request that matches the list of expected params.

Parameters:
array$expectedvariable name => PARAM_... constant.
string$extraprefix'-' or ''.
Returns:
array name => value.

Definition at line 944 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Parameters:
$varnameThe short form of the variable name.
Returns:
string The field name to use.

Definition at line 327 of file questionattempt.php.

Here is the caller graph for this function:

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.

Returns:
string The field name to use.

Definition at line 272 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Returns:
number the current fraction.

Definition at line 574 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

This method exists so that question_attempt_with_restricted_history can override it. You should not normally need to call it.

Returns:
question_attempt return ourself.

Reimplemented in question_attempt_with_restricted_history.

Definition at line 168 of file questionattempt.php.

Here is the caller graph for this function:

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.

Returns:
question_attempt_step_iterator for iterating over the steps in this attempt, in order.

Reimplemented in question_attempt_with_restricted_history.

Definition at line 381 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
int the timestamp of the most recent step in this question attempt.

Definition at line 565 of file questionattempt.php.

Here is the call graph for this function:

get_last_behaviour_var ( name,
default = null 
)

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.

Parameters:
string$namethe name of the variable to get.
mixeddefault the value to return in the variable has never been set. (Optional, defaults to null.)
Returns:
mixed string value, or $default if it has never been set.

Definition at line 526 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_last_qt_data ( default = array())

Get the qt data from the latest step that has any qt data. Return $default array if it is no step has qt data.

Parameters:
string$namethe name of the variable to get.
mixeddefault the value to return no step has qt data. (Optional, defaults to an empty array.)
Returns:
array|mixed the data, or $default if there is not any.

Definition at line 402 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_last_qt_files ( name,
contextid 
)

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.
Returns:
array of stored_files.

Definition at line 468 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_last_qt_var ( name,
default = null 
)

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.

Parameters:
string$namethe name of the variable to get.
mixeddefault the value to return in the variable has never been set. (Optional, defaults to null.)
Returns:
mixed string value, or $default if it has never been set.

Definition at line 452 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Return the latest step in this question_attempt. For internal/test code use only.

Returns:
question_attempt_step

Definition at line 358 of file questionattempt.php.

Here is the caller graph for this function:

Get the last step with a particular behaviour variable set.

Parameters:
string$namethe name of the variable to get.
Returns:
question_attempt_step the last step, or a step with no variables if there was not a real step.

Definition at line 433 of file questionattempt.php.

Here is the call graph for this function:

Get the last step with a particular question type varialbe set.

Parameters:
string$namethe name of the variable to get.
Returns:
question_attempt_step the last step, or a step with no variables if there was not a real step.

Definition at line 418 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
array(string, int) the most recent manual comment that was added to this question, and the FORMAT_... it is.

Definition at line 1134 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_mark ( )
Returns:
number the current mark for this question. get_fraction() * get_max_mark().

Definition at line 588 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
number the maximum mark possible for this question attempt.

Definition at line 620 of file questionattempt.php.

Here is the caller graph for this function:

Returns:
number the maximum mark possible for this question attempt.

Definition at line 625 of file questionattempt.php.

Here is the caller graph for this function:

Get the number of steps in this attempt. For internal/test code use only.

Returns:
int the number of steps we currently have.

Definition at line 349 of file questionattempt.php.

Here is the caller graph for this function:

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.

See the comment on question_attempt_step for an explanation of question type and behaviour variables.

Parameters:
$varnameThe short form of the variable name.
Returns:
string The field name to use.

Definition at line 286 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
question_definition the question this is an attempt at.

Definition at line 173 of file questionattempt.php.

Here is the caller graph for this function:

Returns:
string a simple textual summary of the question that was asked.

Definition at line 1031 of file questionattempt.php.

Here is the caller graph for this function:

Get the URL of a file that belongs to a response variable of this question_attempt.

Parameters:
stored_file$filethe file to link to.
Returns:
string the URL of that file.

Definition at line 483 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
string a simple textual summary of response given.

Definition at line 1038 of file questionattempt.php.

Here is the caller graph for this function:

get_resume_data ( ) [protected]

Used by start_based_on() to get the data needed to start a new attempt from the point this attempt has go to.

Returns:
array name => value pairs.

Definition at line 867 of file questionattempt.php.

Here is the caller graph for this function:

Returns:
question_attempt_reverse_step_iterator for iterating over the steps in this attempt, in reverse order.

Definition at line 389 of file questionattempt.php.

Here is the caller graph for this function:

Returns:
string a simple textual summary of the correct resonse.

Definition at line 1045 of file questionattempt.php.

Here is the caller graph for this function:

get_slot ( )
Returns:
int the number used to identify this question_attempt within the usage.

Definition at line 195 of file questionattempt.php.

Here is the caller graph for this function:

get_state ( )

Get the current state of this question attempt. That is, the state of the latest step.

Returns:
question_state

Definition at line 540 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_state_class ( showcorrectness)
Parameters:
bool$showcorrectnessWhether right/partial/wrong states should be distinguised.
Returns:
string a CSS class name for the current state.

Definition at line 558 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_state_string ( showcorrectness)
Parameters:
bool$showcorrectnessWhether right/partial/wrong states should be distinguised.
Returns:
string A brief textual description of the current state.

Definition at line 549 of file questionattempt.php.

Here is the caller graph for this function:

get_step ( i)

Get one of the steps in this attempt. For internal/test code use only.

Parameters:
int$ithe step number.
Returns:
question_attempt_step

Definition at line 337 of file questionattempt.php.

Here is the caller graph for this function:

Returns:
question_attempt_step_iterator for iterating over the steps in this attempt, in order.

Definition at line 369 of file questionattempt.php.

Here is the caller graph for this function:

get_submitted_data ( postdata = null)

Get all the sumbitted data belonging to this question attempt from the current request.

Parameters:
array$postdata(optional, only inteded for testing use) take the data from this array, instead of from $_POST.
Returns:
array name => value pairs that could be passed to process_action().

Definition at line 986 of file questionattempt.php.

Here is the call graph for this function:

get_submitted_var ( name,
type,
postdata = null 
)

Get a particular parameter from the current request. A wrapper round optional_param(), except that the results is returned without slashes.

Parameters:
string$namethe paramter name.
int$typeone 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.
Returns:
mixed the requested value.

Definition at line 882 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns:
int|string the id of the question_usage_by_activity we belong to.

Definition at line 226 of file questionattempt.php.

Here is the caller graph for this function:

Get the variant of the question being used in a given slot.

Returns:
int the variant number.

Definition at line 181 of file questionattempt.php.

Here is the caller graph for this function:

Returns:
bool Whether this question attempt has had a manual comment added.

Definition at line 1121 of file questionattempt.php.

Here is the caller graph for this function:

has_marks ( )
Returns:
bool whether this question attempt has a non-zero maximum mark.

Definition at line 579 of file questionattempt.php.

Here is the caller graph for this function:

Returns:
bool whether this question is currently flagged.

Definition at line 262 of file questionattempt.php.

Here is the caller graph for this function:

static load_from_records ( records,
questionattemptid,
question_usage_observer observer,
preferredbehaviour 
) [static]

Create a question_attempt_step from records loaded from the database.

For internal use only.

Parameters:
Iterator$recordsRaw records loaded from the database.
int$questionattemptidThe id of the question_attempt to extract.
Returns:
question_attempt The newly constructed question_attempt.

Definition at line 1164 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

manual_grade ( comment,
mark,
timestamp = null,
userid = null 
)

Perform a manual grading action on this attempt.

Parameters:
$commentthe comment being added.
$markthe new mark. (Optional, if not given, then only a comment is added.)
int$timestampthe time to record for the action. (If not given, use now.)
int$useridthe user to attribute the aciton to. (If not given, use the current user.)
Returns:
unknown_type

Definition at line 1111 of file questionattempt.php.

Here is the call graph for this function:

prepare_response_files_draft_itemid ( name,
contextid 
)

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.

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

Definition at line 503 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

process_action ( submitteddata,
timestamp = null,
userid = null,
existingstepid = null 
)

Perform the action described by $submitteddata.

Parameters:
array$submitteddatathe submitted data the determines the action.
int$timestampthe time to record for the action. (If not given, use now.)
int$useridthe user to attribute the aciton to. (If not given, use the current user.)

Definition at line 1055 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

process_response_files ( name,
draftidname,
postdata = null,
text = null 
) [protected]

Handle a submitted variable representing uploaded files.

Parameters:
string$namethe field name.
string$draftidnamethe 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$textoptional reponse text.
Returns:
question_file_saver that can be used to save the files later.

Definition at line 923 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

regrade ( question_attempt oldqa,
finished 
)

Perform a regrade. This replays all the actions from $oldqa into this attempt.

Parameters:
question_attempt$oldqathe attempt to regrade.
bool$finishedwhether the question attempt should be forced to be finished after the regrade, or whether it may still be in progress (default false).

Definition at line 1085 of file questionattempt.php.

Here is the call graph for this function:

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.

Parameters:
question_display_options$optionscontrols how the question is rendered.
string | null$numberThe question number to display.
Returns:
string HTML fragment representing the question.

Definition at line 728 of file questionattempt.php.

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.

Parameters:
int$seqthe seq number of the past state to display.
question_display_options$optionscontrols how the question is rendered.
string | null$numberThe question number to display. 'i' is a special value that gets displayed as Information. Null means no number is displayed.
Returns:
string HTML fragment representing the question.

Definition at line 763 of file questionattempt.php.

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.

Returns:
string HTML fragment.

Definition at line 743 of file questionattempt.php.

rewrite_pluginfile_urls ( text,
component,
filearea,
itemid 
)

Calls question_rewrite_question_urls() with appropriate parameters for content belonging to this question.

Parameters:
string$textthe content to output.
string$componentthe component name (normally 'question' or 'qtype_...')
string$fileareathe name of the file area.
int$itemidthe item id.
Returns:
srting the content with the URLs rewritten.

Definition at line 698 of file questionattempt.php.

Here is the call graph for this function:

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.

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.
question_attempt_step$stepthe step the response is coming from.
Returns:
srting the content with the URLs rewritten.

Definition at line 714 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Use a strategy to pick a variant.

Parameters:
question_variant_selection_strategy$variantstrategya strategy.
Returns:
int the selected variant.

Definition at line 796 of file questionattempt.php.

Here is the call graph for this function:

set_database_id ( id)

For internal use only. Set the id of the corresponding database row.

Parameters:
int$idthe id of row for this question_attempt, if it is stored in the database.

Reimplemented in question_attempt_with_restricted_history.

Definition at line 212 of file questionattempt.php.

Here is the caller graph for this function:

set_flagged ( flagged)

Set the flagged state of this question.

Parameters:
bool$flaggedthe new state.

Reimplemented in question_attempt_with_restricted_history.

Definition at line 256 of file questionattempt.php.

set_observer ( observer)

You should almost certainly not call this method from your code. It is for internal use only.

Parameters:
question_usage_observerthat should be used to tracking changes made to this qa.

Definition at line 221 of file questionattempt.php.

set_question_summary ( questionsummary)

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.

Parameters:
$questionsummarythe new summary to set.

Reimplemented in question_attempt_with_restricted_history.

Definition at line 1023 of file questionattempt.php.

set_slot ( slot)

Set the number used to identify this question_attempt within the usage. For internal use only.

Parameters:
int$slot

Reimplemented in question_attempt_with_restricted_history.

Definition at line 190 of file questionattempt.php.

set_usage_id ( usageid)

Set the id of the question_usage_by_activity we belong to. For internal use only.

Parameters:
int|stringthe new id.

Reimplemented in question_attempt_with_restricted_history.

Definition at line 235 of file questionattempt.php.

start ( preferredbehaviour,
variant,
submitteddata = array(),
timestamp = null,
userid = null,
existingstepid = null 
)

Start this question attempt.

You should not call this method directly. Call question_usage_by_activity::start_question() instead.

Parameters:
string | question_behaviour$preferredbehaviourthe name of the desired archetypal behaviour, or an actual model instance.
int$variantthe variant of the question to start. Between 1 and $this->get_question()->get_num_variants() inclusive.
array$submitteddataoptional, used when re-starting to keep the same initial state.
int$timestampoptional, the timstamp to record for this action. Defaults to now.
int$useridoptional, the user to attribute this action to. Defaults to the current user.
int$existingstepidoptional, 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 817 of file questionattempt.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
question_attempt$oldqaa previous attempt at this quetsion that defines the starting point.

Definition at line 858 of file questionattempt.php.

Here is the call graph for this function:

Produce a plain-text summary of what the user did during a step.

Parameters:
question_attempt_step$stepthe step in quetsion.
Returns:
string a summary of what was done during that step.

Definition at line 676 of file questionattempt.php.

Here is the caller graph for this function:


Field Documentation

$behaviour = null [protected]

Definition at line 82 of file questionattempt.php.

$flagged = false [protected]

Definition at line 122 of file questionattempt.php.

$id = null [protected]

Definition at line 70 of file questionattempt.php.

$maxmark [protected]

Definition at line 91 of file questionattempt.php.

$minfraction = null [protected]

Definition at line 97 of file questionattempt.php.

$observer [protected]

Definition at line 125 of file questionattempt.php.

$question [protected]

Definition at line 85 of file questionattempt.php.

$questionsummary = null [protected]

Definition at line 103 of file questionattempt.php.

$responsesummary = null [protected]

Definition at line 109 of file questionattempt.php.

$rightanswer = null [protected]

Definition at line 116 of file questionattempt.php.

$slot = null [protected]

Definition at line 76 of file questionattempt.php.

$steps = array() [protected]

Definition at line 119 of file questionattempt.php.

$usageid [protected]

Definition at line 73 of file questionattempt.php.

$variant [protected]

Definition at line 88 of file questionattempt.php.

const DISCARD = false

Definition at line 132 of file questionattempt.php.

const KEEP = true

#@+ Constants used by the intereaction models to indicate whether the current pending step should be kept or discarded.

Definition at line 131 of file questionattempt.php.

const PARAM_CLEANHTML_FILES = 'paramcleanhtmlfiles'

Definition at line 67 of file questionattempt.php.

const PARAM_FILES = 'paramfiles'

Definition at line 61 of file questionattempt.php.

const PARAM_MARK = 'parammark'

Definition at line 55 of file questionattempt.php.

const USE_RAW_DATA = 'use raw data'

Definition at line 49 of file questionattempt.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations