Separating questions from quizzes

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Separating questions from quizzes.

This page is meant to summarize the changes that had to take place to separate the code and data for handling questions from the code and date for handling quizzes. I still need to write most of this. More information is contained in a discussion at http://mantis.york.ac.uk/moodle/mod/forum/discuss.php?d=852.

I moved all code that is not specific to the quiz module out of locallib.php into questionlib.php. Other modules that want to use the question types will only need to load questionlib.php.

The default questiontype class is now defined in quiz/questiontypes/questiontype.php.

Two name changes: 1) in all module-indpendent code the variable $quiz has been renamed to $cmoptions (it holds the options set by the course module which does not necessarily have to be a quiz, it could be a lesson for example). At some point someone should go through the code and document what properties the $cmoptions object is expected to have. 2) quiz_restore_question_sessions() has the simpler name quiz_get_states Also got rid of the quizfile.php in favour of file.php

I have introduced the new field $attempt->uniqueid, see http://mantis.york.ac.uk/moodle/mod/forum/discuss.php?d=852#3380. I have replaced $attempt->id by $attempt->uniquid in all the relevant places. The attempt or attemptid fields in quiz_state and quiz_newest_state now refer to this uniqueid. The two places that I know I haven't done properly yet are:

  • restorelib. Here I need the help of Eloy.
  • grading.php This Mark can do best.