Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Using the question engine from module

From MoodleDocs
Revision as of 14:01, 18 May 2010 by Tim Hunt (talk | contribs)

This page explains how to use the new Moodle question engine in an activity module you are developing.

Previous section: Developing a Question Type

Note: This page is a work-in-progress. Feedback and suggested improvements are welcome. Please join the discussion on moodle.org or use the page comments.


The first example of a module that uses the question engine is the quiz module. Looking at how the quiz code works will let you see a real working example of what explained on this page.

Note that all the question engine code has extensive PHP documenter comments that should explain the purpose of every class and method. This document is supposed to provide an overview of the key points to get you started. It does not attempt to duplicate all the details in the PHPdocs.


Starting an attempt at some questions

TODO


Displaying questions

TODO

Call JavaScript function question_init_form just after outputting the form tag.

Include a qnumbers hidden field.


Processing student responses

TODO


A nicety: scroll position

Add <input type="hidden" name="scrollpos" value="" /> to the question form.

On the processing page, if that scrollpos is set, add it to the URL you redirect back to.


See also

In the next section, Implementation plan outlines how I will implement this proposal.

  • The PHP documenter comments that explain the purposes of every method in the question engine code.
  • Back to Question Engine 2