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


The calculated question type.
Definition at line 38 of file questiontype.php.
| addnamecategory | ( | &$ | question | ) |
| comment_header | ( | $ | question | ) |
Reimplemented in qtype_calculatedsimple, and qtype_calculatedmulti.
Definition at line 1023 of file questiontype.php.
| comment_on_datasetitems | ( | $ | qtypeobj, |
| $ | questionid, | ||
| $ | questiontext, | ||
| $ | answers, | ||
| $ | data, | ||
| $ | number | ||
| ) |
Reimplemented in qtype_calculatedmulti.
Definition at line 1040 of file questiontype.php.

| construct_dataset_menus | ( | $ | form, |
| $ | mandatorydatasets, | ||
| $ | optionaldatasets | ||
| ) |
| custom_generator_set_data | ( | $ | datasetdefs, |
| $ | formdata | ||
| ) |
Definition at line 726 of file questiontype.php.
| custom_generator_tools | ( | $ | datasetdef | ) |
| custom_generator_tools_part | ( | $ | mform, |
| $ | idx, | ||
| $ | j | ||
| ) |
Reimplemented in qtype_calculatedsimple.
Definition at line 704 of file questiontype.php.
| dataset_options | ( | $ | form, |
| $ | name, | ||
| $ | mandatory = true, |
||
| $ | renameabledatasets = false |
||
| ) |
Reimplemented in qtype_calculatedsimple.
Definition at line 1163 of file questiontype.php.


| dataset_options_from_database | ( | $ | form, |
| $ | name, | ||
| $ | prefix = '', |
||
| $ | langfile = 'qtype_calculated' |
||
| ) |
| 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.
Reimplemented in qtype_calculatedmulti.
Definition at line 1844 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 667 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 459 of file questiontype.php.
| evaluate_equations | ( | $ | str, |
| $ | dataset | ||
| ) |
| find_dataset_names | ( | $ | text | ) |
| find_math_equations | ( | $ | text | ) |
Definition at line 1785 of file questiontype.php.
| finished_edit_wizard | ( | $ | form | ) |
Returns true if the editing wizard is finished, false otherwise.
The default implementation returns true, which is suitable for all question- types that only use one editing form. This function is used in question.php to decide whether we can regrade any states of the edited question and redirect to edit.php.
The dataset dependent question-type, which is extended by the calculated question-type, overwrites this method because it uses multiple pages (i.e. a wizard) to set up the question and associated datasets.
| object | $form | The data submitted by the previous page. |
Reimplemented from question_type.
Reimplemented in qtype_calculatedsimple.
Definition at line 387 of file questiontype.php.
| generate_dataset_item | ( | $ | options | ) |
Definition at line 1002 of file questiontype.php.


| get_database_dataset_items | ( | $ | definition | ) |
This function get the dataset items using id as unique parameter and return an array with itemnumber as index sorted ascendant If the multiple records with the same itemnumber exist, only the newest one i.e with the greatest id is used, the others are ignored but not deleted. MDL-19210
Definition at line 833 of file questiontype.php.

| get_dataset_definitions | ( | $ | questionid, |
| $ | newdatasets | ||
| ) |
| get_dataset_definitions_category | ( | $ | form | ) |
This function retrieve the item count of the available category shareable wild cards that is added as a comment displayed when a wild card with the same name is displayed in datasetdefinitions_form.php
Definition at line 1581 of file questiontype.php.
| get_datasets_for_export | ( | $ | question | ) |
Definition at line 85 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.
Reimplemented in qtype_calculatedmulti.
Definition at line 1800 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 43 of file questiontype.php.


| get_random_guess_score | ( | $ | questiondata | ) |
| object | $question |
Reimplemented from question_type.
Definition at line 690 of file questiontype.php.
Reimplemented in qtype_calculatedmulti.
Definition at line 1796 of file questiontype.php.


| import_datasets | ( | $ | question | ) |
| 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.
Reimplemented in qtype_calculatedmulti.
Definition at line 321 of file questiontype.php.

