|
Moodle
2.2.1
http://www.collinsharper.com
|


Public Member Functions | |
| get_question_options ($question) | |
| get_numerical_units (&$question) | |
| get_default_numerical_unit ($question) | |
| get_numerical_options ($question) | |
| save_question_options ($question) | |
| save_unit_options ($question) | |
| save_units ($question) | |
| initialise_numerical_answers (question_definition $question, $questiondata) | |
| make_answer_processor ($units, $unitsleft) | |
| delete_question ($questionid, $contextid) | |
| get_random_guess_score ($questiondata) | |
| add_unit ($questiondata, $answer, $unit=null) | |
| get_possible_responses ($questiondata) | |
| apply_unit ($rawresponse, $units, $unitsleft) | |
| move_files ($questionid, $oldcontextid, $newcontextid) | |
Data Fields | |
| const | UNITINPUT = 0 |
| const | UNITRADIO = 1 |
| const | UNITSELECT = 2 |
| const | UNITNONE = 3 |
| const | UNITGRADED = 1 |
| const | UNITOPTIONAL = 0 |
| const | UNITGRADEDOUTOFMARK = 1 |
| const | UNITGRADEDOUTOFMAX = 2 |
Protected Member Functions | |
| initialise_question_instance (question_definition $question, $questiondata) | |
| delete_files ($questionid, $contextid) | |
The numerical question type class.
This class contains some special features in order to make the question type embeddable within a multianswer (cloze) question
Definition at line 42 of file questiontype.php.
| add_unit | ( | $ | questiondata, |
| $ | answer, | ||
| $ | unit = null |
||
| ) |
Add a unit to a response for display.
| object | $questiondata | the data defining the quetsion. |
| string | $answer | a response. |
| object | $unit | a unit. If null, get_default_numerical_unit() is used. |
Definition at line 400 of file questiontype.php.


| apply_unit | ( | $ | rawresponse, |
| $ | units, | ||
| $ | unitsleft | ||
| ) |
Checks if the $rawresponse has a unit and applys it if appropriate.
| string | $rawresponse | The response string to be converted to a float. |
| array | $units | An array with the defined units, where the unit is the key and the multiplier the value. |
Definition at line 459 of file questiontype.php.


| delete_files | ( | $ | questionid, |
| $ | contextid | ||
| ) | [protected] |
Delete all the files belonging to this question.
| int | $questionid | the question being deleted. |
| int | $contextid | the context the question is in. |
Reimplemented from question_type.
Definition at line 475 of file questiontype.php.

| delete_question | ( | $ | questionid, |
| $ | contextid | ||
| ) |
Deletes the question-type specific data when a question is deleted.
| int | $question | the question being deleted. |
| int | $contextid | the context this quesiotn belongs to. |
Reimplemented from question_type.
Definition at line 375 of file questiontype.php.
| get_default_numerical_unit | ( | $ | question | ) |
| get_numerical_options | ( | $ | question | ) |
Definition at line 124 of file questiontype.php.


| get_numerical_units | ( | &$ | question | ) |
Definition at line 97 of file questiontype.php.


| get_possible_responses | ( | $ | questiondata | ) |
This method should return all the possible types of response that are recognised for this question.
The question is modelled as comprising one or more subparts. For each subpart, there are one or more classes that that students response might fall into, each of those classes earning a certain score.
For example, in a shortanswer question, there is only one subpart, the text entry field. The response the student gave will be classified according to which of the possible $question->options->answers it matches.
For the matching question type, there will be one subpart for each question stem, and for each stem, each of the possible choices is a class of student's response.
A response is an object with two fields, ->responseclass is a string presentation of that response, and ->fraction, the credit for a response in that class.
Array keys have no specific meaning, but must be unique, and must be the same if this function is called repeatedly.
| object | $question | the question definition data. |
Reimplemented from question_type.
Definition at line 416 of file questiontype.php.

| get_question_options | ( | $ | question | ) |
Loads the question type specific options for the question.
This function loads any question type specific options for the question from the database into the question object. This information is placed in the $question->options field. A question type is free, however, to decide on a internal structure of the options field.
| object | $question | The question object for the question. This object should be updated to include the question type specific information (it is passed by reference). |
Reimplemented from question_type.
Definition at line 54 of file questiontype.php.

| get_random_guess_score | ( | $ | questiondata | ) |
| object | $question |
Reimplemented from question_type.
Definition at line 384 of file questiontype.php.
| initialise_numerical_answers | ( | question_definition $ | question, |
| $ | questiondata | ||
| ) |
| initialise_question_instance | ( | question_definition $ | question, |
| $ | questiondata | ||
| ) | [protected] |
Initialise the common question_definition fields.
| question_definition | $question | the question_definition we are creating. |
| object | $questiondata | the question data loaded from the database. |
Reimplemented from question_type.
Definition at line 341 of file questiontype.php.

| make_answer_processor | ( | $ | units, |
| $ | unitsleft | ||
| ) |
| move_files | ( | $ | questionid, |
| $ | oldcontextid, | ||
| $ | newcontextid | ||
| ) |
Move all the files belonging to this question from one context to another.
| int | $questionid | the question being moved. |
| int | $oldcontextid | the context it is moving from. |
| int | $newcontextid | the context it is moving to. |
Reimplemented from question_type.
Definition at line 468 of file questiontype.php.

| save_question_options | ( | $ | question | ) |
Save the units and the answers associated with this question.
Reimplemented from question_type.
Definition at line 151 of file questiontype.php.

| save_unit_options | ( | $ | question | ) |
The numerical options control the display and the grading of the unit part of the numerical question and related types (calculateds) Questions previous to 2.0 do not have this table as multianswer questions in all versions including 2.0. The default values are set to give the same grade as old question.
Definition at line 252 of file questiontype.php.


| save_units | ( | $ | question | ) |
Definition at line 306 of file questiontype.php.


| const UNITGRADED = 1 |
Definition at line 48 of file questiontype.php.
| const UNITGRADEDOUTOFMARK = 1 |
Definition at line 51 of file questiontype.php.
| const UNITGRADEDOUTOFMAX = 2 |
Definition at line 52 of file questiontype.php.
| const UNITINPUT = 0 |
Definition at line 43 of file questiontype.php.
| const UNITNONE = 3 |
Definition at line 47 of file questiontype.php.
| const UNITOPTIONAL = 0 |
Definition at line 49 of file questiontype.php.
| const UNITRADIO = 1 |
Definition at line 44 of file questiontype.php.
| const UNITSELECT = 2 |
Definition at line 45 of file questiontype.php.