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

Public Member Functions

 get_question_options ($question)
 save_question_options ($question)
 delete_question ($questionid, $contextid)
 get_random_guess_score ($questiondata)
 get_possible_responses ($questiondata)
 move_files ($questionid, $oldcontextid, $newcontextid)

Static Public Member Functions

static get_numbering_styles ()

Protected Member Functions

 make_question_instance ($questiondata)
 make_hint ($hint)
 initialise_question_instance (question_definition $question, $questiondata)
 delete_files ($questionid, $contextid)

Detailed Description

The multiple choice question type.

Definition at line 36 of file questiontype.php.


Member Function Documentation

delete_files ( questionid,
contextid 
) [protected]

Delete all the files belonging to this question.

Parameters:
int$questionidthe question being deleted.
int$contextidthe context the question is in.

Reimplemented from question_type.

Definition at line 245 of file questiontype.php.

Here is the call graph for this function:

delete_question ( questionid,
contextid 
)

Deletes the question-type specific data when a question is deleted.

Parameters:
int$questionthe question being deleted.
int$contextidthe context this quesiotn belongs to.

Reimplemented from question_type.

Definition at line 177 of file questiontype.php.

static get_numbering_styles ( ) [static]
Returns:
array of the numbering styles supported. For each one, there should be a lang string answernumberingxxx in teh qtype_multichoice language file, and a case in the switch statement in number_in_style, and it should be listed in the definition of this column in install.xml.

Definition at line 230 of file questiontype.php.

Here is the caller graph for this function:

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.

Parameters:
object$questionthe question definition data.
Returns:
array keys are subquestionid, values are arrays of possible responses to that subquestion.

Reimplemented from question_type.

Definition at line 198 of file questiontype.php.

Here is the call graph for this function:

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.

Returns:
bool Indicates success or failure.
Parameters:
object$questionThe 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 37 of file questiontype.php.

get_random_guess_score ( questiondata)
Parameters:
object$question
Returns:
number|null either a fraction estimating what the student would score by guessing, or null, if it is not possible to estimate.

Reimplemented from question_type.

Definition at line 184 of file questiontype.php.

initialise_question_instance ( question_definition question,
questiondata 
) [protected]

Initialise the common question_definition fields.

Parameters:
question_definition$questionthe question_definition we are creating.
object$questiondatathe question data loaded from the database.

Reimplemented from question_type.

Definition at line 163 of file questiontype.php.

Here is the call graph for this function:

make_hint ( hint) [protected]

Create a question_hint, or an appropriate subclass for this question, from a row loaded from the database.

Parameters:
object$hintthe DB row from the question hints table.
Returns:
question_hint

Reimplemented from question_type.

Definition at line 159 of file questiontype.php.

Here is the call graph for this function:

make_question_instance ( questiondata) [protected]

Create an appropriate question_definition for the question of this type using data loaded from the database.

Parameters:
object$questiondatathe question data loaded from the database.
Returns:
question_definition an instance of the appropriate question_definition subclass. Still needs to be initialised.

Reimplemented from question_type.

Definition at line 149 of file questiontype.php.

Here is the call graph for this function:

move_files ( questionid,
oldcontextid,
newcontextid 
)

Move all the files belonging to this question from one context to another.

Parameters:
int$questionidthe question being moved.
int$oldcontextidthe context it is moving from.
int$newcontextidthe context it is moving to.

Reimplemented from question_type.

Definition at line 239 of file questiontype.php.

Here is the call graph for this function:

save_question_options ( question)

Saves question-type specific options

This is called by save_question() to save the question-type specific data

Returns:
object $result->error or $result->noticeyesno or $result->notice
Parameters:
object$questionThis holds the information from the editing form, it is not a standard question object.

Reimplemented from question_type.

Definition at line 44 of file questiontype.php.

Here is the call graph for this function:


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