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

Public Member Functions

 __construct ($realqas, $extraprefix)
 add_prefix ($field)
 remove_prefix ($field)
 filter_array ($data)
 get_state ()
 set_state ($state)
 get_fraction ()
 set_fraction ($fraction)
 get_user_id ()
 get_timecreated ()
 has_qt_var ($name)
 get_qt_var ($name)
 set_qt_var ($name, $value)
 get_qt_data ()
 has_behaviour_var ($name)
 get_behaviour_var ($name)
 set_behaviour_var ($name, $value)
 get_behaviour_data ()
 get_submitted_data ()
 get_all_data ()
 get_qt_files ($name, $contextid)
 prepare_response_files_draft_itemid ($name, $contextid)
 prepare_response_files_draft_itemid_with_text ($name, $contextid, $text)
 rewrite_response_pluginfile_urls ($text, $contextid, $name, $extras)

Protected Attributes

 $realstep
 $extraprefix

Detailed Description

This is an adapter class that wraps a 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.

Definition at line 496 of file questionattemptstep.php.


Constructor & Destructor Documentation

__construct ( realqas,
extraprefix 
)

Constructor.

Parameters:
question_attempt_step$realqasthe step to wrap. (Can be null if you just want to call add/remove.prefix.)
unknown_type$extraprefixthe extra prefix that is used for date fields.

Definition at line 508 of file questionattemptstep.php.


Member Function Documentation

add_prefix ( field)

Add the extra prefix to a field name.

Parameters:
string$fieldthe plain field name.
Returns:
string the field name with the extra bit of prefix added.

Definition at line 518 of file questionattemptstep.php.

Here is the caller graph for this function:

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$datasome of the data stored in this step.
Returns:
array the data with the keys ajusted using remove_prefix().

Definition at line 550 of file questionattemptstep.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Get all the data. behaviour variables have the - at the start of their name. This is only intended for internal use, for example by question_engine_data_mapper::insert_question_attempt_step(), however, it can ocasionally be useful in test code. It should not be considered part of the public API of this class.

Parameters:
arrayname => value pairs.

Reimplemented from question_attempt_step.

Definition at line 620 of file questionattemptstep.php.

Here is the call graph for this function:

Get all the behaviour variables.

Parameters:
arrayname => value pairs.

Reimplemented from question_attempt_step.

Definition at line 612 of file questionattemptstep.php.

Here is the call graph for this function:

get_behaviour_var ( name)
Parameters:
string$namethe name of an behaviour variable to look for in the submitted data.
Returns:
string the requested variable, or null if the variable is not set.

Reimplemented from question_attempt_step.

Definition at line 604 of file questionattemptstep.php.

Here is the call graph for this function:

Returns:
null|number the fraction (grade on a scale of minfraction .. 1.0) or null if this step has not been marked.

Reimplemented from question_attempt_step.

Definition at line 568 of file questionattemptstep.php.

Get all the question type variables.

Parameters:
arrayname => value pairs.

Reimplemented from question_attempt_step.

Definition at line 596 of file questionattemptstep.php.

Here is the call graph for this function:

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$namethe name of the associated variable.
Returns:
array of stored_files.

Reimplemented from question_attempt_step.

Definition at line 624 of file questionattemptstep.php.

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

Reimplemented from question_attempt_step.

Definition at line 588 of file questionattemptstep.php.

Here is the call graph for this function:

get_state ( )
Returns:
question_state The state after this step.

Reimplemented from question_attempt_step.

Definition at line 560 of file questionattemptstep.php.

Get all the submitted data, but not the cached data. behaviour variables have the - at the start of their name. This is only really intended for use by question_attempt::regrade(), it should not be considered part of the public API.

Parameters:
arrayname => value pairs.

Reimplemented from question_attempt_step.

Definition at line 616 of file questionattemptstep.php.

Here is the call graph for this function:

Returns:
int the timestamp when this step was created.

Reimplemented from question_attempt_step.

Definition at line 580 of file questionattemptstep.php.

Returns:
int the id of the user resonsible for creating this step.

Reimplemented from question_attempt_step.

Definition at line 576 of file questionattemptstep.php.

has_behaviour_var ( name)
Parameters:
string$namethe name of an behaviour variable to look for in the submitted data.
Returns:
bool whether a variable with this name exists in the question type data.

Reimplemented from question_attempt_step.

Definition at line 600 of file questionattemptstep.php.

Here is the call graph for this function:

has_qt_var ( name)
Parameters:
string$namethe name of a question type variable to look for in the submitted data.
Returns:
bool whether a variable with this name exists in the question type data.

Reimplemented from question_attempt_step.

Definition at line 584 of file questionattemptstep.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 step.

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

Reimplemented from question_attempt_step.

Definition at line 629 of file questionattemptstep.php.

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$namethe variable name the files belong to.
int$contextidthe id of the context the quba belongs to.
string$textthe text to update the URLs in.
Returns:
array(int, string) the draft itemid and the text with URLs rewritten.

Reimplemented from question_attempt_step.

Definition at line 634 of file questionattemptstep.php.

remove_prefix ( field)

Remove the extra prefix from a field name if it is present.

Parameters:
string$fieldthe extended field name.
Returns:
string the field name with the extra bit of prefix removed, or null if the extre prefix was not present.

Definition at line 536 of file questionattemptstep.php.

Here is the caller graph for this function:

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 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$extraextra file path components.
Returns:
string the rewritten text.

Reimplemented from question_attempt_step.

Definition at line 639 of file questionattemptstep.php.

set_behaviour_var ( name,
value 
)

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 from question_attempt_step.

Definition at line 608 of file questionattemptstep.php.

Here is the call graph for this function:

set_fraction ( fraction)

Set the fraction. Normally only called by behaviours.

Parameters:
null | number$fractionthe fraction to set.

Reimplemented from question_attempt_step.

Definition at line 572 of file questionattemptstep.php.

set_qt_var ( name,
value 
)

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 from question_attempt_step.

Definition at line 592 of file questionattemptstep.php.

Here is the call graph for this function:

set_state ( state)

Set the state. Normally only called by behaviours.

Parameters:
question_state$stateone of the question_state constants.

Reimplemented from question_attempt_step.

Definition at line 564 of file questionattemptstep.php.


Field Documentation

$extraprefix [protected]

Definition at line 500 of file questionattemptstep.php.

$realstep [protected]

Definition at line 498 of file questionattemptstep.php.


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