|
Moodle
2.2.1
http://www.collinsharper.com
|
Public Member Functions | |
| get_a_qa ($question, $maxmark=3) | |
Static Public Member Functions | |
| static | initialise_a_question ($q) |
| static | initialise_question_data ($qdata) |
| static | initialise_question_form_data ($qdata) |
| static | get_test_helper ($qtype) |
| static | make_question ($qtype, $which=null) |
| static | get_question_data ($qtype, $which=null) |
| static | get_question_form_data ($qtype, $which=null) |
| static | make_a_multichoice_single_question () |
| static | make_a_multichoice_multi_question () |
| static | make_a_matching_question () |
| static | make_an_essay_question () |
| static | set_standard_combined_feedback_fields ($q) |
Data Fields | |
| const | STANDARD_OVERALL_CORRECT_FEEDBACK = 'Well done!' |
| const | STANDARD_OVERALL_PARTIALLYCORRECT_FEEDBACK |
| const | STANDARD_OVERALL_INCORRECT_FEEDBACK = 'That is not right at all.' |
Static Protected Member Functions | |
| static | call_question_helper_method ($methodtemplate, $qtype, $which=null) |
Static Protected Attributes | |
| static | $testhelpers = array() |
This class creates questions of various types, which can then be used when testing.
Definition at line 74 of file helpers.php.
| static call_question_helper_method | ( | $ | methodtemplate, |
| $ | qtype, | ||
| $ | which = null |
||
| ) | [static, protected] |
Call a method on a qtype_{$qtype}_test_helper class and return the result.
| string | $methodtemplate | e.g. 'make_{qtype}_question_{which}'; |
| string | $qtype | the question type to get a test question for. |
| string | $which | one of the names returned by the get_test_questions method of the relevant qtype_{$qtype}_test_helper class. |
| unknown_type | $which |
Definition at line 189 of file helpers.php.


| get_a_qa | ( | $ | question, |
| $ | maxmark = 3 |
||
| ) |
Just make a question_attempt at a question. Useful for unit tests that need to pass a $qa to methods that call format_text. Probably not safe to use for anything beyond that.
| question_definition | $question | a question. |
| number | $maxmark | the max mark to set. |
Definition at line 91 of file helpers.php.

| static get_question_data | ( | $ | qtype, |
| $ | which = null |
||
| ) | [static] |
Like make_question() but returns the datastructure from get_question_options instead of the question_definition object.
| string | $qtype | the question type to get a test question for. |
| string | $which | one of the names returned by the get_test_questions method of the relevant qtype_{$qtype}_test_helper class. |
Definition at line 237 of file helpers.php.


| static get_question_form_data | ( | $ | qtype, |
| $ | which = null |
||
| ) | [static] |
Like make_question() but returns the data what would be saved from the question editing form instead of the question_definition object.
| string | $qtype | the question type to get a test question for. |
| string | $which | one of the names returned by the get_test_questions method of the relevant qtype_{$qtype}_test_helper class. |
Definition at line 251 of file helpers.php.

| static get_test_helper | ( | $ | qtype | ) | [static] |
Get the test helper class for a particular question type.
| $qtype | the question type name, e.g. 'multichoice'. |
Definition at line 157 of file helpers.php.


| static initialise_a_question | ( | $ | q | ) | [static] |
Initialise the common fields of a question of any type.
Definition at line 98 of file helpers.php.


| static initialise_question_data | ( | $ | qdata | ) | [static] |
Definition at line 118 of file helpers.php.


| static initialise_question_form_data | ( | $ | qdata | ) | [static] |
| static make_a_matching_question | ( | ) | [static] |
Makes a matching question to classify 'Dog', 'Frog', 'Toad' and 'Cat' as 'Mammal', 'Amphibian' or 'Insect'. defaultmark 1. Stems are shuffled by default.
Definition at line 317 of file helpers.php.


| static make_a_multichoice_multi_question | ( | ) | [static] |
Makes a multichoice question with choices 'A', 'B', 'C' and 'D' shuffled. 'A' and 'C' is correct, defaultmark 1.
Definition at line 287 of file helpers.php.


| static make_a_multichoice_single_question | ( | ) | [static] |
Makes a multichoice question with choices 'A', 'B' and 'C' shuffled. 'A' is correct, defaultmark 1.
Definition at line 261 of file helpers.php.


| static make_an_essay_question | ( | ) | [static] |
Makes a truefalse question with correct ansewer true, defaultmark 1.
Definition at line 347 of file helpers.php.


| static make_question | ( | $ | qtype, |
| $ | which = null |
||
| ) | [static] |
Question types can provide a number of test question defintions. They do this by creating a qtype_{$qtype}_test_helper class that extends question_test_helper. The get_test_questions method returns the list of test questions available for this question type.
| string | $qtype | the question type to get a test question for. |
| string | $which | one of the names returned by the get_test_questions method of the relevant qtype_{$qtype}_test_helper class. |
Definition at line 223 of file helpers.php.

| static set_standard_combined_feedback_fields | ( | $ | q | ) | [static] |
Add some standard overall feedback to a question. You need to use these specific feedback strings for the corresponding contains_..._feedback methods in qbehaviour_walkthrough_test_base to works.
| question_definition | $q | the question to add the feedback to. |
Definition at line 372 of file helpers.php.

$testhelpers = array() [static, protected] |
Definition at line 81 of file helpers.php.
| const STANDARD_OVERALL_CORRECT_FEEDBACK = 'Well done!' |
Definition at line 75 of file helpers.php.
| const STANDARD_OVERALL_INCORRECT_FEEDBACK = 'That is not right at all.' |
Definition at line 78 of file helpers.php.
'Parts, but only parts, of your response are correct.'
Definition at line 76 of file helpers.php.