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

Public Member Functions

 can_analyse_responses ()
 get_question_options ($question)
 save_question_options ($question)
 save_question ($authorizedquestion, $form)
 delete_question ($questionid, $contextid)
 get_random_guess_score ($questiondata)

Protected Member Functions

 initialise_question_instance ($question, $questiondata)

Detailed Description

The multi-answer question type class.

Definition at line 38 of file questiontype.php.


Member Function Documentation

Whether this question type can perform a frequency analysis of student responses.

If this method returns true, you must implement the get_possible_responses method, and the question_definition class must implement the classify_response method.

Returns:
bool whether this report can analyse all the student reponses for things like the quiz statistics report.

Reimplemented from question_type.

Definition at line 40 of file questiontype.php.

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 186 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.

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 44 of file questiontype.php.

Here is the call graph for this function:

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 216 of file questiontype.php.

Here is the call graph for this function:

initialise_question_instance ( question,
questiondata 
) [protected]

Definition at line 193 of file questiontype.php.

Here is the call graph for this function:

save_question ( question,
form 
)

Saves (creates or updates) a question.

Given some question info and some data about the answers this function parses, organises and saves the question It is used by question.php when saving new data from a form, and also by import.php when importing questions This function in turn calls save_question_options to save question-type specific data.

Whether we are saving a new question or updating an existing one can be determined by testing !empty($question->id). If it is not empty, we are updating.

The question will be saved in category $form->category.

Parameters:
object$questionthe question object which should be updated. For a new question will be mostly empty.
object$formthe object containing the information to save, as if from the question editing form.
object$coursenot really used any more.
Returns:
object On success, return the new question object. On failure, return an object as follows. If the error object has an errors field, display that as an error message. Otherwise, the editing form will be redisplayed with validation errors, from validation_errors field, which is itself an object, shown next to the form fields. (I don't think this is accurate any more.)

Question already exists, update.

Reimplemented from question_type.

Definition at line 171 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 81 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