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

Public Member Functions

 is_real_question_type ()
 is_usable_by_random ()
 can_analyse_responses ()
 save_question ($question, $form)
 actual_number_of_questions ($question)
 get_random_guess_score ($questiondata)

Detailed Description

The description 'question' type.

Definition at line 38 of file questiontype.php.


Member Function Documentation

actual_number_of_questions ( question)

Returns the number of question numbers which are used by the question

This function returns the number of question numbers to be assigned to the question. Most question types will have length one; they will be assigned one number. The 'description' type, however does not use up a number and so has a length of zero. Other question types may wish to handle a bundle of questions and hence return a number greater than one.

Returns:
int The number of question numbers which should be assigned to the question.
Parameters:
object$questionThe question whose length is to be determined. Question type specific information is included.

Used for the feature number-of-questions-per-page to determine the actual number of questions wrapped by this question. The question type description is not even a question in itself so it will return ZERO!

Reimplemented from question_type.

Definition at line 58 of file questiontype.php.

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

Returns:
bool override this to return false if this is not really a question type, for example the description question type is not really a question type.

Reimplemented from question_type.

Definition at line 39 of file questiontype.php.

Returns:
bool true if this question type can be used by the random question type.

Reimplemented from question_type.

Definition at line 43 of file questiontype.php.

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


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