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


Public Member Functions | |
| __construct ($submiturl, $question, $category, $contexts, $formeditable=true) | |
| set_data ($question) | |
| validation ($fromform, $files) | |
| qtype () | |
Data Fields | |
| const | DEFAULT_NUM_HINTS = 2 |
| $context | |
| $editoroptions | |
| $fileoptions | |
| $instance | |
Protected Member Functions | |
| definition () | |
| definition_inner ($mform) | |
| get_per_answer_fields ($mform, $label, $gradeoptions, &$repeatedoptions, &$answersoption) | |
| add_per_answer_fields (&$mform, $label, $gradeoptions, $minoptions=QUESTION_NUMANS_START, $addoptions=QUESTION_NUMANS_ADD) | |
| add_combined_feedback_fields ($withshownumpartscorrect=false) | |
| get_hint_fields ($withclearwrong=false, $withshownumpartscorrect=false) | |
| add_interactive_settings ($withclearwrong=false, $withshownumpartscorrect=false) | |
| data_preprocessing ($question) | |
| data_preprocessing_answers ($question, $withanswerfiles=false) | |
| data_preprocessing_combined_feedback ($question, $withshownumcorrect=false) | |
| data_preprocessing_hints ($question, $withclearwrong=false, $withshownumpartscorrect=false) | |
Protected Attributes | |
| $question | |
| $contexts | |
| $category | |
| $categorycontext | |
Form definition base class. This defines the common fields that all question types need. Question types should define their own class that inherits from this one, and implements the definition_inner() method.
Definition at line 69 of file edit_question_form.php.
| __construct | ( | $ | submiturl, |
| $ | question, | ||
| $ | category, | ||
| $ | contexts, | ||
| $ | formeditable = true |
||
| ) |
Reimplemented in qtype_calculatedsimple_edit_form, qtype_multianswer_edit_form, qtype_calculated_edit_form, qtype_calculatedmulti_edit_form, and qtype_missingtype_edit_form.
Definition at line 93 of file edit_question_form.php.

| add_combined_feedback_fields | ( | $ | withshownumpartscorrect = false | ) | [protected] |
| add_interactive_settings | ( | $ | withclearwrong = false, |
| $ | withshownumpartscorrect = false |
||
| ) | [protected] |
Definition at line 377 of file edit_question_form.php.


| add_per_answer_fields | ( | &$ | mform, |
| $ | label, | ||
| $ | gradeoptions, | ||
| $ | minoptions = QUESTION_NUMANS_START, |
||
| $ | addoptions = QUESTION_NUMANS_ADD |
||
| ) | [protected] |
Add a set of form fields, obtained from get_per_answer_fields, to the form, one for each existing answer, with some blanks for some new ones.
| object | $mform | the form being built. |
| $label | the label to use for each option. | |
| $gradeoptions | the possible grades for each answer. | |
| $minoptions | the minimum number of answer blanks to display. Default QUESTION_NUMANS_START. | |
| $addoptions | the number of answer blanks to add. Default QUESTION_NUMANS_ADD. |
Definition at line 313 of file edit_question_form.php.


| data_preprocessing | ( | $ | question | ) | [protected] |
Perform an preprocessing needed on the data passed to set_data() before it is used to initialise the form.
| object | $question | the data being passed to the form. |
Reimplemented in qtype_calculatedsimple_edit_form, qtype_calculatedmulti_edit_form, qtype_numerical_edit_form, qtype_calculated_edit_form, qtype_multichoice_edit_form, qtype_match_edit_form, qtype_truefalse_edit_form, qtype_essay_edit_form, qtype_shortanswer_edit_form, and qtype_randomsamatch_edit_form.
Definition at line 493 of file edit_question_form.php.

| data_preprocessing_answers | ( | $ | question, |
| $ | withanswerfiles = false |
||
| ) | [protected] |
Perform the necessary preprocessing for the fields added by add_per_answer_fields().
| object | $question | the data being passed to the form. |
Definition at line 503 of file edit_question_form.php.


| data_preprocessing_combined_feedback | ( | $ | question, |
| $ | withshownumcorrect = false |
||
| ) | [protected] |
Perform the necessary preprocessing for the fields added by add_combined_feedback_fields().
| object | $question | the data being passed to the form. |
Definition at line 566 of file edit_question_form.php.


| data_preprocessing_hints | ( | $ | question, |
| $ | withclearwrong = false, |
||
| $ | withshownumpartscorrect = false |
||
| ) | [protected] |
Perform the necessary preprocessing for the hint fields.
| object | $question | the data being passed to the form. |
Definition at line 604 of file edit_question_form.php.


