Question type plugins
Question types are one of the plugins used by the question subsystem. To see how they fit in, please read this overview of the question subsystems.
Question types have to do many things:
edit_..._form.php
- Provide an editing form so that teachers can create and edit questions of this type.questiontypes.php
- Define a class to handle loading and saving data from this form.- ... and related methods providing metadata about this question types.
- ... and import and export in any Question formats that the type wants to support.
question.php
- this class represents one instance of this question type, while it is being attempted by a user. It must do many things- ... Start a new attempt (e.g. in a multiple choice question, this is where we randomly shuffle the choices).
- ... or if we are continuing an existing attempt, re-initialise the question to the same state, using the data from the DB.
- ... Tell the question engine what data this question type is expecting to be submitted.
- ... Analyse those submitted responses: e.g. has it changed? is it complete.
- ... Automatically grade the response to give a 'fraction' (mark between 0 and 1) and a state (correct / partially correct / incorrect).
- ... check access to files for the file API.
renderer.php
- to display the key bits of this question types for thecore_question_renderer
to combine into the overall question display.- Implements Backup and restore, and all the other standard parts of a Moodle plugin like DB tables.
- Track users preferences for the settings used for newly created questions.