| 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.
Reimplemented in qtype_calculatedmulti.
Definition at line 1837 of file questiontype.php.

| multichoice_comment_on_datasetitems | ( | $ | questionid, |
| $ | questiontext, | ||
| $ | answers, | ||
| $ | data, | ||
| $ | number | ||
| ) |
| & next_wizard_form | ( | $ | submiturl, |
| $ | question, | ||
| $ | wizardnow | ||
| ) |
| pick_question_dataset | ( | $ | question, |
| $ | datasetitem | ||
| ) |
| preparedatasets | ( | $ | form, |
| $ | questionfromid = '0' |
||
| ) |
This method prepare the $datasets in a format similar to dadatesetdefinitions_form.php so that they can be saved using the function save_dataset_definitions($form) when creating a new calculated question or whenediting an already existing calculated question or by function save_as_new_dataset_definitions($form, $initialid) when saving as new an already existing calculated question
| object | $form | |
| int | $questionfromid | default = '0' |
Definition at line 494 of file questiontype.php.


| print_dataset_definitions_category | ( | $ | form | ) |
This function build a table showing the available category shareable wild cards, their name, their definition (Min, Max, Decimal) , the item count and the name of the question where they are used. This table is intended to be add before the question text to help the user use these wild cards
Definition at line 1607 of file questiontype.php.
| print_dataset_definitions_category_shared | ( | $ | question, |
| $ | datasetdefsq | ||
| ) |
This function build a table showing the available category shareable wild cards, their name, their definition (Min, Max, Decimal) , the item count and the name of the question where they are used. This table is intended to be add before the question text to help the user use these wild cards
Definition at line 1684 of file questiontype.php.
| print_next_wizard_page | ( | $ | question, |
| $ | form, | ||
| $ | course | ||
| ) |
| save_as_new_dataset_definitions | ( | $ | form, |
| $ | initialid | ||
| ) |
This function create a copy of the datasets (definition and dataitems) from the preceding question if they remain in the new question otherwise its create the datasets that have been added as in the save_dataset_definitions()
Definition at line 1377 of file questiontype.php.


| save_dataset_definitions | ( | $ | form | ) |
Definition at line 1295 of file questiontype.php.


| save_dataset_items | ( | $ | question, |
| $ | fromform | ||
| ) |
Definition at line 849 of file questiontype.php.


| save_question | ( | $ | question, |
| $ | form | ||
| ) |
this version save the available data at the different steps of the question editing process without using global $SESSION as storage between steps at the first step $wizardnow = 'question' when creating a new question when modifying a question when copying as a new question the general parameters and answers are saved using parent::save_question then the datasets are prepared and saved at the second step $wizardnow = 'datasetdefinitions' the datadefs final type are defined as private, category or not a datadef at the third step $wizardnow = 'datasetitems' the datadefs parameters and the data items are created or defined
| object | question | |
| object | $form | |
| int | $course | |
| PARAM_ALPHA | $wizardnow | should be added as we are coming from question2.php |
Reimplemented from question_type.
Definition at line 586 of file questiontype.php.

| save_question_calculated | ( | $ | question, |
| $ | fromform | ||
| ) |
| 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.
Reimplemented in qtype_calculatedsimple, and qtype_calculatedmulti.
Definition at line 127 of file questiontype.php.

| substitute_variables | ( | $ | str, |
| $ | dataset | ||
| ) |
| substitute_variables_and_eval | ( | $ | str, |
| $ | dataset | ||
| ) |
| tolerance_types | ( | ) |
Reimplemented in qtype_calculatedsimple.
Definition at line 1155 of file questiontype.php.

| update_dataset_options | ( | $ | datasetdefs, |
| $ | form | ||
| ) |
| validate_form | ( | $ | form | ) |
| $wizardpagesnumber = 3 |
Definition at line 41 of file questiontype.php.
| const MAX_DATASET_ITEMS = 100 |
Definition at line 39 of file questiontype.php.