| definition | ( | ) | [protected] |
Build the form definition.
This adds all the form fields that the default question type supports. If your question type does not support all these fields, then you can override this method and remove the ones you don't want with $mform->removeElement().
Reimplemented from moodleform.
Reimplemented in qtype_random_edit_form.
Definition at line 120 of file edit_question_form.php.

| definition_inner | ( | $ | mform | ) | [protected] |
Add any question-type specific form fields.
| object | $mform | the form being built. |
Reimplemented in qtype_calculatedsimple_edit_form, qtype_calculated_edit_form, qtype_calculatedmulti_edit_form, qtype_multianswer_edit_form, qtype_match_edit_form, qtype_missingtype_edit_form, qtype_truefalse_edit_form, qtype_description_edit_form, qtype_multichoice_edit_form, qtype_numerical_edit_form, qtype_essay_edit_form, qtype_shortanswer_edit_form, and qtype_randomsamatch_edit_form.
Definition at line 273 of file edit_question_form.php.

| get_hint_fields | ( | $ | withclearwrong = false, |
| $ | withshownumpartscorrect = false |
||
| ) | [protected] |
| get_per_answer_fields | ( | $ | mform, |
| $ | label, | ||
| $ | gradeoptions, | ||
| &$ | repeatedoptions, | ||
| &$ | answersoption | ||
| ) | [protected] |
Get the list of form elements to repeat, one for each answer.
| object | $mform | the form being built. |
| $label | the label to use for each option. | |
| $gradeoptions | the possible grades for each answer. | |
| $repeatedoptions | reference to array of repeated options to fill | |
| $answersoption | reference to return the name of $question->options field holding an array of answers |
Reimplemented in qtype_calculated_edit_form, qtype_multichoice_edit_form, qtype_calculatedmulti_edit_form, qtype_numerical_edit_form, and qtype_match_edit_form.
Definition at line 287 of file edit_question_form.php.

| qtype | ( | ) | [abstract] |
Override this in the subclass to question type name.
Reimplemented in qtype_calculatedsimple_edit_form, qtype_multianswer_edit_form, qtype_numerical_edit_form, qtype_calculatedmulti_edit_form, qtype_calculated_edit_form, qtype_multichoice_edit_form, qtype_match_edit_form, qtype_truefalse_edit_form, qtype_shortanswer_edit_form, qtype_essay_edit_form, qtype_random_edit_form, qtype_missingtype_edit_form, qtype_randomsamatch_edit_form, and qtype_description_edit_form.

| set_data | ( | $ | default_values | ) |
Load in existing data as form defaults. Usually new entry defaults are stored directly in form definition (new entry form); this function is used to load in data where values already exist and data is being edited (edit entry form).
note: $slashed param removed
| mixed | $default_values | object or array of default values |
Reimplemented from moodleform.
Reimplemented in qtype_multianswer_edit_form, qtype_random_edit_form, and qtype_missingtype_edit_form.
Definition at line 425 of file edit_question_form.php.

| validation | ( | $ | data, |
| $ | files | ||
| ) |
Dummy stub method - override if you needed to perform some extra validation. If there are errors return array of errors ("fieldname"=>"error message"), otherwise true if ok.
Server side rules do not work for uploaded files, implement serverside rules here if needed.
| array | $data | array of ("fieldname"=>value) of submitted data |
| array | $files | array of uploaded files "element_name"=>tmp_file_path |
Reimplemented from moodleform.
Reimplemented in qtype_calculatedsimple_edit_form, qtype_multianswer_edit_form, qtype_numerical_edit_form, qtype_calculatedmulti_edit_form, qtype_calculated_edit_form, qtype_match_edit_form, qtype_multichoice_edit_form, qtype_random_edit_form, qtype_missingtype_edit_form, qtype_randomsamatch_edit_form, and qtype_shortanswer_edit_form.
Definition at line 640 of file edit_question_form.php.
$category [protected] |
Definition at line 81 of file edit_question_form.php.
$categorycontext [protected] |
Definition at line 82 of file edit_question_form.php.
Definition at line 85 of file edit_question_form.php.
$contexts [protected] |
Definition at line 80 of file edit_question_form.php.
| $editoroptions |
Definition at line 87 of file edit_question_form.php.
| $fileoptions |
Definition at line 89 of file edit_question_form.php.
Definition at line 91 of file edit_question_form.php.
$question [protected] |
Definition at line 78 of file edit_question_form.php.
| const DEFAULT_NUM_HINTS = 2 |
Definition at line 70 of file edit_question_form.php.