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


Public Member Functions | |
| menu_name () | |
| is_manual_graded () | |
| is_usable_by_random () | |
| is_question_manual_graded ($question, $otherquestionsinuse) | |
| display_question_editing_page ($mform, $question, $wizardnow) | |
| get_question_options ($question) | |
| question_name ($category, $includesubcategories) | |
| save_question ($question, $form) | |
| save_question_options ($question) | |
| get_available_questions_from_category ($categoryid, $subcategories) | |
| make_question ($questiondata) | |
| choose_other_question ($questiondata, $excludedquestions, $allowshuffle=true) | |
| get_random_guess_score ($questiondata) | |
Protected Member Functions | |
| init_qtype_lists () | |
| set_selected_question_name ($question, $randomname) | |
Protected Attributes | |
| $excludedqtypes = null | |
| $manualqtypes = null | |
The random question type.
This question type does not have a question definition class, nor any renderers. When you load a question of this type, it actually loads a question chosen randomly from a particular category in the question bank.
Definition at line 42 of file questiontype.php.
| choose_other_question | ( | $ | questiondata, |
| $ | excludedquestions, | ||
| $ | allowshuffle = true |
||
| ) |
Load the definition of another question picked randomly by this question.
| object | $questiondata | the data defining a random question. |
| array | $excludedquestions | of question ids. We will no pick any question whose id is in this list. |
| bool | $allowshuffle | if false, then any shuffle option on the selected quetsion is disabled. |
Definition at line 220 of file questiontype.php.


| display_question_editing_page | ( | $ | mform, |
| $ | question, | ||
| $ | wizardnow | ||
| ) |
This method should be overriden if you want to include a special heading or some other html on a question editing page besides the question editing form.
| question_edit_form | $mform | a child of question_edit_form |
| object | $question | |
| string | $wizardnow | is '' for first page. |
Reimplemented from question_type.
Definition at line 118 of file questiontype.php.

| get_available_questions_from_category | ( | $ | categoryid, |
| $ | subcategories | ||
| ) |
Get all the usable questions from a particular question category.
| int | $categoryid | the id of a question category. |
| bool | whether to include questions from subcategories. | |
| string | $questionsinuse | comma-separated list of question ids to exclude from consideration. |
Definition at line 188 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 125 of file questiontype.php.
| get_random_guess_score | ( | $ | questiondata | ) |
| object | $question |
Reimplemented from question_type.
Definition at line 237 of file questiontype.php.
| init_qtype_lists | ( | ) | [protected] |
This method needs to be called before the ->excludedqtypes and ->manualqtypes fields can be used.
Definition at line 100 of file questiontype.php.


| is_manual_graded | ( | ) |
Reimplemented from question_type.
Definition at line 61 of file questiontype.php.
| is_question_manual_graded | ( | $ | question, |
| $ | otherquestionsinuse | ||
| ) |
| object | $question | a question of this type. |
| string | $otherquestionsinuse | comma-separate list of other question ids in this attempt. |
Reimplemented from question_type.
Definition at line 69 of file questiontype.php.

Reimplemented from question_type.
Definition at line 65 of file questiontype.php.
| make_question | ( | $ | questiondata | ) |
Create an appropriate question_definition for the question of this type using data loaded from the database.
| object | $questiondata | the question data loaded from the database. |
Reimplemented from question_type.
Definition at line 206 of file questiontype.php.

| menu_name | ( | ) |
The name this question should appear as in the create new question dropdown. Override this method to return false if you don't want your question type to be createable, for example if it is an abstract base type, otherwise, you should not need to override this method.
Reimplemented from question_type.
Definition at line 56 of file questiontype.php.
| question_name | ( | $ | category, |
| $ | includesubcategories | ||
| ) |
Random questions always get a question name that is Random (cateogryname). This function is a centralised place to calculate that, given the category.
| object | $category | the category this question picks from. (Only ->name is used.) |
| bool | $includesubcategories | whether this question also picks from subcategories. |
Definition at line 136 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.
| object | $question | the question object which should be updated. For a new question will be mostly empty. |
| object | $form | the object containing the information to save, as if from the question editing form. |
| object | $course | not really used any more. |
Question already exists, update.
Reimplemented from question_type.
Definition at line 152 of file questiontype.php.
| save_question_options | ( | $ | question | ) |
Saves question-type specific options
This is called by save_question() to save the question-type specific data
| object | $question | This holds the information from the editing form, it is not a standard question object. |
Reimplemented from question_type.
Definition at line 162 of file questiontype.php.

| set_selected_question_name | ( | $ | question, |
| $ | randomname | ||
| ) | [protected] |
$excludedqtypes = null [protected] |
Definition at line 44 of file questiontype.php.
$manualqtypes = null [protected] |
Definition at line 47 of file questiontype.php.