<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/21/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Brianking</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/21/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Brianking"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/Special:Contributions/Brianking"/>
	<updated>2026-04-19T20:05:10Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Mentees_block&amp;diff=73340</id>
		<title>Mentees block</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Mentees_block&amp;diff=73340"/>
		<updated>2010-06-25T13:28:02Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Block visibility */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 1.8}}&lt;br /&gt;
The &#039;&#039;&#039;Mentees block&#039;&#039;&#039;, from Moodle 1.8 onwards, may be added to the site front page or to [[My Moodle]]. It provides a mentor with quick access to their mentee(s) profile page(s).&lt;br /&gt;
&lt;br /&gt;
==Adding the Mentees block==&lt;br /&gt;
&lt;br /&gt;
To the site front page:&lt;br /&gt;
#On the site front page click &amp;quot;Turn editing on&amp;quot;&lt;br /&gt;
#Choose Mentees from the Add a block drop-down menu&lt;br /&gt;
#If required, give the Mentees block a title by following the block configuration/edit link&lt;br /&gt;
&lt;br /&gt;
To My Moodle:&lt;br /&gt;
#Access My Moodle configuration via &#039;&#039;Administration &amp;gt; Appearance &amp;gt; [[Sticky blocks]]&#039;&#039;&lt;br /&gt;
#Choose Mentees from the Add a block drop-down menu&lt;br /&gt;
#If required, give the Mentees block a title by following the block configuration/edit link &lt;br /&gt;
&lt;br /&gt;
==Block visibility==&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
The mentees block does not become visible until individual “mentors” have been assigned a role that enables them to mentor other users who become their &amp;quot;mentees&amp;quot; (e.g., a parent mentoring a child, or a tutor mentoring a student). To assign a mentor to a mentee, the mentor must first be assigned a role that allows that mentor permission to view relevant user information ([[Capabilities/moodle/user:viewdetails|moodle/user:viewdetails]] set to &#039;&#039;allow&#039;&#039;). After having been assigned a role that grants viewing permission, the mentor’s role must then be assigned to the mentee/user whose information they wish to view. &lt;br /&gt;
&lt;br /&gt;
Mentor users logging on to the site will then be presented with a mentees block containing names and links to information about the individual users the mentor has been granted authorization to view.&lt;br /&gt;
&lt;br /&gt;
==Example usage==&lt;br /&gt;
&lt;br /&gt;
The [[Parent role]] is an example of a role which utilizes the Mentees block.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
*[[Roles]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/discuss.php?d=57812 Create a Parent of a student role] forum discussion &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Block]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[fr:Bloc participants suivis]]&lt;br /&gt;
[[ja:メンティーブロック]]&lt;br /&gt;
[[ru:Подопечные (блок)]]&lt;br /&gt;
[[de:Mentoren_%28Block%29]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=71734</id>
		<title>Development:Events API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=71734"/>
		<updated>2010-05-04T11:42:04Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Handling an event */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overview==&lt;br /&gt;
&lt;br /&gt;
The Events API is a core system in Moodle to allow communication between modules.  &lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;event&#039;&#039;&#039; is when something &amp;quot;interesting&amp;quot; happens in Moodle that is worth alerting the system about.&lt;br /&gt;
&lt;br /&gt;
Any Moodle modules can &#039;&#039;&#039;trigger&#039;&#039;&#039; new events (with attached data), and other modules can elect to &#039;&#039;&#039;handle&#039;&#039;&#039; those events with custom functions that operate on the given data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s look at an example of how events are used to implement Messaging in Moodle 2.0.  In the messaging system, textual messages are generated for users by different modules, and the user can decide how certain types of messages are displayed.&lt;br /&gt;
&lt;br /&gt;
===Triggering an event===&lt;br /&gt;
&lt;br /&gt;
When a messaging event occurs, the module should trigger a &amp;quot;message_send&amp;quot; event.   In this example let&#039;s pretend someone just posted to a forum.&lt;br /&gt;
&lt;br /&gt;
The forum module needs to create an object with the data that this event needs.  This may vary completely for different types of events, it&#039;s just a data object.&lt;br /&gt;
&lt;br /&gt;
 $eventdata = new object();&lt;br /&gt;
 $eventdata-&amp;gt;component         = &#039;mod/forum&#039;;    // path in Moodle&lt;br /&gt;
 $eventdata-&amp;gt;name              = &#039;posts&#039;;        // type of message from that module (as module defines it)&lt;br /&gt;
 $eventdata-&amp;gt;userfrom          = $userfrom;      // user object&lt;br /&gt;
 $eventdata-&amp;gt;userto            = $userto;        // user object&lt;br /&gt;
 $eventdata-&amp;gt;subject           = &amp;quot;Hi there&amp;quot;;     // short one-line subject&lt;br /&gt;
 $eventdata-&amp;gt;fullmessage       = &amp;quot;Here is the full message&amp;quot;;      // raw text&lt;br /&gt;
 $eventdata-&amp;gt;fullmessageformat = FORMAT_PLAIN;   // text format&lt;br /&gt;
 $eventdata-&amp;gt;fullmessagehtml   = &amp;quot;Here is the &amp;amp;lt;b&amp;gt;full&amp;amp;lt;/b&amp;gt; message&amp;quot;;    // html rendered version   (optional)&lt;br /&gt;
 $eventdata-&amp;gt;smallmessage      = &amp;quot;Here is the truncated message&amp;quot;;      // useful for plugins like sms or twitter  (optional)&lt;br /&gt;
&lt;br /&gt;
Then we post the object as an event and forget about it:&lt;br /&gt;
&lt;br /&gt;
 events_trigger(&#039;message_send&#039;, $eventdata);&lt;br /&gt;
&lt;br /&gt;
===Handling an event===&lt;br /&gt;
&lt;br /&gt;
Modules or core code can define an events.php in the db directory which defines events they want to be notified about, and describes which of their functions or class methods should be notified.  For this case, there is this definition of a handler in lib/db/events.php&lt;br /&gt;
&lt;br /&gt;
 $handlers = array (&lt;br /&gt;
     &#039;message_send&#039; =&amp;gt; array (&lt;br /&gt;
          &#039;handlerfile&#039;      =&amp;gt; &#039;/lib/messagelib.php&#039;,&lt;br /&gt;
          &#039;handlerfunction&#039;  =&amp;gt; &#039;message_send_handler&#039;,&lt;br /&gt;
          &#039;schedule&#039;         =&amp;gt; &#039;instant&#039;&lt;br /&gt;
      )&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
These events.php files are parsed during install / upgrade and stored in a simple database table.&lt;br /&gt;
&lt;br /&gt;
Now, when a &#039;&#039;&#039;message_send&#039;&#039;&#039; event happens, all the registered handlers functions for that event will be called something like this (but with more error handling):&lt;br /&gt;
&lt;br /&gt;
          include_once($CFG-&amp;gt;dirroot.$handlers[&#039;message_send&#039;][&#039;handlerfile&#039;]);&lt;br /&gt;
          call_user_func($handlers[&#039;message_send&#039;][&#039;handlerfunction&#039;], $eventdata);&lt;br /&gt;
&lt;br /&gt;
Any code can hook into any events this way.&lt;br /&gt;
&lt;br /&gt;
The handler function accepts one parameter (the event data object) and should return a boolean.  Returning false indicates that there was an error and the event will be left in the event queue.&lt;br /&gt;
&lt;br /&gt;
    function message_send_handler($eventdata) {&lt;br /&gt;
        // handle event &lt;br /&gt;
        // ...&lt;br /&gt;
        return true;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
==Database structure==&lt;br /&gt;
&lt;br /&gt;
There are 3 core tables for events. Note that if a handler is queued, and yet to be processed or processing failed, then all subsequent calls on that handler must be queued.&lt;br /&gt;
&lt;br /&gt;
===events_handlers===&lt;br /&gt;
&lt;br /&gt;
This table is for storing which components requests what type of event, and the location of the responsible handler functions.&lt;br /&gt;
&lt;br /&gt;
These entries are created by parsing events.php files in all the modules, and can be rebuilt any time (during an upgrade, say).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventname&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|name of the event, e.g. &#039;message_send&#039;&lt;br /&gt;
|-&lt;br /&gt;
|handlermodule&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|e.g. moodle, mod/forum, block/rss_client&lt;br /&gt;
|-&lt;br /&gt;
|handlerfile&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|path to the file of the function, eg /lib/messagelib.php&lt;br /&gt;
|-&lt;br /&gt;
|handlerfunction&lt;br /&gt;
|text&lt;br /&gt;
|serialized string or array describing function, suitable to be passed to &#039;&#039;&#039;call_user_func()&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|schedule 	&lt;br /&gt;
|varchar(255) 	&lt;br /&gt;
|&#039;cron&#039; or &#039;instant&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue===&lt;br /&gt;
&lt;br /&gt;
This table is for storing queued events. It stores only one copy of the eventdata here, and entries from this table are being references by the events_queue_handlers table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventdata 	&lt;br /&gt;
|longtext 	&lt;br /&gt;
|serialized version of the data object passed to the event handler.&lt;br /&gt;
|-&lt;br /&gt;
|stackdump&lt;br /&gt;
|text&lt;br /&gt;
|serialized debug_backtrace showing where the event was fired from&lt;br /&gt;
|-&lt;br /&gt;
|userid&lt;br /&gt;
|int(10)&lt;br /&gt;
|$USER-&amp;gt;id when the event was fired&lt;br /&gt;
|-&lt;br /&gt;
|timecreated&lt;br /&gt;
|int(10) 	&lt;br /&gt;
|time stamp of the first time this was added&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue_handlers===&lt;br /&gt;
&lt;br /&gt;
This is the list of queued handlers for processing. The event object is retrieved from the events_queue table. When no further reference is made to the events_queue table, the corresponding entry in the events_queue table should be deleted. Entry should get deleted (?) after a successful event processing by the specified handler.  The status field keeps track of failures, after it gets to a certain number (eg 10?) it should trigger an &amp;quot;event failed&amp;quot; event (that could result in admin being emailed etc, or perhaps even the originating module taking care of it or rolling something back etc).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|queuedeventid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_queues table&lt;br /&gt;
|-&lt;br /&gt;
|handlerid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_handlers table&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|-&lt;br /&gt;
|errormessage&lt;br /&gt;
|text&lt;br /&gt;
|if an error happened last time we tried to process this event, record it here.&lt;br /&gt;
|-&lt;br /&gt;
|timemodified&lt;br /&gt;
|int(10)&lt;br /&gt;
|time stamp of the last attempt to run this from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Standards for naming events==&lt;br /&gt;
&lt;br /&gt;
All event names should follow a consistent naming pattern, such as modulename_noun_verb&lt;br /&gt;
&lt;br /&gt;
If the event is being fired after the action has taken place (as in most cases) then use the past tense for the verb (created / deleted / updated / sent).&lt;br /&gt;
&lt;br /&gt;
If the event &#039;&#039;&#039;is&#039;&#039;&#039; the action, then use the present tense (create / delete / update / send).&lt;br /&gt;
&lt;br /&gt;
==Events which exist==&lt;br /&gt;
&lt;br /&gt;
When we add new events to core we should always add them here too.&lt;br /&gt;
&lt;br /&gt;
Under each event, list the data sent as part of the event.&lt;br /&gt;
&lt;br /&gt;
===Users===&lt;br /&gt;
* user_created&lt;br /&gt;
** full new record from &#039;user&#039; table&lt;br /&gt;
* user_updated&lt;br /&gt;
** full new record from &#039;user&#039; table&lt;br /&gt;
&lt;br /&gt;
===Courses===&lt;br /&gt;
* course_created&lt;br /&gt;
** full course record&lt;br /&gt;
* course_updated&lt;br /&gt;
** full course record&lt;br /&gt;
* course_deleted&lt;br /&gt;
** full course record&lt;br /&gt;
* course_category_deleted&lt;br /&gt;
** full category record&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
* groups_member_added&lt;br /&gt;
** groupid&lt;br /&gt;
** userid&lt;br /&gt;
* groups_member_removed&lt;br /&gt;
** groupid&lt;br /&gt;
** userid&lt;br /&gt;
* groups_group_created&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** description&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
** picture&lt;br /&gt;
* groups_group_updated&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** description&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
** picture&lt;br /&gt;
* groups_group_deleted&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** description&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
** picture&lt;br /&gt;
* groups_grouping_created&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
* groups_grouping_updated&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
* groups_grouping_deleted&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
* groups_members_removed (user deleted from all groups in a course)&lt;br /&gt;
** courseid&lt;br /&gt;
** userid&lt;br /&gt;
* groups_groupings_groups_removed (remove all groups from all groupings in a course)&lt;br /&gt;
** courseid (as plain integer, not object)&lt;br /&gt;
* groups_groups_deleted (delete all groups in a course)&lt;br /&gt;
** courseid (as plain integer, not object)&lt;br /&gt;
* groups_groupings_deleted (delete all groupings in a course)&lt;br /&gt;
** courseid (as plain integer, not object)&lt;br /&gt;
&lt;br /&gt;
===Messaging===&lt;br /&gt;
* message_send&lt;br /&gt;
** component = &#039;mod/forum&#039;: path in Moodle&lt;br /&gt;
** name = &#039;posts&#039;: type of message from that module (as module defines it)&lt;br /&gt;
** userfrom = $userfrom: a user object to send from&lt;br /&gt;
** userto = $userto: a user object to send to&lt;br /&gt;
** subject = &#039;subject line&#039;: a short text line&lt;br /&gt;
** fullmessage = &#039;full plain text&#039;: raw text as entered by user&lt;br /&gt;
** fullmessageformat = FORMAT_PLAIN|FORMAT_HTML|FORMAT_MOODLE|FORMAT_MARKDOWN: the format of this text&lt;br /&gt;
** fullmessagehtml = &#039;long html text&#039;; html rendered version (optional)&lt;br /&gt;
** smallmessage = &#039;short text&#039;: useful for plugins like sms or twitter (optional)&lt;br /&gt;
&lt;br /&gt;
===Portfolio===&lt;br /&gt;
* portfolio_send&lt;br /&gt;
** id : recordid in portfolio_tempdata table, used for itemid in file storage&lt;br /&gt;
&lt;br /&gt;
==Events wishlist==&lt;br /&gt;
&lt;br /&gt;
List of events which it would be nice to have.  Please add to this list if what you want is not shown here.&lt;br /&gt;
&lt;br /&gt;
* user_role_assign&lt;br /&gt;
* user_role_unassign&lt;br /&gt;
* mform_print_form -- this for all types of form e.g. admin settings, user profile, module updating, + some sort of standard way of discriminiating between them e.g. if ($form-&amp;gt;name == &#039;user_profile&#039;) {}. This would be better triggered at the end of the form generation process so that new bits can be inserted at any point, or existing bits could be removed.&lt;br /&gt;
* module_installed&lt;br /&gt;
* module_removed&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=69103 General Developer Forum thread for discussing this proposal]. &lt;br /&gt;
* [[Development:Messaging_2.0]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Coding guidelines|Events]]&lt;br /&gt;
[[Category:Grades]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=71733</id>
		<title>Development:Events API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=71733"/>
		<updated>2010-05-04T11:40:11Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Handling an event */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Overview==&lt;br /&gt;
&lt;br /&gt;
The Events API is a core system in Moodle to allow communication between modules.  &lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;event&#039;&#039;&#039; is when something &amp;quot;interesting&amp;quot; happens in Moodle that is worth alerting the system about.&lt;br /&gt;
&lt;br /&gt;
Any Moodle modules can &#039;&#039;&#039;trigger&#039;&#039;&#039; new events (with attached data), and other modules can elect to &#039;&#039;&#039;handle&#039;&#039;&#039; those events with custom functions that operate on the given data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s look at an example of how events are used to implement Messaging in Moodle 2.0.  In the messaging system, textual messages are generated for users by different modules, and the user can decide how certain types of messages are displayed.&lt;br /&gt;
&lt;br /&gt;
===Triggering an event===&lt;br /&gt;
&lt;br /&gt;
When a messaging event occurs, the module should trigger a &amp;quot;message_send&amp;quot; event.   In this example let&#039;s pretend someone just posted to a forum.&lt;br /&gt;
&lt;br /&gt;
The forum module needs to create an object with the data that this event needs.  This may vary completely for different types of events, it&#039;s just a data object.&lt;br /&gt;
&lt;br /&gt;
 $eventdata = new object();&lt;br /&gt;
 $eventdata-&amp;gt;component         = &#039;mod/forum&#039;;    // path in Moodle&lt;br /&gt;
 $eventdata-&amp;gt;name              = &#039;posts&#039;;        // type of message from that module (as module defines it)&lt;br /&gt;
 $eventdata-&amp;gt;userfrom          = $userfrom;      // user object&lt;br /&gt;
 $eventdata-&amp;gt;userto            = $userto;        // user object&lt;br /&gt;
 $eventdata-&amp;gt;subject           = &amp;quot;Hi there&amp;quot;;     // short one-line subject&lt;br /&gt;
 $eventdata-&amp;gt;fullmessage       = &amp;quot;Here is the full message&amp;quot;;      // raw text&lt;br /&gt;
 $eventdata-&amp;gt;fullmessageformat = FORMAT_PLAIN;   // text format&lt;br /&gt;
 $eventdata-&amp;gt;fullmessagehtml   = &amp;quot;Here is the &amp;amp;lt;b&amp;gt;full&amp;amp;lt;/b&amp;gt; message&amp;quot;;    // html rendered version   (optional)&lt;br /&gt;
 $eventdata-&amp;gt;smallmessage      = &amp;quot;Here is the truncated message&amp;quot;;      // useful for plugins like sms or twitter  (optional)&lt;br /&gt;
&lt;br /&gt;
Then we post the object as an event and forget about it:&lt;br /&gt;
&lt;br /&gt;
 events_trigger(&#039;message_send&#039;, $eventdata);&lt;br /&gt;
&lt;br /&gt;
===Handling an event===&lt;br /&gt;
&lt;br /&gt;
Modules or core code can define an events.php in the db directory which defines events they want to be notified about, and describes which of their functions or class methods should be notified.  For this case, there is this definition of a handler in lib/db/events.php&lt;br /&gt;
&lt;br /&gt;
 $handlers = array (&lt;br /&gt;
     &#039;message_send&#039; =&amp;gt; array (&lt;br /&gt;
          &#039;handlerfile&#039;      =&amp;gt; &#039;/lib/messagelib.php&#039;,&lt;br /&gt;
          &#039;handlerfunction&#039;  =&amp;gt; &#039;message_send_handler&#039;,&lt;br /&gt;
          &#039;schedule&#039;         =&amp;gt; &#039;instant&#039;&lt;br /&gt;
      )&lt;br /&gt;
 );&lt;br /&gt;
&lt;br /&gt;
These events.php files are parsed during install / upgrade and stored in a simple database table.&lt;br /&gt;
&lt;br /&gt;
Now, when a &#039;&#039;&#039;message_send&#039;&#039;&#039; event happens, all the registered handlers functions for that event will be called something like this (but with more error handling):&lt;br /&gt;
&lt;br /&gt;
          include_once($CFG-&amp;gt;dirroot.$handlers[&#039;message_send&#039;][&#039;handlerfile&#039;]);&lt;br /&gt;
          call_user_func($handlers[&#039;message_send&#039;][&#039;handlerfunction&#039;], $eventdata);&lt;br /&gt;
&lt;br /&gt;
Any code can hook into any events this way.&lt;br /&gt;
&lt;br /&gt;
The handler function accepts one parameter (the event data object) and should return a boolean.  Returning false indicates that there was an error and the event will be left in the event queue.&lt;br /&gt;
&lt;br /&gt;
{code}&lt;br /&gt;
function message_send_handler($eventdata) {&lt;br /&gt;
    // handle event&lt;br /&gt;
    return true;&lt;br /&gt;
}&lt;br /&gt;
{code}&lt;br /&gt;
&lt;br /&gt;
==Database structure==&lt;br /&gt;
&lt;br /&gt;
There are 3 core tables for events. Note that if a handler is queued, and yet to be processed or processing failed, then all subsequent calls on that handler must be queued.&lt;br /&gt;
&lt;br /&gt;
===events_handlers===&lt;br /&gt;
&lt;br /&gt;
This table is for storing which components requests what type of event, and the location of the responsible handler functions.&lt;br /&gt;
&lt;br /&gt;
These entries are created by parsing events.php files in all the modules, and can be rebuilt any time (during an upgrade, say).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventname&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|name of the event, e.g. &#039;message_send&#039;&lt;br /&gt;
|-&lt;br /&gt;
|handlermodule&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|e.g. moodle, mod/forum, block/rss_client&lt;br /&gt;
|-&lt;br /&gt;
|handlerfile&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|path to the file of the function, eg /lib/messagelib.php&lt;br /&gt;
|-&lt;br /&gt;
|handlerfunction&lt;br /&gt;
|text&lt;br /&gt;
|serialized string or array describing function, suitable to be passed to &#039;&#039;&#039;call_user_func()&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|schedule 	&lt;br /&gt;
|varchar(255) 	&lt;br /&gt;
|&#039;cron&#039; or &#039;instant&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue===&lt;br /&gt;
&lt;br /&gt;
This table is for storing queued events. It stores only one copy of the eventdata here, and entries from this table are being references by the events_queue_handlers table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventdata 	&lt;br /&gt;
|longtext 	&lt;br /&gt;
|serialized version of the data object passed to the event handler.&lt;br /&gt;
|-&lt;br /&gt;
|stackdump&lt;br /&gt;
|text&lt;br /&gt;
|serialized debug_backtrace showing where the event was fired from&lt;br /&gt;
|-&lt;br /&gt;
|userid&lt;br /&gt;
|int(10)&lt;br /&gt;
|$USER-&amp;gt;id when the event was fired&lt;br /&gt;
|-&lt;br /&gt;
|timecreated&lt;br /&gt;
|int(10) 	&lt;br /&gt;
|time stamp of the first time this was added&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue_handlers===&lt;br /&gt;
&lt;br /&gt;
This is the list of queued handlers for processing. The event object is retrieved from the events_queue table. When no further reference is made to the events_queue table, the corresponding entry in the events_queue table should be deleted. Entry should get deleted (?) after a successful event processing by the specified handler.  The status field keeps track of failures, after it gets to a certain number (eg 10?) it should trigger an &amp;quot;event failed&amp;quot; event (that could result in admin being emailed etc, or perhaps even the originating module taking care of it or rolling something back etc).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|queuedeventid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_queues table&lt;br /&gt;
|-&lt;br /&gt;
|handlerid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_handlers table&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|-&lt;br /&gt;
|errormessage&lt;br /&gt;
|text&lt;br /&gt;
|if an error happened last time we tried to process this event, record it here.&lt;br /&gt;
|-&lt;br /&gt;
|timemodified&lt;br /&gt;
|int(10)&lt;br /&gt;
|time stamp of the last attempt to run this from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Standards for naming events==&lt;br /&gt;
&lt;br /&gt;
All event names should follow a consistent naming pattern, such as modulename_noun_verb&lt;br /&gt;
&lt;br /&gt;
If the event is being fired after the action has taken place (as in most cases) then use the past tense for the verb (created / deleted / updated / sent).&lt;br /&gt;
&lt;br /&gt;
If the event &#039;&#039;&#039;is&#039;&#039;&#039; the action, then use the present tense (create / delete / update / send).&lt;br /&gt;
&lt;br /&gt;
==Events which exist==&lt;br /&gt;
&lt;br /&gt;
When we add new events to core we should always add them here too.&lt;br /&gt;
&lt;br /&gt;
Under each event, list the data sent as part of the event.&lt;br /&gt;
&lt;br /&gt;
===Users===&lt;br /&gt;
* user_created&lt;br /&gt;
** full new record from &#039;user&#039; table&lt;br /&gt;
* user_updated&lt;br /&gt;
** full new record from &#039;user&#039; table&lt;br /&gt;
&lt;br /&gt;
===Courses===&lt;br /&gt;
* course_created&lt;br /&gt;
** full course record&lt;br /&gt;
* course_updated&lt;br /&gt;
** full course record&lt;br /&gt;
* course_deleted&lt;br /&gt;
** full course record&lt;br /&gt;
* course_category_deleted&lt;br /&gt;
** full category record&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
* groups_member_added&lt;br /&gt;
** groupid&lt;br /&gt;
** userid&lt;br /&gt;
* groups_member_removed&lt;br /&gt;
** groupid&lt;br /&gt;
** userid&lt;br /&gt;
* groups_group_created&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** description&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
** picture&lt;br /&gt;
* groups_group_updated&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** description&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
** picture&lt;br /&gt;
* groups_group_deleted&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** description&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
** picture&lt;br /&gt;
* groups_grouping_created&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
* groups_grouping_updated&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
* groups_grouping_deleted&lt;br /&gt;
** id&lt;br /&gt;
** courseid&lt;br /&gt;
** name&lt;br /&gt;
** timecreated&lt;br /&gt;
** timemodified&lt;br /&gt;
* groups_members_removed (user deleted from all groups in a course)&lt;br /&gt;
** courseid&lt;br /&gt;
** userid&lt;br /&gt;
* groups_groupings_groups_removed (remove all groups from all groupings in a course)&lt;br /&gt;
** courseid (as plain integer, not object)&lt;br /&gt;
* groups_groups_deleted (delete all groups in a course)&lt;br /&gt;
** courseid (as plain integer, not object)&lt;br /&gt;
* groups_groupings_deleted (delete all groupings in a course)&lt;br /&gt;
** courseid (as plain integer, not object)&lt;br /&gt;
&lt;br /&gt;
===Messaging===&lt;br /&gt;
* message_send&lt;br /&gt;
** component = &#039;mod/forum&#039;: path in Moodle&lt;br /&gt;
** name = &#039;posts&#039;: type of message from that module (as module defines it)&lt;br /&gt;
** userfrom = $userfrom: a user object to send from&lt;br /&gt;
** userto = $userto: a user object to send to&lt;br /&gt;
** subject = &#039;subject line&#039;: a short text line&lt;br /&gt;
** fullmessage = &#039;full plain text&#039;: raw text as entered by user&lt;br /&gt;
** fullmessageformat = FORMAT_PLAIN|FORMAT_HTML|FORMAT_MOODLE|FORMAT_MARKDOWN: the format of this text&lt;br /&gt;
** fullmessagehtml = &#039;long html text&#039;; html rendered version (optional)&lt;br /&gt;
** smallmessage = &#039;short text&#039;: useful for plugins like sms or twitter (optional)&lt;br /&gt;
&lt;br /&gt;
===Portfolio===&lt;br /&gt;
* portfolio_send&lt;br /&gt;
** id : recordid in portfolio_tempdata table, used for itemid in file storage&lt;br /&gt;
&lt;br /&gt;
==Events wishlist==&lt;br /&gt;
&lt;br /&gt;
List of events which it would be nice to have.  Please add to this list if what you want is not shown here.&lt;br /&gt;
&lt;br /&gt;
* user_role_assign&lt;br /&gt;
* user_role_unassign&lt;br /&gt;
* mform_print_form -- this for all types of form e.g. admin settings, user profile, module updating, + some sort of standard way of discriminiating between them e.g. if ($form-&amp;gt;name == &#039;user_profile&#039;) {}. This would be better triggered at the end of the form generation process so that new bits can be inserted at any point, or existing bits could be removed.&lt;br /&gt;
* module_installed&lt;br /&gt;
* module_removed&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=69103 General Developer Forum thread for discussing this proposal]. &lt;br /&gt;
* [[Development:Messaging_2.0]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Coding guidelines|Events]]&lt;br /&gt;
[[Category:Grades]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development_talk:File_API&amp;diff=49065</id>
		<title>Development talk:File API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development_talk:File_API&amp;diff=49065"/>
		<updated>2009-01-20T15:37:56Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* meta information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Main tasks===&lt;br /&gt;
* File Storage API:&lt;br /&gt;
** abstract (M1)&lt;br /&gt;
** local pool implementation (M1)&lt;br /&gt;
** DB schema (M1)&lt;br /&gt;
** deletion, acls, metadata (M1)&lt;br /&gt;
** problem: empty directories, file overwriting&lt;br /&gt;
* File Manager API: &lt;br /&gt;
** unique class, able to handle one &amp;quot;file area&amp;quot; (M2)&lt;br /&gt;
** security (M2)&lt;br /&gt;
** hack old file manager to be able to work with new fileareas (M3)&lt;br /&gt;
** js and non js implementations of FileManager (M4)&lt;br /&gt;
** integration with editor (M4)&lt;br /&gt;
** integration with formslib (M4)&lt;br /&gt;
** integration with repos (M4)&lt;br /&gt;
** problem: zip support&lt;br /&gt;
* File Serving:&lt;br /&gt;
** from pool:&lt;br /&gt;
*** file.php&lt;br /&gt;
*** pluginfile.php&lt;br /&gt;
*** draftfile.php&lt;br /&gt;
*** userfile.php&lt;br /&gt;
** from other moddata places:&lt;br /&gt;
*** rssfile.php&lt;br /&gt;
*** user/pix.php&lt;br /&gt;
*** user/pixgroup.php&lt;br /&gt;
* Migration:&lt;br /&gt;
** course files (as much as possible, allow fallback) (M2)&lt;br /&gt;
** moddata&lt;br /&gt;
** &lt;br /&gt;
* Backup &amp;amp; restore:&lt;br /&gt;
&lt;br /&gt;
===Milestones===&lt;br /&gt;
M1: File storage API completed (this week)&lt;br /&gt;
M2: migration of course files + new filephp + FileManager + hacked old file manager (next monday)&lt;br /&gt;
M3: ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===rssfile.php===&lt;br /&gt;
It&#039;s said that rss/file.php is kept only for backwards compatibility. But what exactly is meant by &amp;quot;backwards compatibility&amp;quot;? &lt;br /&gt;
Just display feeds with nice error messages and info how to re-subscribe?&lt;br /&gt;
&lt;br /&gt;
== meta information ==&lt;br /&gt;
&lt;br /&gt;
It seems like it would be nice to include some meta information about certain file types, e.g.:&lt;br /&gt;
&lt;br /&gt;
* images: width, height, alt&lt;br /&gt;
* flash files: width, height&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development_talk:File_API&amp;diff=49064</id>
		<title>Development talk:File API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development_talk:File_API&amp;diff=49064"/>
		<updated>2009-01-20T15:37:17Z</updated>

		<summary type="html">&lt;p&gt;Brianking: New section: meta information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Main tasks===&lt;br /&gt;
* File Storage API:&lt;br /&gt;
** abstract (M1)&lt;br /&gt;
** local pool implementation (M1)&lt;br /&gt;
** DB schema (M1)&lt;br /&gt;
** deletion, acls, metadata (M1)&lt;br /&gt;
** problem: empty directories, file overwriting&lt;br /&gt;
* File Manager API: &lt;br /&gt;
** unique class, able to handle one &amp;quot;file area&amp;quot; (M2)&lt;br /&gt;
** security (M2)&lt;br /&gt;
** hack old file manager to be able to work with new fileareas (M3)&lt;br /&gt;
** js and non js implementations of FileManager (M4)&lt;br /&gt;
** integration with editor (M4)&lt;br /&gt;
** integration with formslib (M4)&lt;br /&gt;
** integration with repos (M4)&lt;br /&gt;
** problem: zip support&lt;br /&gt;
* File Serving:&lt;br /&gt;
** from pool:&lt;br /&gt;
*** file.php&lt;br /&gt;
*** pluginfile.php&lt;br /&gt;
*** draftfile.php&lt;br /&gt;
*** userfile.php&lt;br /&gt;
** from other moddata places:&lt;br /&gt;
*** rssfile.php&lt;br /&gt;
*** user/pix.php&lt;br /&gt;
*** user/pixgroup.php&lt;br /&gt;
* Migration:&lt;br /&gt;
** course files (as much as possible, allow fallback) (M2)&lt;br /&gt;
** moddata&lt;br /&gt;
** &lt;br /&gt;
* Backup &amp;amp; restore:&lt;br /&gt;
&lt;br /&gt;
===Milestones===&lt;br /&gt;
M1: File storage API completed (this week)&lt;br /&gt;
M2: migration of course files + new filephp + FileManager + hacked old file manager (next monday)&lt;br /&gt;
M3: ...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===rssfile.php===&lt;br /&gt;
It&#039;s said that rss/file.php is kept only for backwards compatibility. But what exactly is meant by &amp;quot;backwards compatibility&amp;quot;? &lt;br /&gt;
Just display feeds with nice error messages and info how to re-subscribe?&lt;br /&gt;
&lt;br /&gt;
== meta information ==&lt;br /&gt;
&lt;br /&gt;
It seems like it would be nice to include some meta information about certain file types, e.g.:&lt;br /&gt;
images: width, height, alt&lt;br /&gt;
flash files: width, height&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=49034</id>
		<title>Development:Events API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=49034"/>
		<updated>2009-01-19T14:49:54Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Courses */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{obsolete_design}}&lt;br /&gt;
{{Moodle 1.9}}&lt;br /&gt;
The Events API is a new core system in Moodle to allow better communication between modules.  It&#039;s based on modules triggering new events with attached data, and the other modules handling those events with custom functions.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using the example of a grade being posted from a module into the [[Development:Grades|new gradebook in Moodle 1.9]], but there are obviously all kinds of events possible.&lt;br /&gt;
&lt;br /&gt;
===Triggering an event===&lt;br /&gt;
&lt;br /&gt;
Whenever a grade is created or changed by a module, it should “tell” the system about it (in addition to any local working storage it uses).   So, using the quiz as an example, we first define an object as follows:&lt;br /&gt;
&lt;br /&gt;
 $eventdata = new object();&lt;br /&gt;
 $eventdata-&amp;gt;itemid = $grade_item-&amp;gt;id;&lt;br /&gt;
 $eventdata-&amp;gt;userid = $USER-&amp;gt;id;&lt;br /&gt;
 $eventdata-&amp;gt;gradevalue = $currentvalue;&lt;br /&gt;
&lt;br /&gt;
Then we post the object as an event and forget about it:&lt;br /&gt;
&lt;br /&gt;
 events_trigger(&#039;grade_updated&#039;, $eventdata);&lt;br /&gt;
&lt;br /&gt;
===Handling an event===&lt;br /&gt;
&lt;br /&gt;
Modules can define an events.php in their db directory which defines events they want to be notified about, and describes which of their functions or class methods should be notified.   For example, an export  plugin could register something like:&lt;br /&gt;
&lt;br /&gt;
 $handlers = array (&lt;br /&gt;
     &#039;grade_updated&#039; =&amp;gt; array (&lt;br /&gt;
         &#039;handlerfile&#039;      =&amp;gt; &#039;/grade/export/banner/lib.php&#039;,&lt;br /&gt;
         &#039;handlerfunction&#039;  =&amp;gt; &#039;banner_handle_grade_test&#039;,    // argument to call_user_func(), could be an array&lt;br /&gt;
         &#039;schedule&#039;         =&amp;gt; &#039;cron&#039;&lt;br /&gt;
     ) &lt;br /&gt;
 );&lt;br /&gt;
These are parsed during install / upgrade and stored in a simple database table.&lt;br /&gt;
&lt;br /&gt;
Then, when a grade_updated event happens, all the registered functions for that event will be called something like this (but with more error handling):&lt;br /&gt;
&lt;br /&gt;
          include_once($CFG-&amp;gt;dirroot.$handlers[&#039;grade_updated&#039;][&#039;handlerfile&#039;]);&lt;br /&gt;
          call_user_func($handlers[&#039;grade_updated&#039;][&#039;handlerfunction&#039;], $eventdata);&lt;br /&gt;
&lt;br /&gt;
All plugins in Moodle have access to this and can this easily “hook in” to &#039;grade_updated&#039; events (and of course any other events).&lt;br /&gt;
&lt;br /&gt;
==Database structure==&lt;br /&gt;
&lt;br /&gt;
There are 3 core tables for events. Note that if a handler is queued, and yet to be processed or processing failed, then all subsequent calls on that handler must be queued.&lt;br /&gt;
&lt;br /&gt;
===events_handlers===&lt;br /&gt;
&lt;br /&gt;
This table is for storing which components requests what type of event, and the location of the responsible handlers. For example, the grade book can register &#039;grade_added&#039; event with a function add_grade() that should be called any time an &#039;grade_added&#039; event is triggered by a module.&lt;br /&gt;
&lt;br /&gt;
These entries are created by parsing events.php files in all the modules, and can be rebuilt any time (during an upgrade, say).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventname&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|name of the event, e.g. &#039;grade_updated&#039;&lt;br /&gt;
|-&lt;br /&gt;
|handlermodule&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|e.g. moodle, mod/forum, block/rss_client&lt;br /&gt;
|-&lt;br /&gt;
|handlerfile&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|path to the file of the function, eg /grade/export/lib.php&lt;br /&gt;
|-&lt;br /&gt;
|handlerfunction&lt;br /&gt;
|text&lt;br /&gt;
|serialized string or array describing function, suitable to be passed to &#039;&#039;&#039;call_user_func()&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|schedule 	&lt;br /&gt;
|varchar(255) 	&lt;br /&gt;
|&#039;cron&#039; or &#039;instant&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue===&lt;br /&gt;
&lt;br /&gt;
This table is for storing queued events. It stores only one copy of the eventdata here, and entries from this table are being references by the events_queue_handlers table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventdata 	&lt;br /&gt;
|longtext 	&lt;br /&gt;
|serialized version of the data object passed to the event handler.&lt;br /&gt;
|-&lt;br /&gt;
|stackdump&lt;br /&gt;
|text&lt;br /&gt;
|serialized debug_backtrace showing where the event was fired from&lt;br /&gt;
|-&lt;br /&gt;
|userid&lt;br /&gt;
|int(10)&lt;br /&gt;
|$USER-&amp;gt;id when the event was fired&lt;br /&gt;
|-&lt;br /&gt;
|timecreated&lt;br /&gt;
|int(10) 	&lt;br /&gt;
|time stamp of the first time this was added&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue_handlers===&lt;br /&gt;
&lt;br /&gt;
This is the list of queued handlers for processing. The event object is retrieved from the events_queue table. When no further reference is made to the events_queue table, the corresponding entry in the events_queue table should be deleted. Entry should get deleted (?) after a successful event processing by the specified handler.  The status field keeps track of failures, after it gets to a certain number (eg 10?) it should trigger an &amp;quot;event failed&amp;quot; event (that could result in admin being emailed etc, or perhaps even the originating module taking care of it or rolling something back etc).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|queuedeventid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_queues table&lt;br /&gt;
|-&lt;br /&gt;
|handlerid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_handlers table&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|-&lt;br /&gt;
|errormessage&lt;br /&gt;
|text&lt;br /&gt;
|if an error happened last time we tried to process this event, record it here.&lt;br /&gt;
|-&lt;br /&gt;
|timemodified&lt;br /&gt;
|int(10)&lt;br /&gt;
|time stamp of the last attempt to run this from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Standards for naming events==&lt;br /&gt;
&lt;br /&gt;
All event names should follow a consistent naming pattern, such as modulename_noun_verb&lt;br /&gt;
&lt;br /&gt;
==Events which exist==&lt;br /&gt;
&lt;br /&gt;
===Users===&lt;br /&gt;
* user_updated&lt;br /&gt;
* password_changed&lt;br /&gt;
&lt;br /&gt;
===Courses===&lt;br /&gt;
* course_created&lt;br /&gt;
* course_updated&lt;br /&gt;
* course_deleted&lt;br /&gt;
* category_updated&lt;br /&gt;
* category_deleted&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
* group_deleted&lt;br /&gt;
* grouping_deleted&lt;br /&gt;
* group_user_added&lt;br /&gt;
* group_user_removed&lt;br /&gt;
&lt;br /&gt;
==Events wishlist==&lt;br /&gt;
&lt;br /&gt;
List of events which it would be nice to have.  Please add to this list if what you want is not shown here.&lt;br /&gt;
&lt;br /&gt;
* user_created (for example to handle custom emails.  this is commonly desired: e.g. send a custom email to a related person (teacher, boss, etc.) based on some institution-specific logic)&lt;br /&gt;
* user_enrolled_in_course&lt;br /&gt;
* user_unenrolled_from_course&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=69103 General Developer Forum thread for discussing this proposal]. &lt;br /&gt;
* [[:Development:Grades]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Events]]&lt;br /&gt;
[[Category:Grades]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=49033</id>
		<title>Development:Events API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=49033"/>
		<updated>2009-01-19T14:49:36Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Events wishlist */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{obsolete_design}}&lt;br /&gt;
{{Moodle 1.9}}&lt;br /&gt;
The Events API is a new core system in Moodle to allow better communication between modules.  It&#039;s based on modules triggering new events with attached data, and the other modules handling those events with custom functions.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using the example of a grade being posted from a module into the [[Development:Grades|new gradebook in Moodle 1.9]], but there are obviously all kinds of events possible.&lt;br /&gt;
&lt;br /&gt;
===Triggering an event===&lt;br /&gt;
&lt;br /&gt;
Whenever a grade is created or changed by a module, it should “tell” the system about it (in addition to any local working storage it uses).   So, using the quiz as an example, we first define an object as follows:&lt;br /&gt;
&lt;br /&gt;
 $eventdata = new object();&lt;br /&gt;
 $eventdata-&amp;gt;itemid = $grade_item-&amp;gt;id;&lt;br /&gt;
 $eventdata-&amp;gt;userid = $USER-&amp;gt;id;&lt;br /&gt;
 $eventdata-&amp;gt;gradevalue = $currentvalue;&lt;br /&gt;
&lt;br /&gt;
Then we post the object as an event and forget about it:&lt;br /&gt;
&lt;br /&gt;
 events_trigger(&#039;grade_updated&#039;, $eventdata);&lt;br /&gt;
&lt;br /&gt;
===Handling an event===&lt;br /&gt;
&lt;br /&gt;
Modules can define an events.php in their db directory which defines events they want to be notified about, and describes which of their functions or class methods should be notified.   For example, an export  plugin could register something like:&lt;br /&gt;
&lt;br /&gt;
 $handlers = array (&lt;br /&gt;
     &#039;grade_updated&#039; =&amp;gt; array (&lt;br /&gt;
         &#039;handlerfile&#039;      =&amp;gt; &#039;/grade/export/banner/lib.php&#039;,&lt;br /&gt;
         &#039;handlerfunction&#039;  =&amp;gt; &#039;banner_handle_grade_test&#039;,    // argument to call_user_func(), could be an array&lt;br /&gt;
         &#039;schedule&#039;         =&amp;gt; &#039;cron&#039;&lt;br /&gt;
     ) &lt;br /&gt;
 );&lt;br /&gt;
These are parsed during install / upgrade and stored in a simple database table.&lt;br /&gt;
&lt;br /&gt;
Then, when a grade_updated event happens, all the registered functions for that event will be called something like this (but with more error handling):&lt;br /&gt;
&lt;br /&gt;
          include_once($CFG-&amp;gt;dirroot.$handlers[&#039;grade_updated&#039;][&#039;handlerfile&#039;]);&lt;br /&gt;
          call_user_func($handlers[&#039;grade_updated&#039;][&#039;handlerfunction&#039;], $eventdata);&lt;br /&gt;
&lt;br /&gt;
All plugins in Moodle have access to this and can this easily “hook in” to &#039;grade_updated&#039; events (and of course any other events).&lt;br /&gt;
&lt;br /&gt;
==Database structure==&lt;br /&gt;
&lt;br /&gt;
There are 3 core tables for events. Note that if a handler is queued, and yet to be processed or processing failed, then all subsequent calls on that handler must be queued.&lt;br /&gt;
&lt;br /&gt;
===events_handlers===&lt;br /&gt;
&lt;br /&gt;
This table is for storing which components requests what type of event, and the location of the responsible handlers. For example, the grade book can register &#039;grade_added&#039; event with a function add_grade() that should be called any time an &#039;grade_added&#039; event is triggered by a module.&lt;br /&gt;
&lt;br /&gt;
These entries are created by parsing events.php files in all the modules, and can be rebuilt any time (during an upgrade, say).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventname&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|name of the event, e.g. &#039;grade_updated&#039;&lt;br /&gt;
|-&lt;br /&gt;
|handlermodule&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|e.g. moodle, mod/forum, block/rss_client&lt;br /&gt;
|-&lt;br /&gt;
|handlerfile&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|path to the file of the function, eg /grade/export/lib.php&lt;br /&gt;
|-&lt;br /&gt;
|handlerfunction&lt;br /&gt;
|text&lt;br /&gt;
|serialized string or array describing function, suitable to be passed to &#039;&#039;&#039;call_user_func()&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|schedule 	&lt;br /&gt;
|varchar(255) 	&lt;br /&gt;
|&#039;cron&#039; or &#039;instant&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue===&lt;br /&gt;
&lt;br /&gt;
This table is for storing queued events. It stores only one copy of the eventdata here, and entries from this table are being references by the events_queue_handlers table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventdata 	&lt;br /&gt;
|longtext 	&lt;br /&gt;
|serialized version of the data object passed to the event handler.&lt;br /&gt;
|-&lt;br /&gt;
|stackdump&lt;br /&gt;
|text&lt;br /&gt;
|serialized debug_backtrace showing where the event was fired from&lt;br /&gt;
|-&lt;br /&gt;
|userid&lt;br /&gt;
|int(10)&lt;br /&gt;
|$USER-&amp;gt;id when the event was fired&lt;br /&gt;
|-&lt;br /&gt;
|timecreated&lt;br /&gt;
|int(10) 	&lt;br /&gt;
|time stamp of the first time this was added&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue_handlers===&lt;br /&gt;
&lt;br /&gt;
This is the list of queued handlers for processing. The event object is retrieved from the events_queue table. When no further reference is made to the events_queue table, the corresponding entry in the events_queue table should be deleted. Entry should get deleted (?) after a successful event processing by the specified handler.  The status field keeps track of failures, after it gets to a certain number (eg 10?) it should trigger an &amp;quot;event failed&amp;quot; event (that could result in admin being emailed etc, or perhaps even the originating module taking care of it or rolling something back etc).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|queuedeventid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_queues table&lt;br /&gt;
|-&lt;br /&gt;
|handlerid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_handlers table&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|-&lt;br /&gt;
|errormessage&lt;br /&gt;
|text&lt;br /&gt;
|if an error happened last time we tried to process this event, record it here.&lt;br /&gt;
|-&lt;br /&gt;
|timemodified&lt;br /&gt;
|int(10)&lt;br /&gt;
|time stamp of the last attempt to run this from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Standards for naming events==&lt;br /&gt;
&lt;br /&gt;
All event names should follow a consistent naming pattern, such as modulename_noun_verb&lt;br /&gt;
&lt;br /&gt;
==Events which exist==&lt;br /&gt;
&lt;br /&gt;
===Users===&lt;br /&gt;
* user_updated&lt;br /&gt;
* password_changed&lt;br /&gt;
&lt;br /&gt;
===Courses===&lt;br /&gt;
* course_updated&lt;br /&gt;
* course_deleted&lt;br /&gt;
* category_updated&lt;br /&gt;
* category_deleted&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
* group_deleted&lt;br /&gt;
* grouping_deleted&lt;br /&gt;
* group_user_added&lt;br /&gt;
* group_user_removed&lt;br /&gt;
&lt;br /&gt;
==Events wishlist==&lt;br /&gt;
&lt;br /&gt;
List of events which it would be nice to have.  Please add to this list if what you want is not shown here.&lt;br /&gt;
&lt;br /&gt;
* user_created (for example to handle custom emails.  this is commonly desired: e.g. send a custom email to a related person (teacher, boss, etc.) based on some institution-specific logic)&lt;br /&gt;
* user_enrolled_in_course&lt;br /&gt;
* user_unenrolled_from_course&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=69103 General Developer Forum thread for discussing this proposal]. &lt;br /&gt;
* [[:Development:Grades]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Events]]&lt;br /&gt;
[[Category:Grades]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:lib/formslib.php_Form_Definition&amp;diff=35553</id>
		<title>Development:lib/formslib.php Form Definition</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:lib/formslib.php_Form_Definition&amp;diff=35553"/>
		<updated>2008-05-02T15:37:33Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* multi-select */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Formslib}}&lt;br /&gt;
==definition()==&lt;br /&gt;
&lt;br /&gt;
The definition of the elements to be included in the form, their &#039;types&#039; (PARAM_*), helpbuttons included, etc is all included in a function you must define in your class &#039;definition();&#039;&lt;br /&gt;
&lt;br /&gt;
definition() is used to define the elements in the form and &#039;&#039;&#039;this definition will be used for validating data submitted as well as for printing the form.&#039;&#039;&#039; For select and checkbox type elements only data that could have been selected will be allowed. And only data that corresponds to a form element in the defintion will be accepted as submitted data.&lt;br /&gt;
&lt;br /&gt;
The definition() should include all elements that are going to be used on form, some elements may be removed or tweaked later in definition_after_data(). Please do not create conditional elements in definition(), the definition() should not directly depend on the submitted data.&lt;br /&gt;
&lt;br /&gt;
==Use Fieldsets to group Form Elements==&lt;br /&gt;
&lt;br /&gt;
You use code like this to open a fieldset with a legend.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//-------------------------------------------------------------------------------&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;header&#039;, &#039;nameforyourheaderelement&#039;, get_string(&#039;titleforlegened&#039;, &#039;modulename&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can&#039;t yet nest these visible fieldsets unfortunately. But in fact groups of elements are wrapped in invisible fieldsets.&lt;br /&gt;
&lt;br /&gt;
You close a fieldset with moodle_form&#039;s closeHeaderBefore method. You tell closeHeaderBefore the element before you wish to end the fieldset. A fieldset is automatically closed if you open a new one. You need to use this code only if you want to close a fieldset and the subsequent form elements are not to be enclosed by a visible fieldset (they are still enclosed with an invisibe one with no legend) :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;closeHeaderBefore(&#039;buttonar&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==addElement==&lt;br /&gt;
&lt;br /&gt;
Use the addElement method to add an element to a form. The first few arguments are always the same. The first param is the type of the element to add. The second is the elementname to use which is normally the html name of the element in the form. The third is often the text for the label for the element.&lt;br /&gt;
&lt;br /&gt;
Some examples are below :&lt;br /&gt;
===button===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            $mform-&amp;gt;addElement(&#039;button&#039;, &#039;intro&#039;, get_string(&amp;quot;buttonlabel&amp;quot;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A button element. If you want a submit or cancel button see &#039;submit&#039; element. &lt;br /&gt;
&lt;br /&gt;
===checkbox===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;checkbox&#039;, &#039;ratingtime&#039;, get_string(&#039;ratingtime&#039;, &#039;forum&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a simple checkbox. The third param for this element is the label to display on the left side of the form. You can also supply a string as a fourth param to specify a label that will appear on the right of the element. Checkboxes and radio buttons can be grouped and have individual labels on their right.&lt;br /&gt;
&lt;br /&gt;
====advcheckbox====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;advcheckbox&#039;, &#039;ratingtime&#039;, get_string(&#039;ratingtime&#039;, &#039;forum&#039;), array(0, 1), array(&#039;group&#039; =&amp;gt; 1));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Similar to the checkbox above, but with a couple of important improvements:&lt;br /&gt;
&lt;br /&gt;
#The 4th parameter is an array of values that will be associated with the checked/unchecked state of the checkbox. With a normal checkbox you cannot choose that value, and in fact an unchecked checkbox will not even be sent with the form data.&lt;br /&gt;
#The 5th parameter is a normal $attributes array, normally used to set HTML attributes for the &amp;lt;input&amp;gt; element. However, a special value of &#039;group&#039; can be given, which will add a class name to the element, and enable its grouping for a [[Development:lib/formslib.php_add_checkbox_controller|checkbox controller]]&lt;br /&gt;
&lt;br /&gt;
===choosecoursefile===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;choosecoursefile&#039;, &#039;mediafile&#039;, get_string(&#039;mediafile&#039;, &#039;lesson&#039;), array(&#039;courseid&#039;=&amp;gt;$COURSE-&amp;gt;id));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Choose a file from the course files area. The fourth option is a list of options for the element. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array(&#039;courseid&#039;=&amp;gt;null,\\if it is null (default then use globabl $COURSE&lt;br /&gt;
 &#039;height&#039;=&amp;gt;500,\\ height of the popup window&lt;br /&gt;
 &#039;width&#039;=&amp;gt;750, \\ width of the popup window&lt;br /&gt;
&#039;options&#039;=&amp;gt;&#039;none&#039;);\\options string for the pop up window &lt;br /&gt;
                   \\eg. &#039;menubar=0,location=0,scrollbars,resizable&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===date_selector===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;date_selector&#039;, &#039;assesstimefinish&#039;, get_string(&#039;to&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a date selector. You can select a Day, Month and Year using a group of select boxes. The fourth param here is an array of options. The defaults for the options are :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;array(&#039;startyear&#039;=&amp;gt;1970, &#039;stopyear&#039;=&amp;gt;2020,&lt;br /&gt;
                    &#039;timezone&#039;=&amp;gt;99, &#039;applydst&#039;=&amp;gt;true);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can override these defaults by supplying an array as fourth param with one or more keys with a value to override the default. You can supply a fifth param of attributes here as well.&lt;br /&gt;
&lt;br /&gt;
===date_time_selector===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;date_time_selector&#039;, &#039;assesstimestart&#039;, get_string(&#039;from&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a group of select boxes to select a date (Day Month and Year) and time (Hour and Minute). When submitted, submitted data is processed and a timestamp is passed to $form-&amp;gt;get_data(); the fourth param here is an array of options. The defaults for the options are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;array(&#039;startyear&#039;=&amp;gt;1970, &#039;stopyear&#039;=&amp;gt;2020,&lt;br /&gt;
                    &#039;timezone&#039;=&amp;gt;99, &#039;applydst&#039;=&amp;gt;true, &#039;step&#039;=&amp;gt;5);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can override these defaults by supplying an array as fourth param with one or more keys with a value to override the default. You can supply a fifth param of attributes here as well.&lt;br /&gt;
&lt;br /&gt;
===file===&lt;br /&gt;
&lt;br /&gt;
File upload input box with browse button. In the form definition type&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            $mform-&amp;gt;addElement(&#039;file&#039;, &#039;attachment&#039;, get_string(&#039;attachment&#039;, &#039;forum&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
after form submission and validation use&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            if ($data = $mform-&amp;gt;get_data()) {&lt;br /&gt;
              ...&lt;br /&gt;
              $mform-&amp;gt;save_files($destination_directory);&lt;br /&gt;
              ...&lt;br /&gt;
            }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you need advanced settings such as required file, different max upload size or name of uploaded file&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            $this-&amp;gt;set_upload_manager(new upload_manager(&#039;attachment&#039;, true, false, $COURSE, false, 0, true, true, false));&lt;br /&gt;
            $mform-&amp;gt;addElement(&#039;file&#039;, &#039;attachment&#039;, get_string(&#039;attachment&#039;, &#039;forum&#039;));&lt;br /&gt;
            $mform-&amp;gt;addRule(&#039;attachment&#039;, null, &#039;required&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            if ($data = $mform-&amp;gt;get_data()) {&lt;br /&gt;
              ...&lt;br /&gt;
              $mform-&amp;gt;save_files($destination_directory);&lt;br /&gt;
              $newfilename = $mform-&amp;gt;get_new_filename();&lt;br /&gt;
              ...&lt;br /&gt;
            }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When porting old code it is also possible to use the upload manager directly for processing of uploaded files.&lt;br /&gt;
&lt;br /&gt;
Please note that if using set_upload_manager() it must be before addElement(&#039;file&#039;,..).&lt;br /&gt;
&lt;br /&gt;
===hidden===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         $mform-&amp;gt;addElement(&#039;hidden&#039;, &#039;reply&#039;, &#039;yes&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A hidden element. Set the element name (in this case &#039;&#039;&#039;reply&#039;&#039;&#039;) to the stated value (in this case &#039;&#039;&#039;yes&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
===htmleditor &amp;amp; format===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;htmleditor&#039;, &#039;text&#039;, get_string(&#039;choicetext&#039;, &#039;choice&#039;));&lt;br /&gt;
        $mform-&amp;gt;setType(&#039;text&#039;, PARAM_RAW);&lt;br /&gt;
	$mform-&amp;gt;addRule(&#039;text&#039;, null, &#039;required&#039;, null, &#039;client&#039;);&lt;br /&gt;
&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;format&#039;, &#039;format&#039;, get_string(&#039;format&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can supply a fourth param to htmleditor of an array of options :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array(&#039;canUseHtmlEditor&#039;=&amp;gt;&#039;detect&#039;,&#039;rows&#039;=&amp;gt;10, &#039;cols&#039;=&amp;gt;65, &lt;br /&gt;
&#039;width&#039;=&amp;gt;0,&#039;height&#039;=&amp;gt;0, &#039;course&#039;=&amp;gt;0);&lt;br /&gt;
//options same as print_textarea params&lt;br /&gt;
//use rows and cols options to control htmleditor size.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===modgrade===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;modgrade&#039;, &#039;scale&#039;, get_string(&#039;grade&#039;), false);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a custom element for selecting a grade for any activity module. The fourth argument is whether to include an option for no grade which has a value 0. This select box does include scales. The default is true, include no grade option.&lt;br /&gt;
&lt;br /&gt;
A helpbutton is automatically added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===password===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         $mform-&amp;gt;addElement(&#039;password&#039;, &#039;password&#039;, get_string(&#039;label&#039;), $attributes);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A password element. Fourth param is an array or string of attributes.&lt;br /&gt;
&lt;br /&gt;
===passwordunmask===&lt;br /&gt;
{{Moodle 1.9}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         $mform-&amp;gt;addElement(&#039;passwordunmask&#039;, &#039;password&#039;, get_string(&#039;label&#039;), $attributes);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A password element with option to show the password in plaintext. Fourth param is an array or string of attributes.&lt;br /&gt;
&lt;br /&gt;
===radio===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $radioarray=array();&lt;br /&gt;
        $radioarray[] = &amp;amp;MoodleQuickForm::createElement(&#039;radio&#039;, &#039;yesno&#039;, &#039;&#039;, get_string(&#039;yes&#039;), 1, $attributes);&lt;br /&gt;
        $radioarray[] = &amp;amp;MoodleQuickForm::createElement(&#039;radio&#039;, &#039;yesno&#039;, &#039;&#039;, get_string(&#039;no&#039;), 0, $attributes);&lt;br /&gt;
        $mform-&amp;gt;addGroup($radioarray, &#039;radioar&#039;, &#039;&#039;, array(&#039; &#039;), false);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Second param names the radio button and should be the same for each button in the group in order to toggle correctly. Third param would be the label for the form element but is generally ignored as this element will always be in a group which has it&#039;s own label. Fourth param is a string, a label to be displayed on the right of the element. The fifth is the value for this radio button. $attributes can be a string or an array of attributes.&lt;br /&gt;
&lt;br /&gt;
====setDefault====&lt;br /&gt;
&lt;br /&gt;
To set the default for a radio button group as above use the following :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;setDefault(&#039;yesno&#039;, 0);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would make the default &#039;no&#039;.&lt;br /&gt;
&lt;br /&gt;
===select===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;select&#039;, &#039;type&#039;, get_string(&#039;forumtype&#039;, &#039;forum&#039;), $FORUM_TYPES, $attributes);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fourth param for this element is an array of options for the select box. The keys are the values for the option and the value of the array is the text for the option. The fifth param $attributes is optional, see text element for description of attributes param.&lt;br /&gt;
&lt;br /&gt;
====multi-select====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $select = &amp;amp;$mform-&amp;gt;addElement(&#039;select&#039;, &#039;colors&#039;, get_string(&#039;colors&#039;), array(&#039;red&#039;, &#039;blue&#039;, &#039;green&#039;), $attributes);&lt;br /&gt;
        $select-&amp;gt;setMultiple(true);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===selectyesno===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;selectyesno&#039;, &#039;maxbytes&#039;, get_string(&#039;maxattachmentsize&#039;, &#039;forum&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want a yes / no select box this one automatically translates itself and has value 1 for yes and 0 for no.&lt;br /&gt;
&lt;br /&gt;
===static===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         $mform-&amp;gt;addElement(&#039;static&#039;, &#039;description&#039;, get_string(&#039;description&#039;, &#039;exercise&#039;),&lt;br /&gt;
                  get_string(&#039;descriptionofexercise&#039;, &#039;exercise&#039;, $COURSE-&amp;gt;students));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a static element. It should be used with care it is used to display a static piece of text with a label. The third param is the label and the fourth is the static text itself.&lt;br /&gt;
&lt;br /&gt;
===submit, reset and cancel===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        //normally you use add_action_buttons instead of this code&lt;br /&gt;
        $buttonarray=array();&lt;br /&gt;
        $buttonarray[] = &amp;amp;$mform-&amp;gt;createElement(&#039;submit&#039;, &#039;submitbutton&#039;, get_string(&#039;savechanges&#039;));&lt;br /&gt;
        $buttonarray[] = &amp;amp;$mform-&amp;gt;createElement(&#039;reset&#039;, &#039;resetbutton&#039;, get_string(&#039;revert&#039;));&lt;br /&gt;
        $buttonarray[] = &amp;amp;$mform-&amp;gt;createElement(&#039;cancel&#039;);&lt;br /&gt;
        $mform-&amp;gt;addGroup($buttonarray, &#039;buttonar&#039;, &#039;&#039;, array(&#039; &#039;), false);&lt;br /&gt;
        $mform-&amp;gt;closeHeaderBefore(&#039;buttonar&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;Submit&#039; type element is a submit type form element which will submit the form. A &#039;Reset&#039; will not submit the form but will reset any changes the user has made to form contents. A &#039;Cancel&#039; element cancels form submission. You need to have a branch in your code before you check for get_data() to check if submission has been cancelled with is_cancelled(); See the example on the usage page.&lt;br /&gt;
&lt;br /&gt;
You should name your submit and reset buttons &#039;submitbutton&#039; and &#039;resetbutton&#039; or something similar (not &#039;submit&#039; and &#039;reset&#039;). This avoids problems in JavaScript of collisions between form element names and names of JavaScript methods of the form object.&lt;br /&gt;
&lt;br /&gt;
====add_action_buttons($cancel = true, $submitlabel=null);====&lt;br /&gt;
&lt;br /&gt;
You will normally use this helper function which is a method of moodleform to add all the &#039;action&#039; buttons to the end of your form. A boolean parameter allow you to specify whether to include a cancel button and specify the label for your submit button (pass the result of get_string). Default for the submit button label is get_string(&#039;savechanges&#039;).&lt;br /&gt;
&lt;br /&gt;
===text===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;text&#039;, &#039;name&#039;, get_string(&#039;forumname&#039;, &#039;forum&#039;), $attributes);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For a simple text element. Your fourth parameter here can be a string or array of attributes for the text element. The following are equivalent :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $attributes=&#039;size=&amp;quot;20&amp;quot;&#039;;&lt;br /&gt;
        $attributes=array(&#039;size&#039;=&amp;gt;&#039;20&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Generally you are encouraged to use CSS instead of using attributes for styling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A format element can be used as a format select box. It will be non-selectable if you&#039;re using an html editor.&lt;br /&gt;
&lt;br /&gt;
The third param for this element is $useHtmlEditor and it defaults to null in which case an html editor is used if the browser and user profile support it.&lt;br /&gt;
&lt;br /&gt;
===textarea===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            $mform-&amp;gt;addElement(&#039;textarea&#039;, &#039;introduction&#039;, get_string(&amp;quot;introtext&amp;quot;, &amp;quot;survey&amp;quot;), &#039;wrap=&amp;quot;virtual&amp;quot; rows=&amp;quot;20&amp;quot; cols=&amp;quot;50&amp;quot;&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A textarea element. If you want an htmleditor use htmleditor element. Fourth element here is a string or array of attributes.&lt;br /&gt;
&lt;br /&gt;
==addGroup==&lt;br /&gt;
&lt;br /&gt;
A &#039;group&#039; in formslib is just a group of elements that will have a label and will be included on one line. &lt;br /&gt;
&lt;br /&gt;
For example typical code to include a submit and cancel button on the same line : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $buttonarray=array();&lt;br /&gt;
        $buttonarray[] =&amp;amp; $mform-&amp;gt;createElement(&#039;submit&#039;, &#039;submitbutton&#039;, get_string(&#039;savechanges&#039;));&lt;br /&gt;
        $buttonarray[] =&amp;amp; $mform-&amp;gt;createElement(&#039;submit&#039;, &#039;cancel&#039;, get_string(&#039;cancel&#039;));&lt;br /&gt;
        $mform-&amp;gt;addGroup($buttonarray, &#039;buttonar&#039;, &#039;&#039;, array(&#039; &#039;), false);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You use the same arguments for createElement as you do for addElement. Any label for the element in the third argument is normally ignored (but not in the case of the submit buttons above where the third argument is not for a label but is the text for the button).&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an example of putting a date_selector (which is itself a group of elements) and a checkbox on the same line, note that you can disable every element in the group using the group name &#039;availablefromgroup&#039; but it doesn&#039;t disable the controlling element the &#039;availablefromenabled&#039; checkbox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $availablefromgroup=array();&lt;br /&gt;
	$availablefromgroup[] =&amp;amp; $mform-&amp;gt;createElement(&#039;date_selector&#039;, &#039;availablefrom&#039;, &#039;&#039;);&lt;br /&gt;
	$availablefromgroup[] =&amp;amp; $mform-&amp;gt;createElement(&#039;checkbox&#039;, &#039;availablefromenabled&#039;, &#039;&#039;, get_string(&#039;enable&#039;));&lt;br /&gt;
        $mform-&amp;gt;addGroup($availablefromgroup, &#039;availablefromgroup&#039;, get_string(&#039;availablefromdate&#039;, &#039;data&#039;), &#039;&amp;amp;nbsp;&#039;, false);&lt;br /&gt;
        $mform-&amp;gt;disabledIf(&#039;availablefromgroup&#039;, &#039;availablefromenabled&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==setHelpButton==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            $mform-&amp;gt;setHelpButton(&#039;lessondefault&#039;, array(&#039;lessondefault&#039;, get_string(&#039;lessondefault&#039;, &#039;lesson&#039;), &#039;lesson&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
First param is an elementname and the second param is an array of params that are passed to helpbutton in weblib.php. Params are :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * @param string $page  The keyword that defines a help page&lt;br /&gt;
 * @param string $title The title of links, rollover tips, alt tags etc&lt;br /&gt;
 *           &#039;Help with&#039; (or the language equivalent) will be prefixed and &#039;...&#039; will be stripped.&lt;br /&gt;
 * @param string $module Which module is the page defined in&lt;br /&gt;
 * @param mixed $image Use a help image for the link?  (true/false/&amp;quot;both&amp;quot;)&lt;br /&gt;
 * @param boolean $linktext If true, display the title next to the help icon.&lt;br /&gt;
 * @param string $text If defined then this text is used in the page, and&lt;br /&gt;
 *           the $page variable is ignored.&lt;br /&gt;
 * @param boolean $return If true then the output is returned as a string, if false it is printed to the current page.&lt;br /&gt;
 * @param string $imagetext The full text for the helpbutton icon. If empty use default help.gif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make sure you don&#039;t set boolean $return to false. &lt;br /&gt;
&lt;br /&gt;
You need to do use this method after addElement();&lt;br /&gt;
&lt;br /&gt;
==setDefault==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;select&#039;, &#039;grade&#039;, get_string(&#039;gradeforsubmission&#039;, &#039;exercise&#039;), $grades);&lt;br /&gt;
        $mform-&amp;gt;setHelpButton(&#039;grade&#039;, array(&#039;grade&#039;, get_string(&#039;gradeforsubmission&#039;, &#039;exercise&#039;), &#039;exercise&#039;));&lt;br /&gt;
        $mform-&amp;gt;setDefault(&#039;grade&#039;, 100);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the default of the form value with setDefault($elementname, $value); where elementname is the elementname whose default you want to set and $value is the default to set. We set the defaults for the form in definition(). This default is what is used if no data is loaded into the form with set_data(); eg. on display of the form for an &#039;add&#039; rather than &#039;update&#039; function.&lt;br /&gt;
&lt;br /&gt;
==disabledIf==&lt;br /&gt;
&lt;br /&gt;
For any element or groups of element in a form you can conditionally disable the group or individual element depending on conditions.&lt;br /&gt;
&lt;br /&gt;
You can use $mform-&amp;gt;disabledIf($elementName, $dependentOn, $condition = &#039;notchecked&#039;, $value=null)&lt;br /&gt;
&lt;br /&gt;
* elementname can be a group. If you specify a group all elements in the group will be disabled (if dependentOn is in elementname group that is ignored and not disabled). These are the element names you&#039;ve used as the first argument in addElement or addGroup.&lt;br /&gt;
* dependentOn is the actual name of the element as it will appear in html. This can be different to the name used in addGroup particularly but also addElement where you&#039;re adding a complex element like a date_selector. Check the html of your page. You typically make the depedentOn a checkbox or select box.&lt;br /&gt;
* $condition will be notchecked, checked, selected, eq or if it is anything else then we test for neq.&lt;br /&gt;
* If $condition is eq or neq then we check the value of the dependentOn field and check for equality (==) or nonequality (!=) in js&lt;br /&gt;
* If $condition is checked or notchecked then we check to see if a checkbox is checked or not.&lt;br /&gt;
* If $condition is selected then we check to see if a particular option is selected from a dropdown list.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: I am not sure this section is complete. I just found and added one missing case, but there may be others--[[User:Tim Hunt|Tim Hunt]] 06:04, 15 October 2007 (CDT)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==setType==&lt;br /&gt;
&lt;br /&gt;
PARAM_* types are used to specify how a submitted variable should be cleaned. These should be used for get parameters such as id, course etc. which are used to load a page and also with setType(); method. Every form element should have a type specified except select, radio box and checkbox elements, these elements do a good job of cleaning themselves (only specified options are allowed as user input).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Most Commonly Used PARAM_* Types===&lt;br /&gt;
&lt;br /&gt;
These are the most commonly used PARAM_* types and their proper uses. More types can be seen in moodlelib.php starting around line 100.&lt;br /&gt;
&lt;br /&gt;
* PARAM_CLEAN is deprecated and you should try to use a more specific type.&lt;br /&gt;
* PARAM_TEXT should be used for cleaning data that is expected to be plain text. It will strip all html tags. But will still let tags for multilang support through.&lt;br /&gt;
* PARAM_NOTAGS should be used for cleaning data that is expected to be plain text. It will strip *all* html type tags. It will still *not* let tags for multilang support through. This should be used for instance for email addresses where no multilang support is appropriate.&lt;br /&gt;
* PARAM_RAW means no cleaning whatsoever, it is used mostly for data from the html editor. Data from the editor is later cleaned before display using format_text() function. PARAM_RAW can also be used for data that is validated by some other way or printed by p() or s().&lt;br /&gt;
* PARAM_INT should be used for integers.&lt;br /&gt;
* PARAM_ACTION is an alias of PARAM_ALPHA and is used for hidden fields specifying form actions.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [http://midnighthax.com/quickform.php PEAR HTML QuickForm Getting Started Guide by Keith Edmunds of Midnighthax.com]&lt;br /&gt;
&lt;br /&gt;
[[Category:Formslib]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:lib/formslib.php_Form_Definition&amp;diff=34887</id>
		<title>Development:lib/formslib.php Form Definition</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:lib/formslib.php_Form_Definition&amp;diff=34887"/>
		<updated>2008-04-16T21:30:54Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* select */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Formslib}}&lt;br /&gt;
==definition()==&lt;br /&gt;
&lt;br /&gt;
The definition of the elements to be included in the form, their &#039;types&#039; (PARAM_*), helpbuttons included, etc is all included in a function you must define in your class &#039;definition();&#039;&lt;br /&gt;
&lt;br /&gt;
definition() is used to define the elements in the form and &#039;&#039;&#039;this definition will be used for validating data submitted as well as for printing the form.&#039;&#039;&#039; For select and checkbox type elements only data that could have been selected will be allowed. And only data that corresponds to a form element in the defintion will be accepted as submitted data.&lt;br /&gt;
&lt;br /&gt;
The definition() should include all elements that are going to be used on form, some elements may be removed or tweaked later in definition_after_data(). Please do not create conditional elements in definition(), the definition() should not directly depend on the submitted data.&lt;br /&gt;
&lt;br /&gt;
==Use Fieldsets to group Form Elements==&lt;br /&gt;
&lt;br /&gt;
You use code like this to open a fieldset with a legend.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//-------------------------------------------------------------------------------&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;header&#039;, &#039;nameforyourheaderelement&#039;, get_string(&#039;titleforlegened&#039;, &#039;modulename&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can&#039;t yet nest these visible fieldsets unfortunately. But in fact groups of elements are wrapped in invisible fieldsets.&lt;br /&gt;
&lt;br /&gt;
You close a fieldset with moodle_form&#039;s closeHeaderBefore method. You tell closeHeaderBefore the element before you wish to end the fieldset. A fieldset is automatically closed if you open a new one. You need to use this code only if you want to close a fieldset and the subsequent form elements are not to be enclosed by a visible fieldset (they are still enclosed with an invisibe one with no legend) :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;closeHeaderBefore(&#039;buttonar&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==addElement==&lt;br /&gt;
&lt;br /&gt;
Use the addElement method to add an element to a form. The first few arguments are always the same. The first param is the type of the element to add. The second is the elementname to use which is normally the html name of the element in the form. The third is often the text for the label for the element.&lt;br /&gt;
&lt;br /&gt;
Some examples are below :&lt;br /&gt;
===button===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            $mform-&amp;gt;addElement(&#039;button&#039;, &#039;intro&#039;, get_string(&amp;quot;buttonlabel&amp;quot;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A button element. If you want a submit or cancel button see &#039;submit&#039; element. &lt;br /&gt;
&lt;br /&gt;
===checkbox===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;checkbox&#039;, &#039;ratingtime&#039;, get_string(&#039;ratingtime&#039;, &#039;forum&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a simple checkbox. The third param for this element is the label to display on the left side of the form. You can also supply a string as a fourth param to specify a label that will appear on the right of the element. Checkboxes and radio buttons can be grouped and have individual labels on their right.&lt;br /&gt;
&lt;br /&gt;
====advcheckbox====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;advcheckbox&#039;, &#039;ratingtime&#039;, get_string(&#039;ratingtime&#039;, &#039;forum&#039;), array(0, 1), array(&#039;group&#039; =&amp;gt; 1));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Similar to the checkbox above, but with a couple of important improvements:&lt;br /&gt;
&lt;br /&gt;
#The 4th parameter is an array of values that will be associated with the checked/unchecked state of the checkbox. With a normal checkbox you cannot choose that value, and in fact an unchecked checkbox will not even be sent with the form data.&lt;br /&gt;
#The 5th parameter is a normal $attributes array, normally used to set HTML attributes for the &amp;lt;input&amp;gt; element. However, a special value of &#039;group&#039; can be given, which will add a class name to the element, and enable its grouping for a [[Development:lib/formslib.php_add_checkbox_controller|checkbox controller]]&lt;br /&gt;
&lt;br /&gt;
===choosecoursefile===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;choosecoursefile&#039;, &#039;mediafile&#039;, get_string(&#039;mediafile&#039;, &#039;lesson&#039;), array(&#039;courseid&#039;=&amp;gt;$COURSE-&amp;gt;id));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Choose a file from the course files area. The fourth option is a list of options for the element. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array(&#039;courseid&#039;=&amp;gt;null,\\if it is null (default then use globabl $COURSE&lt;br /&gt;
 &#039;height&#039;=&amp;gt;500,\\ height of the popup window&lt;br /&gt;
 &#039;width&#039;=&amp;gt;750, \\ width of the popup window&lt;br /&gt;
&#039;options&#039;=&amp;gt;&#039;none&#039;);\\options string for the pop up window &lt;br /&gt;
                   \\eg. &#039;menubar=0,location=0,scrollbars,resizable&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===date_selector===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;date_selector&#039;, &#039;assesstimefinish&#039;, get_string(&#039;to&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a date selector. You can select a Day, Month and Year using a group of select boxes. The fourth param here is an array of options. The defaults for the options are :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;array(&#039;startyear&#039;=&amp;gt;1970, &#039;stopyear&#039;=&amp;gt;2020,&lt;br /&gt;
                    &#039;timezone&#039;=&amp;gt;99, &#039;applydst&#039;=&amp;gt;true);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can override these defaults by supplying an array as fourth param with one or more keys with a value to override the default. You can supply a fifth param of attributes here as well.&lt;br /&gt;
&lt;br /&gt;
===date_time_selector===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;date_time_selector&#039;, &#039;assesstimestart&#039;, get_string(&#039;from&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a group of select boxes to select a date (Day Month and Year) and time (Hour and Minute). When submitted, submitted data is processed and a timestamp is passed to $form-&amp;gt;get_data(); the fourth param here is an array of options. The defaults for the options are:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;array(&#039;startyear&#039;=&amp;gt;1970, &#039;stopyear&#039;=&amp;gt;2020,&lt;br /&gt;
                    &#039;timezone&#039;=&amp;gt;99, &#039;applydst&#039;=&amp;gt;true, &#039;step&#039;=&amp;gt;5);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can override these defaults by supplying an array as fourth param with one or more keys with a value to override the default. You can supply a fifth param of attributes here as well.&lt;br /&gt;
&lt;br /&gt;
===file===&lt;br /&gt;
&lt;br /&gt;
File upload input box with browse button. In the form definition type&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            $mform-&amp;gt;addElement(&#039;file&#039;, &#039;attachment&#039;, get_string(&#039;attachment&#039;, &#039;forum&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
after form submission and validation use&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            if ($data = $mform-&amp;gt;get_data()) {&lt;br /&gt;
              ...&lt;br /&gt;
              $mform-&amp;gt;save_files($destination_directory);&lt;br /&gt;
              ...&lt;br /&gt;
            }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you need advanced settings such as required file, different max upload size or name of uploaded file&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            $this-&amp;gt;set_upload_manager(new upload_manager(&#039;attachment&#039;, true, false, $COURSE, false, 0, true, true, false));&lt;br /&gt;
            $mform-&amp;gt;addElement(&#039;file&#039;, &#039;attachment&#039;, get_string(&#039;attachment&#039;, &#039;forum&#039;));&lt;br /&gt;
            $mform-&amp;gt;addRule(&#039;attachment&#039;, null, &#039;required&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            if ($data = $mform-&amp;gt;get_data()) {&lt;br /&gt;
              ...&lt;br /&gt;
              $mform-&amp;gt;save_files($destination_directory);&lt;br /&gt;
              $newfilename = $mform-&amp;gt;get_new_filename();&lt;br /&gt;
              ...&lt;br /&gt;
            }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When porting old code it is also possible to use the upload manager directly for processing of uploaded files.&lt;br /&gt;
&lt;br /&gt;
Please note that if using set_upload_manager() it must be before addElement(&#039;file&#039;,..).&lt;br /&gt;
&lt;br /&gt;
===hidden===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         $mform-&amp;gt;addElement(&#039;hidden&#039;, &#039;reply&#039;, &#039;yes&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A hidden element. Set the element name (in this case &#039;&#039;&#039;reply&#039;&#039;&#039;) to the stated value (in this case &#039;&#039;&#039;yes&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
===htmleditor &amp;amp; format===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;htmleditor&#039;, &#039;text&#039;, get_string(&#039;choicetext&#039;, &#039;choice&#039;));&lt;br /&gt;
        $mform-&amp;gt;setType(&#039;text&#039;, PARAM_RAW);&lt;br /&gt;
	$mform-&amp;gt;addRule(&#039;text&#039;, null, &#039;required&#039;, null, &#039;client&#039;);&lt;br /&gt;
&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;format&#039;, &#039;format&#039;, get_string(&#039;format&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can supply a fourth param to htmleditor of an array of options :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
array(&#039;canUseHtmlEditor&#039;=&amp;gt;&#039;detect&#039;,&#039;rows&#039;=&amp;gt;10, &#039;cols&#039;=&amp;gt;65, &lt;br /&gt;
&#039;width&#039;=&amp;gt;0,&#039;height&#039;=&amp;gt;0, &#039;course&#039;=&amp;gt;0);&lt;br /&gt;
//options same as print_textarea params&lt;br /&gt;
//use rows and cols options to control htmleditor size.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===modgrade===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;modgrade&#039;, &#039;scale&#039;, get_string(&#039;grade&#039;), false);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
This is a custom element for selecting a grade for any activity module. The fourth argument is whether to include an option for no grade which has a value 0. This select box does include scales. The default is true, include no grade option.&lt;br /&gt;
&lt;br /&gt;
A helpbutton is automatically added.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===password===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         $mform-&amp;gt;addElement(&#039;password&#039;, &#039;password&#039;, get_string(&#039;label&#039;), $attributes);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A password element. Fourth param is an array or string of attributes.&lt;br /&gt;
&lt;br /&gt;
===passwordunmask===&lt;br /&gt;
{{Moodle 1.9}}&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         $mform-&amp;gt;addElement(&#039;passwordunmask&#039;, &#039;password&#039;, get_string(&#039;label&#039;), $attributes);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A password element with option to show the password in plaintext. Fourth param is an array or string of attributes.&lt;br /&gt;
&lt;br /&gt;
===radio===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $radioarray=array();&lt;br /&gt;
        $radioarray[] = &amp;amp;MoodleQuickForm::createElement(&#039;radio&#039;, &#039;yesno&#039;, &#039;&#039;, get_string(&#039;yes&#039;), 1, $attributes);&lt;br /&gt;
        $radioarray[] = &amp;amp;MoodleQuickForm::createElement(&#039;radio&#039;, &#039;yesno&#039;, &#039;&#039;, get_string(&#039;no&#039;), 0, $attributes);&lt;br /&gt;
        $mform-&amp;gt;addGroup($radioarray, &#039;radioar&#039;, &#039;&#039;, array(&#039; &#039;), false);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Second param names the radio button and should be the same for each button in the group in order to toggle correctly. Third param would be the label for the form element but is generally ignored as this element will always be in a group which has it&#039;s own label. Fourth param is a string, a label to be displayed on the right of the element. The fifth is the value for this radio button. $attributes can be a string or an array of attributes.&lt;br /&gt;
&lt;br /&gt;
====setDefault====&lt;br /&gt;
&lt;br /&gt;
To set the default for a radio button group as above use the following :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;setDefault(&#039;yesno&#039;, 0);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This would make the default &#039;no&#039;.&lt;br /&gt;
&lt;br /&gt;
===select===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;select&#039;, &#039;type&#039;, get_string(&#039;forumtype&#039;, &#039;forum&#039;), $FORUM_TYPES, $attributes);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The fourth param for this element is an array of options for the select box. The keys are the values for the option and the value of the array is the text for the option. The fifth param $attributes is optional, see text element for description of attributes param.&lt;br /&gt;
&lt;br /&gt;
====multi-select====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $select = $mform-&amp;gt;addElement(&#039;select&#039;, &#039;colors&#039;, get_string(&#039;colors&#039;), array(&#039;red&#039;, &#039;blue&#039;, &#039;green&#039;), $attributes);&lt;br /&gt;
        $select-&amp;gt;setMultiple(true);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===selectyesno===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;selectyesno&#039;, &#039;maxbytes&#039;, get_string(&#039;maxattachmentsize&#039;, &#039;forum&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want a yes / no select box this one automatically translates itself and has value 1 for yes and 0 for no.&lt;br /&gt;
&lt;br /&gt;
===static===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
         $mform-&amp;gt;addElement(&#039;static&#039;, &#039;description&#039;, get_string(&#039;description&#039;, &#039;exercise&#039;),&lt;br /&gt;
                  get_string(&#039;descriptionofexercise&#039;, &#039;exercise&#039;, $COURSE-&amp;gt;students));&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is a static element. It should be used with care it is used to display a static piece of text with a label. The third param is the label and the fourth is the static text itself.&lt;br /&gt;
&lt;br /&gt;
===submit, reset and cancel===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        //normally you use add_action_buttons instead of this code&lt;br /&gt;
        $buttonarray=array();&lt;br /&gt;
        $buttonarray[] = &amp;amp;$mform-&amp;gt;createElement(&#039;submit&#039;, &#039;submitbutton&#039;, get_string(&#039;savechanges&#039;));&lt;br /&gt;
        $buttonarray[] = &amp;amp;$mform-&amp;gt;createElement(&#039;reset&#039;, &#039;resetbutton&#039;, get_string(&#039;revert&#039;));&lt;br /&gt;
        $buttonarray[] = &amp;amp;$mform-&amp;gt;createElement(&#039;cancel&#039;);&lt;br /&gt;
        $mform-&amp;gt;addGroup($buttonarray, &#039;buttonar&#039;, &#039;&#039;, array(&#039; &#039;), false);&lt;br /&gt;
        $mform-&amp;gt;closeHeaderBefore(&#039;buttonar&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &#039;Submit&#039; type element is a submit type form element which will submit the form. A &#039;Reset&#039; will not submit the form but will reset any changes the user has made to form contents. A &#039;Cancel&#039; element cancels form submission. You need to have a branch in your code before you check for get_data() to check if submission has been cancelled with is_cancelled(); See the example on the usage page.&lt;br /&gt;
&lt;br /&gt;
You should name your submit and reset buttons &#039;submitbutton&#039; and &#039;resetbutton&#039; or something similar (not &#039;submit&#039; and &#039;reset&#039;). This avoids problems in JavaScript of collisions between form element names and names of JavaScript methods of the form object.&lt;br /&gt;
&lt;br /&gt;
====add_action_buttons($cancel = true, $submitlabel=null);====&lt;br /&gt;
&lt;br /&gt;
You will normally use this helper function which is a method of moodleform to add all the &#039;action&#039; buttons to the end of your form. A boolean parameter allow you to specify whether to include a cancel button and specify the label for your submit button (pass the result of get_string). Default for the submit button label is get_string(&#039;savechanges&#039;).&lt;br /&gt;
&lt;br /&gt;
===text===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;text&#039;, &#039;name&#039;, get_string(&#039;forumname&#039;, &#039;forum&#039;), $attributes);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
For a simple text element. Your fourth parameter here can be a string or array of attributes for the text element. The following are equivalent :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $attributes=&#039;size=&amp;quot;20&amp;quot;&#039;;&lt;br /&gt;
        $attributes=array(&#039;size&#039;=&amp;gt;&#039;20&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Generally you are encouraged to use CSS instead of using attributes for styling.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
A format element can be used as a format select box. It will be non-selectable if you&#039;re using an html editor.&lt;br /&gt;
&lt;br /&gt;
The third param for this element is $useHtmlEditor and it defaults to null in which case an html editor is used if the browser and user profile support it.&lt;br /&gt;
&lt;br /&gt;
===textarea===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            $mform-&amp;gt;addElement(&#039;textarea&#039;, &#039;introduction&#039;, get_string(&amp;quot;introtext&amp;quot;, &amp;quot;survey&amp;quot;), &#039;wrap=&amp;quot;virtual&amp;quot; rows=&amp;quot;20&amp;quot; cols=&amp;quot;50&amp;quot;&#039;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A textarea element. If you want an htmleditor use htmleditor element. Fourth element here is a string or array of attributes.&lt;br /&gt;
&lt;br /&gt;
==addGroup==&lt;br /&gt;
&lt;br /&gt;
A &#039;group&#039; in formslib is just a group of elements that will have a label and will be included on one line. &lt;br /&gt;
&lt;br /&gt;
For example typical code to include a submit and cancel button on the same line : &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $buttonarray=array();&lt;br /&gt;
        $buttonarray[] =&amp;amp; $mform-&amp;gt;createElement(&#039;submit&#039;, &#039;submitbutton&#039;, get_string(&#039;savechanges&#039;));&lt;br /&gt;
        $buttonarray[] =&amp;amp; $mform-&amp;gt;createElement(&#039;submit&#039;, &#039;cancel&#039;, get_string(&#039;cancel&#039;));&lt;br /&gt;
        $mform-&amp;gt;addGroup($buttonarray, &#039;buttonar&#039;, &#039;&#039;, array(&#039; &#039;), false);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You use the same arguments for createElement as you do for addElement. Any label for the element in the third argument is normally ignored (but not in the case of the submit buttons above where the third argument is not for a label but is the text for the button).&lt;br /&gt;
&lt;br /&gt;
Here&#039;s an example of putting a date_selector (which is itself a group of elements) and a checkbox on the same line, note that you can disable every element in the group using the group name &#039;availablefromgroup&#039; but it doesn&#039;t disable the controlling element the &#039;availablefromenabled&#039; checkbox:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $availablefromgroup=array();&lt;br /&gt;
	$availablefromgroup[] =&amp;amp; $mform-&amp;gt;createElement(&#039;date_selector&#039;, &#039;availablefrom&#039;, &#039;&#039;);&lt;br /&gt;
	$availablefromgroup[] =&amp;amp; $mform-&amp;gt;createElement(&#039;checkbox&#039;, &#039;availablefromenabled&#039;, &#039;&#039;, get_string(&#039;enable&#039;));&lt;br /&gt;
        $mform-&amp;gt;addGroup($availablefromgroup, &#039;availablefromgroup&#039;, get_string(&#039;availablefromdate&#039;, &#039;data&#039;), &#039;&amp;amp;nbsp;&#039;, false);&lt;br /&gt;
        $mform-&amp;gt;disabledIf(&#039;availablefromgroup&#039;, &#039;availablefromenabled&#039;);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==setHelpButton==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
            $mform-&amp;gt;setHelpButton(&#039;lessondefault&#039;, array(&#039;lessondefault&#039;, get_string(&#039;lessondefault&#039;, &#039;lesson&#039;), &#039;lesson&#039;));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
First param is an elementname and the second param is an array of params that are passed to helpbutton in weblib.php. Params are :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 * @param string $page  The keyword that defines a help page&lt;br /&gt;
 * @param string $title The title of links, rollover tips, alt tags etc&lt;br /&gt;
 *           &#039;Help with&#039; (or the language equivalent) will be prefixed and &#039;...&#039; will be stripped.&lt;br /&gt;
 * @param string $module Which module is the page defined in&lt;br /&gt;
 * @param mixed $image Use a help image for the link?  (true/false/&amp;quot;both&amp;quot;)&lt;br /&gt;
 * @param boolean $linktext If true, display the title next to the help icon.&lt;br /&gt;
 * @param string $text If defined then this text is used in the page, and&lt;br /&gt;
 *           the $page variable is ignored.&lt;br /&gt;
 * @param boolean $return If true then the output is returned as a string, if false it is printed to the current page.&lt;br /&gt;
 * @param string $imagetext The full text for the helpbutton icon. If empty use default help.gif&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make sure you don&#039;t set boolean $return to false. &lt;br /&gt;
&lt;br /&gt;
You need to do use this method after addElement();&lt;br /&gt;
&lt;br /&gt;
==setDefault==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        $mform-&amp;gt;addElement(&#039;select&#039;, &#039;grade&#039;, get_string(&#039;gradeforsubmission&#039;, &#039;exercise&#039;), $grades);&lt;br /&gt;
        $mform-&amp;gt;setHelpButton(&#039;grade&#039;, array(&#039;grade&#039;, get_string(&#039;gradeforsubmission&#039;, &#039;exercise&#039;), &#039;exercise&#039;));&lt;br /&gt;
        $mform-&amp;gt;setDefault(&#039;grade&#039;, 100);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the default of the form value with setDefault($elementname, $value); where elementname is the elementname whose default you want to set and $value is the default to set. We set the defaults for the form in definition(). This default is what is used if no data is loaded into the form with set_data(); eg. on display of the form for an &#039;add&#039; rather than &#039;update&#039; function.&lt;br /&gt;
&lt;br /&gt;
==disabledIf==&lt;br /&gt;
&lt;br /&gt;
For any element or groups of element in a form you can conditionally disable the group or individual element depending on conditions.&lt;br /&gt;
&lt;br /&gt;
You can use $mform-&amp;gt;disabledIf($elementName, $dependentOn, $condition = &#039;notchecked&#039;, $value=null)&lt;br /&gt;
&lt;br /&gt;
* elementname can be a group. If you specify a group all elements in the group will be disabled (if dependentOn is in elementname group that is ignored and not disabled). These are the element names you&#039;ve used as the first argument in addElement or addGroup.&lt;br /&gt;
* dependentOn is the actual name of the element as it will appear in html. This can be different to the name used in addGroup particularly but also addElement where you&#039;re adding a complex element like a date_selector. Check the html of your page. You typically make the depedentOn a checkbox or select box.&lt;br /&gt;
* $condition will be notchecked, checked, selected, eq or if it is anything else then we test for neq.&lt;br /&gt;
* If $condition is eq or neq then we check the value of the dependentOn field and check for equality (==) or nonequality (!=) in js&lt;br /&gt;
* If $condition is checked or notchecked then we check to see if a checkbox is checked or not.&lt;br /&gt;
* If $condition is selected then we check to see if a particular option is selected from a dropdown list.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note: I am not sure this section is complete. I just found and added one missing case, but there may be others--[[User:Tim Hunt|Tim Hunt]] 06:04, 15 October 2007 (CDT)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==setType==&lt;br /&gt;
&lt;br /&gt;
PARAM_* types are used to specify how a submitted variable should be cleaned. These should be used for get parameters such as id, course etc. which are used to load a page and also with setType(); method. Every form element should have a type specified except select, radio box and checkbox elements, these elements do a good job of cleaning themselves (only specified options are allowed as user input).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Most Commonly Used PARAM_* Types===&lt;br /&gt;
&lt;br /&gt;
These are the most commonly used PARAM_* types and their proper uses. More types can be seen in moodlelib.php starting around line 100.&lt;br /&gt;
&lt;br /&gt;
* PARAM_CLEAN is deprecated and you should try to use a more specific type.&lt;br /&gt;
* PARAM_TEXT should be used for cleaning data that is expected to be plain text. It will strip all html tags. But will still let tags for multilang support through.&lt;br /&gt;
* PARAM_NOTAGS should be used for cleaning data that is expected to be plain text. It will strip *all* html type tags. It will still *not* let tags for multilang support through. This should be used for instance for email addresses where no multilang support is appropriate.&lt;br /&gt;
* PARAM_RAW means no cleaning whatsoever, it is used mostly for data from the html editor. Data from the editor is later cleaned before display using format_text() function. PARAM_RAW can also be used for data that is validated by some other way or printed by p() or s().&lt;br /&gt;
* PARAM_INT should be used for integers.&lt;br /&gt;
* PARAM_ACTION is an alias of PARAM_ALPHA and is used for hidden fields specifying form actions.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&lt;br /&gt;
* [http://midnighthax.com/quickform.php PEAR HTML QuickForm Getting Started Guide by Keith Edmunds of Midnighthax.com]&lt;br /&gt;
&lt;br /&gt;
[[Category:Formslib]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=34802</id>
		<title>Development:Events API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=34802"/>
		<updated>2008-04-14T09:18:08Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Events wishlist */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Events API is a new core system in Moodle to allow better communication between modules.  It&#039;s based on modules triggering new events with attached data, and the other modules handling those events with custom functions.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using the example of a grade being posted from a module into the [[Development:Grades|new gradebook in Moodle 1.9]], but there are obviously all kinds of events possible.&lt;br /&gt;
&lt;br /&gt;
===Triggering an event===&lt;br /&gt;
&lt;br /&gt;
Whenever a grade is created or changed by a module, it should “tell” the system about it (in addition to any local working storage it uses).   So, using the quiz as an example, we first define an object as follows:&lt;br /&gt;
&lt;br /&gt;
 $eventdata = new object();&lt;br /&gt;
 $eventdata-&amp;gt;itemid = $grade_item-&amp;gt;id;&lt;br /&gt;
 $eventdata-&amp;gt;userid = $USER-&amp;gt;id;&lt;br /&gt;
 $eventdata-&amp;gt;gradevalue = $currentvalue;&lt;br /&gt;
&lt;br /&gt;
Then we post the object as an event and forget about it:&lt;br /&gt;
&lt;br /&gt;
 events_trigger(&#039;grade_updated&#039;, $eventdata);&lt;br /&gt;
&lt;br /&gt;
===Handling an event===&lt;br /&gt;
&lt;br /&gt;
Modules can define an events.php in their db directory which defines events they want to be notified about, and describes which of their functions or class methods should be notified.   For example, an export  plugin could register something like:&lt;br /&gt;
&lt;br /&gt;
 $handlers = array (&lt;br /&gt;
     &#039;grade_updated&#039; =&amp;gt; array (&lt;br /&gt;
         &#039;handlerfile&#039;      =&amp;gt; &#039;/grade/export/banner/lib.php&#039;,&lt;br /&gt;
         &#039;handlerfunction&#039;  =&amp;gt; &#039;banner_handle_grade_test&#039;,    // argument to call_user_func(), could be an array&lt;br /&gt;
         &#039;schedule&#039;         =&amp;gt; &#039;cron&#039;&lt;br /&gt;
     ) &lt;br /&gt;
 );&lt;br /&gt;
These are parsed during install / upgrade and stored in a simple database table.&lt;br /&gt;
&lt;br /&gt;
Then, when a grade_added event happens, all the registered functions for that event will be called something like this (but with more error handling):&lt;br /&gt;
&lt;br /&gt;
          include_once($CFG-&amp;gt;dirroot.$handlers[&#039;grade_updated&#039;][&#039;file&#039;]);&lt;br /&gt;
          call_user_func($handlers[&#039;grade_updated&#039;][&#039;function&#039;], $eventdata);&lt;br /&gt;
&lt;br /&gt;
All plugins in Moodle have access to this and can this easily “hook in” to &#039;grade_updated&#039; events (and of course any other events).&lt;br /&gt;
&lt;br /&gt;
==Database structure==&lt;br /&gt;
&lt;br /&gt;
There are 3 core tables for events. Note that if a handler is queued, and yet to be processed or processing failed, then all subsequent calls on that handler must be queued.&lt;br /&gt;
&lt;br /&gt;
===events_handlers===&lt;br /&gt;
&lt;br /&gt;
This table is for storing which components requests what type of event, and the location of the responsible handlers. For example, the grade book can register &#039;grade_added&#039; event with a function add_grade() that should be called any time an &#039;grade_added&#039; event is triggered by a module.&lt;br /&gt;
&lt;br /&gt;
These entries are created by parsing events.php files in all the modules, and can be rebuilt any time (during an upgrade, say).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventname&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|name of the event, e.g. &#039;grade_updated&#039;&lt;br /&gt;
|-&lt;br /&gt;
|handlermodule&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|e.g. moodle, mod/forum, block/rss_client&lt;br /&gt;
|-&lt;br /&gt;
|handlerfile&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|path to the file of the function, eg /grade/export/lib.php&lt;br /&gt;
|-&lt;br /&gt;
|handlerfunction&lt;br /&gt;
|text&lt;br /&gt;
|serialized string or array describing function, suitable to be passed to &#039;&#039;&#039;call_user_func()&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|schedule 	&lt;br /&gt;
|varchar(255) 	&lt;br /&gt;
|&#039;cron&#039; or &#039;instant&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue===&lt;br /&gt;
&lt;br /&gt;
This table is for storing queued events. It stores only one copy of the eventdata here, and entries from this table are being references by the events_queue_handlers table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventdata 	&lt;br /&gt;
|longtext 	&lt;br /&gt;
|serialized version of the data object passed to the event handler.&lt;br /&gt;
|-&lt;br /&gt;
|stackdump&lt;br /&gt;
|text&lt;br /&gt;
|serialized debug_backtrace showing where the event was fired from&lt;br /&gt;
|-&lt;br /&gt;
|userid&lt;br /&gt;
|int(10)&lt;br /&gt;
|$USER-&amp;gt;id when the event was fired&lt;br /&gt;
|-&lt;br /&gt;
|timecreated&lt;br /&gt;
|int(10) 	&lt;br /&gt;
|time stamp of the first time this was added&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue_handlers===&lt;br /&gt;
&lt;br /&gt;
This is the list of queued handlers for processing. The event object is retrieved from the events_queue table. When no further reference is made to the events_queue table, the corresponding entry in the events_queue table should be deleted. Entry should get deleted (?) after a successful event processing by the specified handler.  The status field keeps track of failures, after it gets to a certain number (eg 10?) it should trigger an &amp;quot;event failed&amp;quot; event (that could result in admin being emailed etc, or perhaps even the originating module taking care of it or rolling something back etc).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|queuedeventid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_queues table&lt;br /&gt;
|-&lt;br /&gt;
|handlerid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_handlers table&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|-&lt;br /&gt;
|errormessage&lt;br /&gt;
|text&lt;br /&gt;
|if an error happened last time we tried to process this event, record it here.&lt;br /&gt;
|-&lt;br /&gt;
|timemodified&lt;br /&gt;
|int(10)&lt;br /&gt;
|time stamp of the last attempt to run this from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Standards for naming events==&lt;br /&gt;
&lt;br /&gt;
All event names should follow a consistent naming pattern, such as modulename_noun_verb&lt;br /&gt;
&lt;br /&gt;
==Events which exist==&lt;br /&gt;
&lt;br /&gt;
===Users===&lt;br /&gt;
* user_updated&lt;br /&gt;
* password_changed&lt;br /&gt;
&lt;br /&gt;
===Courses===&lt;br /&gt;
* course_updated&lt;br /&gt;
* course_deleted&lt;br /&gt;
* category_updated&lt;br /&gt;
* category_deleted&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
* group_deleted&lt;br /&gt;
* grouping_deleted&lt;br /&gt;
* group_user_added&lt;br /&gt;
* group_user_removed&lt;br /&gt;
&lt;br /&gt;
==Events wishlist==&lt;br /&gt;
&lt;br /&gt;
List of events which it would be nice to have.  Please add to this list if what you want is not shown here.&lt;br /&gt;
&lt;br /&gt;
* user_created (for example to handle custom emails.  this is commonly desired: e.g. send a custom email to a related person (teacher, boss, etc.) based on some institution-specific logic)&lt;br /&gt;
* user_enrolled_in_course&lt;br /&gt;
* user_unenrolled_from_course&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=69103 General Developer Forum thread for discussing this proposal]. &lt;br /&gt;
* [[:Development:Grades]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Events]]&lt;br /&gt;
[[Category:Grades]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=34527</id>
		<title>Development:Events API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=34527"/>
		<updated>2008-04-04T07:20:07Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Events wishlist */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Events API is a new core system in Moodle to allow better communication between modules.  It&#039;s based on modules triggering new events with attached data, and the other modules handling those events with custom functions.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using the example of a grade being posted from a module into the [[Development:Grades|new gradebook in Moodle 1.9]], but there are obviously all kinds of events possible.&lt;br /&gt;
&lt;br /&gt;
===Triggering an event===&lt;br /&gt;
&lt;br /&gt;
Whenever a grade is created or changed by a module, it should “tell” the system about it (in addition to any local working storage it uses).   So, using the quiz as an example, we first define an object as follows:&lt;br /&gt;
&lt;br /&gt;
 $eventdata = new object();&lt;br /&gt;
 $eventdata-&amp;gt;itemid = $grade_item-&amp;gt;id;&lt;br /&gt;
 $eventdata-&amp;gt;userid = $USER-&amp;gt;id;&lt;br /&gt;
 $eventdata-&amp;gt;gradevalue = $currentvalue;&lt;br /&gt;
&lt;br /&gt;
Then we post the object as an event and forget about it:&lt;br /&gt;
&lt;br /&gt;
 events_trigger(&#039;grade_updated&#039;, $eventdata);&lt;br /&gt;
&lt;br /&gt;
===Handling an event===&lt;br /&gt;
&lt;br /&gt;
Modules can define an events.php in their db directory which defines events they want to be notified about, and describes which of their functions or class methods should be notified.   For example, an export  plugin could register something like:&lt;br /&gt;
&lt;br /&gt;
 $handlers = array (&lt;br /&gt;
     &#039;grade_updated&#039; =&amp;gt; array (&lt;br /&gt;
         &#039;handlerfile&#039;      =&amp;gt; &#039;/grade/export/banner/lib.php&#039;,&lt;br /&gt;
         &#039;handlerfunction&#039;  =&amp;gt; &#039;banner_handle_grade_test&#039;,    // argument to call_user_func(), could be an array&lt;br /&gt;
         &#039;schedule&#039;         =&amp;gt; &#039;cron&#039;&lt;br /&gt;
     ) &lt;br /&gt;
 );&lt;br /&gt;
These are parsed during install / upgrade and stored in a simple database table.&lt;br /&gt;
&lt;br /&gt;
Then, when a grade_added event happens, all the registered functions for that event will be called something like this (but with more error handling):&lt;br /&gt;
&lt;br /&gt;
          include_once($CFG-&amp;gt;dirroot.$handlers[&#039;grade_updated&#039;][&#039;file&#039;]);&lt;br /&gt;
          call_user_func($handlers[&#039;grade_updated&#039;][&#039;function&#039;], $eventdata);&lt;br /&gt;
&lt;br /&gt;
All plugins in Moodle have access to this and can this easily “hook in” to &#039;grade_updated&#039; events (and of course any other events).&lt;br /&gt;
&lt;br /&gt;
==Database structure==&lt;br /&gt;
&lt;br /&gt;
There are 3 core tables for events. Note that if a handler is queued, and yet to be processed or processing failed, then all subsequent calls on that handler must be queued.&lt;br /&gt;
&lt;br /&gt;
===events_handlers===&lt;br /&gt;
&lt;br /&gt;
This table is for storing which components requests what type of event, and the location of the responsible handlers. For example, the grade book can register &#039;grade_added&#039; event with a function add_grade() that should be called any time an &#039;grade_added&#039; event is triggered by a module.&lt;br /&gt;
&lt;br /&gt;
These entries are created by parsing events.php files in all the modules, and can be rebuilt any time (during an upgrade, say).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventname&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|name of the event, e.g. &#039;grade_updated&#039;&lt;br /&gt;
|-&lt;br /&gt;
|handlermodule&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|e.g. moodle, mod/forum, block/rss_client&lt;br /&gt;
|-&lt;br /&gt;
|handlerfile&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|path to the file of the function, eg /grade/export/lib.php&lt;br /&gt;
|-&lt;br /&gt;
|handlerfunction&lt;br /&gt;
|text&lt;br /&gt;
|serialized string or array describing function, suitable to be passed to &#039;&#039;&#039;call_user_func()&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|schedule 	&lt;br /&gt;
|varchar(255) 	&lt;br /&gt;
|&#039;cron&#039; or &#039;instant&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue===&lt;br /&gt;
&lt;br /&gt;
This table is for storing queued events. It stores only one copy of the eventdata here, and entries from this table are being references by the events_queue_handlers table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventdata 	&lt;br /&gt;
|longtext 	&lt;br /&gt;
|serialized version of the data object passed to the event handler.&lt;br /&gt;
|-&lt;br /&gt;
|stackdump&lt;br /&gt;
|text&lt;br /&gt;
|serialized debug_backtrace showing where the event was fired from&lt;br /&gt;
|-&lt;br /&gt;
|userid&lt;br /&gt;
|int(10)&lt;br /&gt;
|$USER-&amp;gt;id when the event was fired&lt;br /&gt;
|-&lt;br /&gt;
|timecreated&lt;br /&gt;
|int(10) 	&lt;br /&gt;
|time stamp of the first time this was added&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue_handlers===&lt;br /&gt;
&lt;br /&gt;
This is the list of queued handlers for processing. The event object is retrieved from the events_queue table. When no further reference is made to the events_queue table, the corresponding entry in the events_queue table should be deleted. Entry should get deleted (?) after a successful event processing by the specified handler.  The status field keeps track of failures, after it gets to a certain number (eg 10?) it should trigger an &amp;quot;event failed&amp;quot; event (that could result in admin being emailed etc, or perhaps even the originating module taking care of it or rolling something back etc).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|queuedeventid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_queues table&lt;br /&gt;
|-&lt;br /&gt;
|handlerid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_handlers table&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|-&lt;br /&gt;
|errormessage&lt;br /&gt;
|text&lt;br /&gt;
|if an error happened last time we tried to process this event, record it here.&lt;br /&gt;
|-&lt;br /&gt;
|timemodified&lt;br /&gt;
|int(10)&lt;br /&gt;
|time stamp of the last attempt to run this from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Standards for naming events==&lt;br /&gt;
&lt;br /&gt;
All event names should follow a consistent naming pattern, such as modulename_noun_verb&lt;br /&gt;
&lt;br /&gt;
==Events which exist==&lt;br /&gt;
&lt;br /&gt;
===Users===&lt;br /&gt;
* user_updated&lt;br /&gt;
* password_changed&lt;br /&gt;
&lt;br /&gt;
===Courses===&lt;br /&gt;
* course_updated&lt;br /&gt;
* course_deleted&lt;br /&gt;
* category_updated&lt;br /&gt;
* category_deleted&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
* group_deleted&lt;br /&gt;
* grouping_deleted&lt;br /&gt;
* group_user_added&lt;br /&gt;
* group_user_removed&lt;br /&gt;
&lt;br /&gt;
==Events wishlist==&lt;br /&gt;
&lt;br /&gt;
List of events which it would be nice to have.  Please add to this list if what you want is not shown here.&lt;br /&gt;
&lt;br /&gt;
* user_created (for example to handle custom emails.  this is commonly desired: e.g. send a custom email to a related person (teacher, boss, etc.) based on some institution-specific logic)&lt;br /&gt;
* user_enrolled_in_course&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=69103 General Developer Forum thread for discussing this proposal]. &lt;br /&gt;
* [[:Development:Grades]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Events]]&lt;br /&gt;
[[Category:Grades]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=34481</id>
		<title>Development:Events API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Events_API&amp;diff=34481"/>
		<updated>2008-04-03T12:48:01Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Standards for naming events */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Events API is a new core system in Moodle to allow better communication between modules.  It&#039;s based on modules triggering new events with attached data, and the other modules handling those events with custom functions.&lt;br /&gt;
&lt;br /&gt;
==Overview==&lt;br /&gt;
&lt;br /&gt;
We&#039;ll be using the example of a grade being posted from a module into the [[Development:Grades|new gradebook in Moodle 1.9]], but there are obviously all kinds of events possible.&lt;br /&gt;
&lt;br /&gt;
===Triggering an event===&lt;br /&gt;
&lt;br /&gt;
Whenever a grade is created or changed by a module, it should “tell” the system about it (in addition to any local working storage it uses).   So, using the quiz as an example, we first define an object as follows:&lt;br /&gt;
&lt;br /&gt;
 $eventdata = new object();&lt;br /&gt;
 $eventdata-&amp;gt;itemid = $grade_item-&amp;gt;id;&lt;br /&gt;
 $eventdata-&amp;gt;userid = $USER-&amp;gt;id;&lt;br /&gt;
 $eventdata-&amp;gt;gradevalue = $currentvalue;&lt;br /&gt;
&lt;br /&gt;
Then we post the object as an event and forget about it:&lt;br /&gt;
&lt;br /&gt;
 events_trigger(&#039;grade_updated&#039;, $eventdata);&lt;br /&gt;
&lt;br /&gt;
===Handling an event===&lt;br /&gt;
&lt;br /&gt;
Modules can define an events.php in their db directory which defines events they want to be notified about, and describes which of their functions or class methods should be notified.   For example, an export  plugin could register something like:&lt;br /&gt;
&lt;br /&gt;
 $handlers = array (&lt;br /&gt;
     &#039;grade_updated&#039; =&amp;gt; array (&lt;br /&gt;
         &#039;handlerfile&#039;      =&amp;gt; &#039;/grade/export/banner/lib.php&#039;,&lt;br /&gt;
         &#039;handlerfunction&#039;  =&amp;gt; &#039;banner_handle_grade_test&#039;,    // argument to call_user_func(), could be an array&lt;br /&gt;
         &#039;schedule&#039;         =&amp;gt; &#039;cron&#039;&lt;br /&gt;
     ) &lt;br /&gt;
 );&lt;br /&gt;
These are parsed during install / upgrade and stored in a simple database table.&lt;br /&gt;
&lt;br /&gt;
Then, when a grade_added event happens, all the registered functions for that event will be called something like this (but with more error handling):&lt;br /&gt;
&lt;br /&gt;
          include_once($CFG-&amp;gt;dirroot.$handlers[&#039;grade_updated&#039;][&#039;file&#039;]);&lt;br /&gt;
          call_user_func($handlers[&#039;grade_updated&#039;][&#039;function&#039;], $eventdata);&lt;br /&gt;
&lt;br /&gt;
All plugins in Moodle have access to this and can this easily “hook in” to &#039;grade_updated&#039; events (and of course any other events).&lt;br /&gt;
&lt;br /&gt;
==Database structure==&lt;br /&gt;
&lt;br /&gt;
There are 3 core tables for events. Note that if a handler is queued, and yet to be processed or processing failed, then all subsequent calls on that handler must be queued.&lt;br /&gt;
&lt;br /&gt;
===events_handlers===&lt;br /&gt;
&lt;br /&gt;
This table is for storing which components requests what type of event, and the location of the responsible handlers. For example, the grade book can register &#039;grade_added&#039; event with a function add_grade() that should be called any time an &#039;grade_added&#039; event is triggered by a module.&lt;br /&gt;
&lt;br /&gt;
These entries are created by parsing events.php files in all the modules, and can be rebuilt any time (during an upgrade, say).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventname&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|name of the event, e.g. &#039;grade_updated&#039;&lt;br /&gt;
|-&lt;br /&gt;
|handlermodule&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|e.g. moodle, mod/forum, block/rss_client&lt;br /&gt;
|-&lt;br /&gt;
|handlerfile&lt;br /&gt;
|varchar(255)&lt;br /&gt;
|path to the file of the function, eg /grade/export/lib.php&lt;br /&gt;
|-&lt;br /&gt;
|handlerfunction&lt;br /&gt;
|text&lt;br /&gt;
|serialized string or array describing function, suitable to be passed to &#039;&#039;&#039;call_user_func()&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|schedule 	&lt;br /&gt;
|varchar(255) 	&lt;br /&gt;
|&#039;cron&#039; or &#039;instant&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue===&lt;br /&gt;
&lt;br /&gt;
This table is for storing queued events. It stores only one copy of the eventdata here, and entries from this table are being references by the events_queue_handlers table.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|eventdata 	&lt;br /&gt;
|longtext 	&lt;br /&gt;
|serialized version of the data object passed to the event handler.&lt;br /&gt;
|-&lt;br /&gt;
|stackdump&lt;br /&gt;
|text&lt;br /&gt;
|serialized debug_backtrace showing where the event was fired from&lt;br /&gt;
|-&lt;br /&gt;
|userid&lt;br /&gt;
|int(10)&lt;br /&gt;
|$USER-&amp;gt;id when the event was fired&lt;br /&gt;
|-&lt;br /&gt;
|timecreated&lt;br /&gt;
|int(10) 	&lt;br /&gt;
|time stamp of the first time this was added&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===events_queue_handlers===&lt;br /&gt;
&lt;br /&gt;
This is the list of queued handlers for processing. The event object is retrieved from the events_queue table. When no further reference is made to the events_queue table, the corresponding entry in the events_queue table should be deleted. Entry should get deleted (?) after a successful event processing by the specified handler.  The status field keeps track of failures, after it gets to a certain number (eg 10?) it should trigger an &amp;quot;event failed&amp;quot; event (that could result in admin being emailed etc, or perhaps even the originating module taking care of it or rolling something back etc).&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&#039;&#039;&#039;Field&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Type&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Info&#039;&#039;&#039;&lt;br /&gt;
|- &lt;br /&gt;
|id&lt;br /&gt;
|int(10)&lt;br /&gt;
|auto increment identifier&lt;br /&gt;
|-&lt;br /&gt;
|queuedeventid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_queues table&lt;br /&gt;
|-&lt;br /&gt;
|handlerid&lt;br /&gt;
|int(10)&lt;br /&gt;
|foreign key id corresponding to the id of the event_handlers table&lt;br /&gt;
|-&lt;br /&gt;
|status&lt;br /&gt;
|int(10)&lt;br /&gt;
|number of failed attempts to process this handler&lt;br /&gt;
|-&lt;br /&gt;
|errormessage&lt;br /&gt;
|text&lt;br /&gt;
|if an error happened last time we tried to process this event, record it here.&lt;br /&gt;
|-&lt;br /&gt;
|timemodified&lt;br /&gt;
|int(10)&lt;br /&gt;
|time stamp of the last attempt to run this from the queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Standards for naming events==&lt;br /&gt;
&lt;br /&gt;
All event names should follow a consistent naming pattern, such as modulename_noun_verb&lt;br /&gt;
&lt;br /&gt;
==Events which exist==&lt;br /&gt;
&lt;br /&gt;
===Users===&lt;br /&gt;
* user_updated&lt;br /&gt;
* password_changed&lt;br /&gt;
&lt;br /&gt;
===Courses===&lt;br /&gt;
* course_updated&lt;br /&gt;
* course_deleted&lt;br /&gt;
* category_updated&lt;br /&gt;
* category_deleted&lt;br /&gt;
&lt;br /&gt;
===Groups===&lt;br /&gt;
* group_deleted&lt;br /&gt;
* grouping_deleted&lt;br /&gt;
* group_user_added&lt;br /&gt;
* group_user_removed&lt;br /&gt;
&lt;br /&gt;
==Events wishlist==&lt;br /&gt;
&lt;br /&gt;
List of events which it would be nice to have.  Please add to this list if what you want is not shown here.&lt;br /&gt;
&lt;br /&gt;
* user_created (for example to handle custom emails.  this is commonly desired: e.g. send a custom email to a related person (teacher, boss, etc.) based on some institution-specific logic)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=69103 General Developer Forum thread for discussing this proposal]. &lt;br /&gt;
* [[:Development:Grades]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer|Events]]&lt;br /&gt;
[[Category:Grades]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:MNet&amp;diff=19984</id>
		<title>Development:MNet</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:MNet&amp;diff=19984"/>
		<updated>2007-02-06T14:24:50Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Key config variables and functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Moodle 1.8}}&lt;br /&gt;
&lt;br /&gt;
Random notes for Moodle Network. Should get these organised...&lt;br /&gt;
&lt;br /&gt;
* Documentation for administrators is here [[Moodle Network]]&lt;br /&gt;
* Some old documentation about the initial planning and dev&lt;br /&gt;
** [[Community_hub]]&lt;br /&gt;
** [[Community_hub_technotes]]&lt;br /&gt;
** [[Community_hub_progress]]&lt;br /&gt;
&lt;br /&gt;
=Key config variables and functions=&lt;br /&gt;
&lt;br /&gt;
     // what mnethostid should &amp;quot;local&amp;quot; users have?&lt;br /&gt;
     // this is guaranteed to be set, except during the 1.7-&amp;gt;1.8 upgrade&lt;br /&gt;
     $id = $CFG-&amp;gt;mnet_localhost_id; &lt;br /&gt;
     &lt;br /&gt;
     // a quick way to check if our user is local&lt;br /&gt;
     is_mnet_remote_user($user); &lt;br /&gt;
     // internally wis_mnet_remote_user() does&lt;br /&gt;
     // if ($user-&amp;gt;mnethostid == $CFG-&amp;gt;mnet_localhost_id)&lt;br /&gt;
&lt;br /&gt;
     // Are we listening to mnet requests? Nothing else works if we aren&#039;t.&lt;br /&gt;
     if ($CFG-&amp;gt;mnet_dispatcher_mode === &#039;strict&#039;) {&lt;br /&gt;
         // Moodle is listening to mnet requests. Nothing else works if we aren&#039;t.&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     // Are we allowing remote users in via auth/mnet?&lt;br /&gt;
     if (is_enabled_auth(&#039;mnet&#039;)) {&lt;br /&gt;
          // yes indeed&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
     // Will auth/mnet autocreate new user accts?&lt;br /&gt;
     if (get_config(&#039;auth/mnet&#039;, &#039;auto_add_remote_users&#039;)) {&lt;br /&gt;
         // yes it will!&lt;br /&gt;
     }&lt;br /&gt;
&lt;br /&gt;
=Protocols=&lt;br /&gt;
&lt;br /&gt;
==MNET handshake==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Authentication/SSO==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Enrolment==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=To Do=&lt;br /&gt;
&lt;br /&gt;
Some immediate items that would add polish without major surgery&lt;br /&gt;
&lt;br /&gt;
* Exchange more enrolment info at log-entry exchange time on cron&lt;br /&gt;
* Special default role&lt;br /&gt;
** Add a new &amp;quot;remote student&amp;quot; role&lt;br /&gt;
** Add a config var to enrol/mnet: &amp;quot;defaultremoterole&amp;quot; to use &amp;quot;remote student&amp;quot;&lt;br /&gt;
** Add a config var to the courses table to optionally override defaultremoterole&lt;br /&gt;
* Nicer CSS in the &amp;quot;my courses&amp;quot; listing in moodle homepage for remote hosts and remote courses. See course/lib.php print_remote_course() and print_remote_host().&lt;br /&gt;
&lt;br /&gt;
=Roadmap=&lt;br /&gt;
&lt;br /&gt;
A bit more work, and a whole lot more features. From easy to hard...&lt;br /&gt;
&lt;br /&gt;
* Better per-host stats and log views for administrators. This is relatively easy using data we already have.&lt;br /&gt;
* In mod/forum craft a special URL for remote users so that the post URL is in the wantsurl parameter, so they can bounce-off their IDP in one go. &lt;br /&gt;
** According to Jonathan Harker, this requires that we modify jump to accept the remote wwwroot as a parameter. Also: will this be safe enough?&lt;br /&gt;
* Display aggregated calendar on the IDP&lt;br /&gt;
* Exchange grades. Needs a bit of design.&lt;br /&gt;
* Build a SCORM/IMSCP/MoodleZip repository scheme.&lt;br /&gt;
** MartinL has some ideas on how to get this done in easy and super-scalable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=19889</id>
		<title>Development:Web services API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=19889"/>
		<updated>2007-02-02T11:45:14Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Please also see the discussion about a simple to use xml-rpc based api at [[Development:Simple web services|simple web services]].&lt;br /&gt;
&lt;br /&gt;
Provide Moodle with a web service interface to allow exchange of data and information with other systems.&lt;br /&gt;
&lt;br /&gt;
Specifically,&lt;br /&gt;
# Manage user data - send and retrieve the information,&lt;br /&gt;
# Manage course enrolments - add/remove teachers and students,&lt;br /&gt;
# Course management - create new courses based on templates,&lt;br /&gt;
# Gradebook info - extract grades information from Moodle.&lt;br /&gt;
&lt;br /&gt;
The API will be built in two tiers:&lt;br /&gt;
# Generic Moodle web services - This will define the API available to be used by specific protocols.&lt;br /&gt;
# Protocol-specific web services - Using the generic services as the parent, define specific interfaces for SOAP, XML-RPC and others.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Class Structure:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Base class &amp;lt;code&amp;gt;server.class.php&amp;lt;/code&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
:This class provides most of the necessary functions to authenticate and communicate with Moodle. It also defines the methods that must be implemented by the protocol class. Any web service protocol class must:&lt;br /&gt;
:* call the base class constructor (&amp;lt;code&amp;gt;parent::init()&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the main method (&amp;lt;code&amp;gt;main([$httpdata])&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the request method (&amp;lt;code&amp;gt;request($input)&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the reply method (&amp;lt;code&amp;gt;response($request)&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Derived class (e.g. &amp;lt;code&amp;gt;soapserver.class.php&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The driver for the whole operation is through &amp;lt;code&amp;gt;service.php&amp;lt;/code&amp;gt;. It takes one argument, &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt;, which contains a string identifying the protocol to use (e.g. &#039;soap&#039;).&lt;br /&gt;
&lt;br /&gt;
So, to call a SOAP based web service:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;http://your.server.org/moodle/ws/server.php?type=soap&amp;lt;/code&amp;gt;&lt;br /&gt;
The data for the entire operation comes through the POST mechanism.&lt;br /&gt;
&lt;br /&gt;
== Manage User Data ==&lt;br /&gt;
These functions will allow the exchange of user data, and account management functions. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Course Enrolments ==&lt;br /&gt;
These functions will allow for student, teacher and group management functions within a course. Initial work will use the [http://moodle.cvs.sourceforge.net/*checkout*/moodle/moodle/lang/en_utf8/help/enrol/imsenterprise/formatoverview.html IMS Enterprise XML] standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Courses ==&lt;br /&gt;
These functions will allow for definition and management of courses. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Grades ==&lt;br /&gt;
These functions will allow for information about grades to be exchanged. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
The code is available in the contrib/patches/ws directory of cvs.&lt;br /&gt;
 cvs -z3 -d:pserver:anonymous@moodle.cvs.sourceforge.net:/cvsroot/moodle co contrib/patches/ws&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=44079 Web Services in forthcoming Moodle] and [http://moodle.org/mod/forum/discuss.php?d=51752 Proposal: Web Services / API / Refactoring Opportunity] forum discussions&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Administrator]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=19888</id>
		<title>Development:Web services API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=19888"/>
		<updated>2007-02-02T11:44:46Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Please also see the discussion about a simple to use xml-rpc based api at [[Development:Simple web services|simple web services]].&lt;br /&gt;
&lt;br /&gt;
Provide Moodle with a web service interface to allow exchange of data and information with other systems.&lt;br /&gt;
&lt;br /&gt;
Specifically,&lt;br /&gt;
# Manage user data - send and retrieve the information,&lt;br /&gt;
# Manage course enrolments - add/remove teachers and students,&lt;br /&gt;
# Course management - create new courses based on templates,&lt;br /&gt;
# Gradebook info - extract grades information from Moodle.&lt;br /&gt;
&lt;br /&gt;
The API will be built in two tiers:&lt;br /&gt;
# Generic Moodle web services - This will define the API available to be used by specific protocols.&lt;br /&gt;
# Protocol-specific web services - Using the generic services as the parent, define specific interfaces for SOAP, XML-RPC and others.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Class Structure:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Base class &amp;lt;code&amp;gt;server.class.php&amp;lt;/code&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
:This class provides most of the necessary functions to authenticate and communicate with Moodle. It also defines the methods that must be implemented by the protocol class. Any web service protocol class must:&lt;br /&gt;
:* call the base class constructor (&amp;lt;code&amp;gt;parent::init()&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the main method (&amp;lt;code&amp;gt;main([$httpdata])&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the request method (&amp;lt;code&amp;gt;request($input)&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the reply method (&amp;lt;code&amp;gt;response($request)&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Derived class (e.g. &amp;lt;code&amp;gt;soapserver.class.php&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The driver for the whole operation is through &amp;lt;code&amp;gt;service.php&amp;lt;/code&amp;gt;. It takes one argument, &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt;, which contains a string identifying the protocol to use (e.g. &#039;soap&#039;).&lt;br /&gt;
&lt;br /&gt;
So, to call a SOAP based web service:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;http://your.server.org/moodle/ws/server.php?type=soap&amp;lt;/code&amp;gt;&lt;br /&gt;
The data for the entire operation comes through the POST mechanism.&lt;br /&gt;
&lt;br /&gt;
== Manage User Data ==&lt;br /&gt;
These functions will allow the exchange of user data, and account management functions. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Course Enrolments ==&lt;br /&gt;
These functions will allow for student, teacher and group management functions within a course. Initial work will use the [http://moodle.cvs.sourceforge.net/*checkout*/moodle/moodle/lang/en_utf8/help/enrol/imsenterprise/formatoverview.html IMS Enterprise XML] standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Courses ==&lt;br /&gt;
These functions will allow for definition and management of courses. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Grades ==&lt;br /&gt;
These functions will allow for information about grades to be exchanged. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
The code is available in the contrib/patches/ws directory of cvs.&lt;br /&gt;
 cvs -z3 -d:pserver:anonymous@moodle.cvs.sourceforge.net:/cvsroot/moodle/contrib/patches/ws co contrib/patches/ws&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=44079 Web Services in forthcoming Moodle] and [http://moodle.org/mod/forum/discuss.php?d=51752 Proposal: Web Services / API / Refactoring Opportunity] forum discussions&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Administrator]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=19882</id>
		<title>Development:Web services API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=19882"/>
		<updated>2007-02-02T11:27:06Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Please also see the discussion about a simple to use xml-rpc based api at [[Development:Simple web services|simple web services]].&lt;br /&gt;
&lt;br /&gt;
Provide Moodle with a web service interface to allow exchange of data and information with other systems.&lt;br /&gt;
&lt;br /&gt;
Specifically,&lt;br /&gt;
# Manage user data - send and retrieve the information,&lt;br /&gt;
# Manage course enrolments - add/remove teachers and students,&lt;br /&gt;
# Course management - create new courses based on templates,&lt;br /&gt;
# Gradebook info - extract grades information from Moodle.&lt;br /&gt;
&lt;br /&gt;
The API will be built in two tiers:&lt;br /&gt;
# Generic Moodle web services - This will define the API available to be used by specific protocols.&lt;br /&gt;
# Protocol-specific web services - Using the generic services as the parent, define specific interfaces for SOAP, XML-RPC and others.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Class Structure:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Base class &amp;lt;code&amp;gt;server.class.php&amp;lt;/code&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
:This class provides most of the necessary functions to authenticate and communicate with Moodle. It also defines the methods that must be implemented by the protocol class. Any web service protocol class must:&lt;br /&gt;
:* call the base class constructor (&amp;lt;code&amp;gt;parent::init()&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the main method (&amp;lt;code&amp;gt;main([$httpdata])&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the request method (&amp;lt;code&amp;gt;request($input)&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the reply method (&amp;lt;code&amp;gt;response($request)&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Derived class (e.g. &amp;lt;code&amp;gt;soapserver.class.php&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The driver for the whole operation is through &amp;lt;code&amp;gt;service.php&amp;lt;/code&amp;gt;. It takes one argument, &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt;, which contains a string identifying the protocol to use (e.g. &#039;soap&#039;).&lt;br /&gt;
&lt;br /&gt;
So, to call a SOAP based web service:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;http://your.server.org/moodle/ws/server.php?type=soap&amp;lt;/code&amp;gt;&lt;br /&gt;
The data for the entire operation comes through the POST mechanism.&lt;br /&gt;
&lt;br /&gt;
== Manage User Data ==&lt;br /&gt;
These functions will allow the exchange of user data, and account management functions. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Course Enrolments ==&lt;br /&gt;
These functions will allow for student, teacher and group management functions within a course. Initial work will use the [http://moodle.cvs.sourceforge.net/*checkout*/moodle/moodle/lang/en_utf8/help/enrol/imsenterprise/formatoverview.html IMS Enterprise XML] standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Courses ==&lt;br /&gt;
These functions will allow for definition and management of courses. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Grades ==&lt;br /&gt;
These functions will allow for information about grades to be exchanged. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
The code is available in the contrib/patches/ws directory of cvs.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=44079 Web Services in forthcoming Moodle] and [http://moodle.org/mod/forum/discuss.php?d=51752 Proposal: Web Services / API / Refactoring Opportunity] forum discussions&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Administrator]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=18041</id>
		<title>Development:Web services API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=18041"/>
		<updated>2006-11-15T15:16:55Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Please also see the discussion about a simple to use xml-rpc based api at [[Development:Simple web services|simple web services]].&lt;br /&gt;
&lt;br /&gt;
Provide Moodle with a web service interface to allow exchange of data and information with other systems.&lt;br /&gt;
&lt;br /&gt;
Specifically,&lt;br /&gt;
# Manage user data - send and retrieve the information,&lt;br /&gt;
# Manage course enrolments - add/remove teachers and students,&lt;br /&gt;
# Course management - create new courses based on templates,&lt;br /&gt;
# Gradebook info - extract grades information from Moodle.&lt;br /&gt;
&lt;br /&gt;
The API will be built in two tiers:&lt;br /&gt;
# Generic Moodle web services - This will define the API available to be used by specific protocols.&lt;br /&gt;
# Protocol-specific web services - Using the generic services as the parent, define specific interfaces for SOAP, XML-RPC and others.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Class Structure:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Base class &amp;lt;code&amp;gt;server.class.php&amp;lt;/code&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
:This class provides most of the necessary functions to authenticate and communicate with Moodle. It also defines the methods that must be implemented by the protocol class. Any web service protocol class must:&lt;br /&gt;
:* call the base class constructor (&amp;lt;code&amp;gt;parent::init()&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the main method (&amp;lt;code&amp;gt;main([$httpdata])&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the request method (&amp;lt;code&amp;gt;request($input)&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the reply method (&amp;lt;code&amp;gt;response($request)&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Derived class (e.g. &amp;lt;code&amp;gt;soapserver.class.php&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The driver for the whole operation is through &amp;lt;code&amp;gt;service.php&amp;lt;/code&amp;gt;. It takes one argument, &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt;, which contains a string identifying the protocol to use (e.g. &#039;soap&#039;).&lt;br /&gt;
&lt;br /&gt;
So, to call a SOAP based web service:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;http://your.server.org/moodle/ws/server.php?type=soap&amp;lt;/code&amp;gt;&lt;br /&gt;
The data for the entire operation comes through the POST mechanism.&lt;br /&gt;
&lt;br /&gt;
== Manage User Data ==&lt;br /&gt;
These functions will allow the exchange of user data, and account management functions. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Course Enrolments ==&lt;br /&gt;
These functions will allow for student, teacher and group management functions within a course. Initial work will use the [http://moodle.cvs.sourceforge.net/*checkout*/moodle/moodle/lang/en_utf8/help/enrol/imsenterprise/formatoverview.html IMS Enterprise XML] standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Courses ==&lt;br /&gt;
These functions will allow for definition and management of courses. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Grades ==&lt;br /&gt;
These functions will allow for information about grades to be exchanged. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
The code is available in the contrib/ws directory of cvs.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=44079 Web Services in forthcoming Moodle] and [http://moodle.org/mod/forum/discuss.php?d=51752 Proposal: Web Services / API / Refactoring Opportunity] forum discussions&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Administrator]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=18040</id>
		<title>Development:Web services API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=18040"/>
		<updated>2006-11-15T15:15:59Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Please also see the discussion about a simple to use xml-rpc based api at [[Development:Simple web services|simple web services]].&lt;br /&gt;
&lt;br /&gt;
Provide Moodle with a web service interface to allow exchange of data and information with other systems.&lt;br /&gt;
&lt;br /&gt;
Specifically,&lt;br /&gt;
# Manage user data - send and retrieve the information,&lt;br /&gt;
# Manage course enrolments - add/remove teachers and students,&lt;br /&gt;
# Course management - create new courses based on templates,&lt;br /&gt;
# Gradebook info - extract grades information from Moodle.&lt;br /&gt;
&lt;br /&gt;
The API will be built in two tiers:&lt;br /&gt;
# Generic Moodle web services - This will define the API available to be used by specific protocols.&lt;br /&gt;
# Protocol-specific web services - Using the generic services as the parent, define specific interfaces for SOAP, XML-RPC and others.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Class Structure:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Base class &amp;lt;code&amp;gt;server.class.php&amp;lt;/code&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
:This class provides most of the necessary functions to authenticate and communicate with Moodle. It also defines the methods that must be implemented by the protocol class. Any web service protocol class must:&lt;br /&gt;
:* call the base class constructor (&amp;lt;code&amp;gt;parent::init()&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the main method (&amp;lt;code&amp;gt;main([$httpdata])&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the request method (&amp;lt;code&amp;gt;request($input)&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the reply method (&amp;lt;code&amp;gt;response($request)&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Derived class (e.g. &amp;lt;code&amp;gt;soapserver.class.php&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The driver for the whole operation is through &amp;lt;code&amp;gt;service.php&amp;lt;/code&amp;gt;. It takes one argument, &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt;, which contains a string identifying the protocol to use (e.g. &#039;soap&#039;).&lt;br /&gt;
&lt;br /&gt;
So, to call a SOAP based web service:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;http://your.server.org/moodle/ws/server.php?type=soap&amp;lt;/code&amp;gt;&lt;br /&gt;
The data for the entire operation comes through the POST mechanism.&lt;br /&gt;
&lt;br /&gt;
== Manage User Data ==&lt;br /&gt;
These functions will allow the exchange of user data, and account management functions. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Course Enrolments ==&lt;br /&gt;
These functions will allow for student, teacher and group management functions within a course. Initial work will use the [http://moodle.cvs.sourceforge.net/*checkout*/moodle/moodle/lang/en_utf8/help/enrol/imsenterprise/formatoverview.html IMS Enterprise XML] standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Courses ==&lt;br /&gt;
These functions will allow for definition and management of courses. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Grades ==&lt;br /&gt;
These functions will allow for information about grades to be exchanged. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=44079 Web Services in forthcoming Moodle] and [http://moodle.org/mod/forum/discuss.php?d=51752 Proposal: Web Services / API / Refactoring Opportunity] forum discussions&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Administrator]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=18039</id>
		<title>Development:Web services API</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Web_services_API&amp;diff=18039"/>
		<updated>2006-11-15T15:14:17Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
Provide Moodle with a web service interface to allow exchange of data and information with other systems.&lt;br /&gt;
&lt;br /&gt;
The code is available in the contrib/ws directory of cvs.&lt;br /&gt;
Please also see the discussion about a simple to use xml-rpc based api at [[Development:Simple web services|simple web services]].&lt;br /&gt;
&lt;br /&gt;
Specifically,&lt;br /&gt;
# Manage user data - send and retrieve the information,&lt;br /&gt;
# Manage course enrolments - add/remove teachers and students,&lt;br /&gt;
# Course management - create new courses based on templates,&lt;br /&gt;
# Gradebook info - extract grades information from Moodle.&lt;br /&gt;
&lt;br /&gt;
The API will be built in two tiers:&lt;br /&gt;
# Generic Moodle web services - This will define the API available to be used by specific protocols.&lt;br /&gt;
# Protocol-specific web services - Using the generic services as the parent, define specific interfaces for SOAP, XML-RPC and others.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Class Structure:&#039;&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
Base class &amp;lt;code&amp;gt;server.class.php&amp;lt;/code&amp;gt;:&amp;lt;br&amp;gt;&lt;br /&gt;
:This class provides most of the necessary functions to authenticate and communicate with Moodle. It also defines the methods that must be implemented by the protocol class. Any web service protocol class must:&lt;br /&gt;
:* call the base class constructor (&amp;lt;code&amp;gt;parent::init()&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the main method (&amp;lt;code&amp;gt;main([$httpdata])&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the request method (&amp;lt;code&amp;gt;request($input)&amp;lt;/code&amp;gt;),&lt;br /&gt;
:* implement the reply method (&amp;lt;code&amp;gt;response($request)&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
Derived class (e.g. &amp;lt;code&amp;gt;soapserver.class.php&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The driver for the whole operation is through &amp;lt;code&amp;gt;service.php&amp;lt;/code&amp;gt;. It takes one argument, &amp;lt;code&amp;gt;type&amp;lt;/code&amp;gt;, which contains a string identifying the protocol to use (e.g. &#039;soap&#039;).&lt;br /&gt;
&lt;br /&gt;
So, to call a SOAP based web service:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;http://your.server.org/moodle/ws/server.php?type=soap&amp;lt;/code&amp;gt;&lt;br /&gt;
The data for the entire operation comes through the POST mechanism.&lt;br /&gt;
&lt;br /&gt;
== Manage User Data ==&lt;br /&gt;
These functions will allow the exchange of user data, and account management functions. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Course Enrolments ==&lt;br /&gt;
These functions will allow for student, teacher and group management functions within a course. Initial work will use the [http://moodle.cvs.sourceforge.net/*checkout*/moodle/moodle/lang/en_utf8/help/enrol/imsenterprise/formatoverview.html IMS Enterprise XML] standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Courses ==&lt;br /&gt;
These functions will allow for definition and management of courses. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
== Manage Grades ==&lt;br /&gt;
These functions will allow for information about grades to be exchanged. Initial work will use the IMS Enterprise XML standard for data definition.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=44079 Web Services in forthcoming Moodle] and [http://moodle.org/mod/forum/discuss.php?d=51752 Proposal: Web Services / API / Refactoring Opportunity] forum discussions&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Administrator]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Enrolment_plugins&amp;diff=15789</id>
		<title>Development:Enrolment plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Enrolment_plugins&amp;diff=15789"/>
		<updated>2006-09-12T16:55:47Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Testing paypal using the paypal developer sandbox  (for moodle 1.6) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
==Testing paypal using the paypal developer sandbox==&lt;br /&gt;
(for moodle 1.4 - 1.6)&lt;br /&gt;
If you follow these steps, you can test paypal payments using the paypal developer sandbox instead of the real paypal site.  No money is actually charged to any account.  All other actions are the same as if you were using the real paypal site.&lt;br /&gt;
* create a paypal developer account at https://developer.paypal.com/cgi-bin/devscr?cmd=_home&lt;br /&gt;
* change the address being used to send data to paypal to use the sandbox. in enrol/paypal/enrol.html:&lt;br /&gt;
** change the form post action to be https://www.sandbox.paypal.com/cgi-bin/webscr instead of https://www.paypal.com/cgi-bin/webscr&lt;br /&gt;
* change the address that is used to check the acknowledgment from paypal.  in enrol/paypal/ipn.php, change:&lt;br /&gt;
** $fp = fsockopen (&#039;www.paypal.com&#039;, 80, $errno, $errstr, 30);&lt;br /&gt;
* to&lt;br /&gt;
** $fp = fsockopen (&#039;www.sandbox.paypal.com&#039;, 80, $errno, $errstr, 30);&lt;br /&gt;
* create a couple of user accounts in the paypal sandbox and test enrolling in a course that requires payment (note that you need to be logged into the paypal sandbox while doing this testing)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Enrolment plugins|Enrolment plugins (administrator)]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?id=2981 Enrolment Plugins] forum&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Enrolment]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Enrolment_plugins&amp;diff=15784</id>
		<title>Development:Enrolment plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Enrolment_plugins&amp;diff=15784"/>
		<updated>2006-09-12T15:21:21Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Testing paypal using the paypal developer sandbox  (for moodle 1.6) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
==Testing paypal using the paypal developer sandbox  (for moodle 1.6)==&lt;br /&gt;
&lt;br /&gt;
If you follow these steps, you can test paypal payments using the paypal developer sandbox instead of the real paypal site.  No money is actually charged to any account.  All other actions are the same as if you were using the real paypal site.&lt;br /&gt;
* create a paypal developer account at https://developer.paypal.com/cgi-bin/devscr?cmd=_home&lt;br /&gt;
* change the address being used to send data to paypal to use the sandbox. in enrol/paypal/enrol.html:&lt;br /&gt;
** change the form post action to be https://www.sandbox.paypal.com/cgi-bin/webscr instead of https://www.paypal.com/cgi-bin/webscr&lt;br /&gt;
* change the address that is used to check the acknowledgment from paypal.  in enrol/paypal/ipn.php, change:&lt;br /&gt;
** $fp = fsockopen (&#039;www.paypal.com&#039;, 80, $errno, $errstr, 30);&lt;br /&gt;
* to&lt;br /&gt;
** $fp = fsockopen (&#039;www.sandbox.paypal.com&#039;, 80, $errno, $errstr, 30);&lt;br /&gt;
* create a couple of user accounts in the paypal sandbox and test enrolling in a course that requires payment (note that you need to be logged into the paypal sandbox while doing this testing)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Enrolment plugins|Enrolment plugins (administrator)]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?id=2981 Enrolment Plugins] forum&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Enrolment]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Enrolment_plugins&amp;diff=15783</id>
		<title>Development:Enrolment plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Enrolment_plugins&amp;diff=15783"/>
		<updated>2006-09-12T14:46:37Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Testing paypal using the paypal developer sandbox  (for moodle 1.6) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
==Testing paypal using the paypal developer sandbox  (for moodle 1.6)==&lt;br /&gt;
* create a paypal developer account at https://developer.paypal.com/cgi-bin/devscr?cmd=_home&lt;br /&gt;
* change the address being used to send data to paypal to use the sandbox. in enrol/paypal/enrol.html:&lt;br /&gt;
** change the form post action to be https://www.sandbox.paypal.com/cgi-bin/webscr instead of https://www.paypal.com/cgi-bin/webscr&lt;br /&gt;
* change the address that is used to check the acknowledgment from paypal.  in enrol/paypal/ipn.php, change:&lt;br /&gt;
** $fp = fsockopen (&#039;www.paypal.com&#039;, 80, $errno, $errstr, 30);&lt;br /&gt;
* to&lt;br /&gt;
** $fp = fsockopen (&#039;www.sandbox.paypal.com&#039;, 80, $errno, $errstr, 30);&lt;br /&gt;
* create a couple of user accounts in the paypal sandbox and test enrolling in a course that requires payment (note that you need to be logged into the paypal sandbox while doing this testing)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Enrolment plugins|Enrolment plugins (administrator)]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?id=2981 Enrolment Plugins] forum&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Enrolment]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Enrolment_plugins&amp;diff=15782</id>
		<title>Development:Enrolment plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Enrolment_plugins&amp;diff=15782"/>
		<updated>2006-09-12T14:46:18Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Testing paypal using the paypal developer sandbox  (for moodle 1.6) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
==Testing paypal using the paypal developer sandbox  (for moodle 1.6)==&lt;br /&gt;
* create a paypal developer account at https://developer.paypal.com/cgi-bin/devscr?cmd=_home&lt;br /&gt;
* change the address being used to send data to paypal to use the sandbox. in enrol/paypal/enrol.html:&lt;br /&gt;
* * change the form post action to be https://www.sandbox.paypal.com/cgi-bin/webscr instead of https://www.paypal.com/cgi-bin/webscr&lt;br /&gt;
* change the address that is used to check the acknowledgment from paypal.  in enrol/paypal/ipn.php, change:&lt;br /&gt;
** $fp = fsockopen (&#039;www.paypal.com&#039;, 80, $errno, $errstr, 30);&lt;br /&gt;
* to&lt;br /&gt;
** $fp = fsockopen (&#039;www.sandbox.paypal.com&#039;, 80, $errno, $errstr, 30);&lt;br /&gt;
* create a couple of user accounts in the paypal sandbox and test enrolling in a course that requires payment (note that you need to be logged into the paypal sandbox while doing this testing)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Enrolment plugins|Enrolment plugins (administrator)]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?id=2981 Enrolment Plugins] forum&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Enrolment]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Development:Enrolment_plugins&amp;diff=15781</id>
		<title>Development:Enrolment plugins</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Development:Enrolment_plugins&amp;diff=15781"/>
		<updated>2006-09-12T14:45:53Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* See also */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{stub}}&lt;br /&gt;
==Testing paypal using the paypal developer sandbox  (for moodle 1.6)==&lt;br /&gt;
* create a paypal developer account at https://developer.paypal.com/cgi-bin/devscr?cmd=_home&lt;br /&gt;
* change the address being used to send data to paypal to use the sandbox. in enrol/paypal/enrol.html:&lt;br /&gt;
* * change the form post action to be https://www.sandbox.paypal.com/cgi-bin/webscr instead of https://www.paypal.com/cgi-bin/webscr&lt;br /&gt;
* change the address that is used to check the acknowledgment from paypal.  in enrol/paypal/ipn.php, change:&lt;br /&gt;
** $fp = fsockopen (&#039;www.paypal.com&#039;, 80, $errno, $errstr, 30);&lt;br /&gt;
to&lt;br /&gt;
** $fp = fsockopen (&#039;www.sandbox.paypal.com&#039;, 80, $errno, $errstr, 30);&lt;br /&gt;
* create a couple of user accounts in the paypal sandbox and test enrolling in a course that requires payment (note that you need to be logged into the paypal sandbox while doing this testing)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[[Enrolment plugins|Enrolment plugins (administrator)]]&lt;br /&gt;
*Using Moodle [http://moodle.org/mod/forum/view.php?id=2981 Enrolment Plugins] forum&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Enrolment]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8191</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8191"/>
		<updated>2006-04-07T15:19:37Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Drag and Drop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tutorial: A simple example&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).  To do so, I will use a background image with these words, and&lt;br /&gt;
images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
 &lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
Then I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
 (Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
 Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
 are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
 pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
 for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
 in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
Initially, the images are underneath the background image:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
 &lt;br /&gt;
I drag and drop the images to where they should be:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
 &lt;br /&gt;
When added to a quiz, the question looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8190</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8190"/>
		<updated>2006-04-07T15:19:08Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Drag and Drop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tutorial: A simple example&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).  To do so, I will use a background image with these words, and&lt;br /&gt;
images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
 &lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
:hen I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
 (Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
 Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
 are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
 pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
 for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
 in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
Initially, the images are underneath the background image:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
 &lt;br /&gt;
I drag and drop the images to where they should be:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
 &lt;br /&gt;
When added to a quiz, the question looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8189</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8189"/>
		<updated>2006-04-07T15:18:28Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Drag and Drop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Tutorial: A simple example&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).  To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
 &lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
:hen I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
 (Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
 Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
 are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
 pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
 for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
 in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
Initially, the images are underneath the background image:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
 &lt;br /&gt;
I drag and drop the images to where they should be:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
 &lt;br /&gt;
When added to a quiz, the question looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8188</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8188"/>
		<updated>2006-04-07T15:17:43Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Tutorial: A simple example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
==== Tutorial: A simple example ====&lt;br /&gt;
&lt;br /&gt;
I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).  To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
 &lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
:hen I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
 (Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
 Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
 are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
 pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
 for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
 in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
Initially, the images are underneath the background image:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
 &lt;br /&gt;
I drag and drop the images to where they should be:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
 &lt;br /&gt;
When added to a quiz, the question looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8187</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8187"/>
		<updated>2006-04-07T15:17:16Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Tutorial: A simple example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
=== Tutorial: A simple example ===&lt;br /&gt;
&lt;br /&gt;
I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).  To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
 &lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
:hen I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
 (Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
 Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
 are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
 pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
 for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
 in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
Initially, the images are underneath the background image:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
 &lt;br /&gt;
I drag and drop the images to where they should be:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
 &lt;br /&gt;
When added to a quiz, the question looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8186</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8186"/>
		<updated>2006-04-07T15:13:14Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Tutorial: A simple example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
== Tutorial: A simple example ==&lt;br /&gt;
&lt;br /&gt;
:I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).  To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
 &lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
:Then I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
 (Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
 Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
 are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
 pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
 for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
 in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
:Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
:Initially, the images are underneath the background image &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
 &lt;br /&gt;
:I drag and drop the images to where they should be &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
 &lt;br /&gt;
:Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
 &lt;br /&gt;
:Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
 &lt;br /&gt;
:When added to a quiz, the question looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8185</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8185"/>
		<updated>2006-04-07T15:12:39Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Tutorial: A simple example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
== Tutorial: A simple example ==&lt;br /&gt;
&lt;br /&gt;
:I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).&lt;br /&gt;
 &lt;br /&gt;
:To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
 &lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
:Then I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
 (Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
 Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
 are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
 pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
 for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
 in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
:Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
:Initially, the images are underneath the background image &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
 &lt;br /&gt;
:I drag and drop the images to where they should be &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
:Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
:I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
 &lt;br /&gt;
:Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
 &lt;br /&gt;
:Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
 &lt;br /&gt;
:When added to a quiz, the question looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8184</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8184"/>
		<updated>2006-04-07T15:10:35Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Tutorial: A simple example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
== Tutorial: A simple example ==&lt;br /&gt;
&lt;br /&gt;
I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).&lt;br /&gt;
 &lt;br /&gt;
To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
 &lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
Then I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
 (Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
 Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
 are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
 pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
 for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
 in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
Initially, the images are underneath the background image &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
 &lt;br /&gt;
I drag and drop the images to where they should be &lt;br /&gt;
[[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
 &lt;br /&gt;
When added to a quiz, the question looks like this:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8183</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8183"/>
		<updated>2006-04-07T15:08:38Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Tutorial: A simple example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
== Tutorial: A simple example ==&lt;br /&gt;
&lt;br /&gt;
I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).&lt;br /&gt;
 &lt;br /&gt;
To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
 &lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
Then I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
 (Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
 Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
 are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
 pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
 for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
 in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
Initially, the images are underneath the background image &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
 &lt;br /&gt;
I drag and drop the images to where they should be &lt;br /&gt;
[[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
 &lt;br /&gt;
Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
 &lt;br /&gt;
When added to a quiz, the question looks like this:&lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8182</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8182"/>
		<updated>2006-04-07T15:07:03Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Drag and Drop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
== Tutorial: A simple example ==&lt;br /&gt;
&lt;br /&gt;
 I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).&lt;br /&gt;
&lt;br /&gt;
 To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
 &lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
 Then I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
 (Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
 Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
 Initially, the images are underneath the background image &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
 &lt;br /&gt;
 I drag and drop the images to where they should be &lt;br /&gt;
[[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
 Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
 I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
 &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
 &lt;br /&gt;
 Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
 &lt;br /&gt;
 Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
 &lt;br /&gt;
 When added to a quiz, the question looks like this:&lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8181</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8181"/>
		<updated>2006-04-07T15:01:07Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Drag and Drop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
A simple example&lt;br /&gt;
&lt;br /&gt;
I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).&lt;br /&gt;
&lt;br /&gt;
To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
[[Image:Words.jpg]]&lt;br /&gt;
[[Image:Frog.gif]] [[Image:Orange_transparent.gif]] [[Image:Apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
Then I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
[[Image:Editing_screen1.jpg]]&lt;br /&gt;
(Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Initially, the images are underneath the background image &lt;br /&gt;
[[Image:Editing_screen2-1.jpg]]  &lt;br /&gt;
&lt;br /&gt;
I drag and drop the images to where they should be [[Image:Editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
[[Image:Editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
[[Image:Editing_screen2-4.jpg]]&lt;br /&gt;
Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
[[Image:Editing_screen2-5.jpg]]&lt;br /&gt;
&lt;br /&gt;
Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
&lt;br /&gt;
When added to a quiz, the question looks like this:&lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
[[Image:Quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8179</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8179"/>
		<updated>2006-04-07T15:00:09Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Drag and Drop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
A simple example&lt;br /&gt;
&lt;br /&gt;
I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).&lt;br /&gt;
&lt;br /&gt;
To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
[[Image:words.jpg]]&lt;br /&gt;
[[Image:frog.gif]] [[Image:orange_transparent.gif]] [[Image:apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
Then I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
[[Image:editing_screen1.jpg]]&lt;br /&gt;
(Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Initially, the images are underneath the background image &lt;br /&gt;
[[Image:editing_screen2-1.jpg]]  &lt;br /&gt;
&lt;br /&gt;
I drag and drop the images to where they should be [[Image:editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
[[Image:editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
[[Image:editing_screen2-4.jpg]]&lt;br /&gt;
Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
[[Image:editing_screen2-5.jpg]]&lt;br /&gt;
&lt;br /&gt;
Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
&lt;br /&gt;
When added to a quiz, the question looks like this:&lt;br /&gt;
[[Image:Quiz_view.jpg]]&lt;br /&gt;
[[Image:quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8178</id>
		<title>Question types</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=Question_types&amp;diff=8178"/>
		<updated>2006-04-07T14:58:52Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Drag and Drop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You may add a variety of different types of questions:&lt;br /&gt;
&lt;br /&gt;
==Multiple choice==&lt;br /&gt;
Moodle provides you with a lot of flexibility when creating this common question type. Figure 5-5 shows an example question. You can create single answer and multiple answer questions, display pictures in the question and weight individual answers. &lt;br /&gt;
 &lt;br /&gt;
Figure 5-5. A multiple-choice question&lt;br /&gt;
&lt;br /&gt;
There are two types of multiple choice questions - single answer and multiple answer.&lt;br /&gt;
&lt;br /&gt;
;Single-answer questions&lt;br /&gt;
:These questions allow one and only one answer to be chosen by providing radio buttons next to the answers. You will specify non-negative marks for each answer, usually zero marks for wrong answers, maximum marks for correct answers and partial marks for partially correct answers.&lt;br /&gt;
&lt;br /&gt;
;Multiple-answer questions &lt;br /&gt;
:These questions allow one or more answers to be chosen by providing check boxes next to the answers. Each answer may carry a positive or negative grade, so that choosing ALL the options will not necessarily result in good grade. If the total grade is negative then the total grade for this question will be zero. Careful: it is possible to create questions that have scores greater than 100%.&lt;br /&gt;
&lt;br /&gt;
Figure 5-6 shows the multiple choice editing page. &lt;br /&gt;
&lt;br /&gt;
Figure 5-6. Editing a Multiple Choice Question&lt;br /&gt;
&lt;br /&gt;
To set up a multiple choice question you proceed as follows:&lt;br /&gt;
&lt;br /&gt;
#Start out by giving the question a descriptive name. You’ll use the name to track your questions later so “Question 1” isn’t a good idea. The name will be used in the question lists on the quiz editing page. It will not be shown to the students, so you can choose any name that makes sense to you and possibly other teachers.&lt;br /&gt;
&lt;br /&gt;
#Create the question text. If you’re using the HTML Editor, you can format the question just like a word processing document&lt;br /&gt;
#If you want to add an image to the question, you have two options&lt;br /&gt;
##If you’ve already uploaded an image to your Files area (see Chapter 4 for details), it will be available to add to the question stem in a dropdown menu under the Question text area&lt;br /&gt;
##If you’re using the HTML editor, you can click the image icon. This will pop-up the Insert Image window. You can choose to upload an image into your files area from this window, or you can add the URL of an image on the web. If you add a file to your files area, click the name of the file after you upload it to insert the link into the URL text entry at the top of the screen. Then click OK.&lt;br /&gt;
#Choose whether students can only select one answer or multiple answers&lt;br /&gt;
#Write your first answer in the Choice 1 text field.&lt;br /&gt;
#Select a grade percentage for the answer. This is the percentage of the total points for the question that selecting this response is worth. You can select negative percentages as well as positive percentages. So if a question is worth 10 points, selecting a correct response in a multiple answer question may give you 50% of the possible points. Selecting a wrong answer may take away 10%. &lt;br /&gt;
#If you wish, you can add feedback for each response. It may be a bit ore work, but it’s good practice to tell the students why each answer is right or wrong using the feedback area.  If students know why an answer is right or wrong, they can analyze their own thinking and being to understand why an answer is correct. Your feedback will only be displayed if you select Show Feedback in the quiz body options.&lt;br /&gt;
#Fill in the rest of the response choices in the rest of the form. Any unused areas will be ignored.&lt;br /&gt;
#Select the “Save Changes” button at the bottom of the screen.&lt;br /&gt;
&lt;br /&gt;
You have now added a multiple choice question to the question category.&lt;br /&gt;
&lt;br /&gt;
==Short answer==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include a image), the respondent types a word or phrase. There may several possible correct answers, with different grades. Answers may or may not be sensitive to case. &lt;br /&gt;
&lt;br /&gt;
To create a short answer question:&lt;br /&gt;
#Give your question a descriptive name&lt;br /&gt;
#Create the question stem. If you want students to fill in a blank, use the underscore to indicate where the blank is.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Choose whether capitalization is important. Case sensitivity can be tricky. Will you accept george washingtion as well as George Washington as an answer?&lt;br /&gt;
#Next, fill in the answers you will accept. You can give each answer a percentage of the grade as well. You could give common misspellings partial credit with this option. If the &amp;quot;Case sensitive&amp;quot; option is selected, then you can have different scores for &amp;quot;Word&amp;quot; or &amp;quot;word&amp;quot;.&lt;br /&gt;
#Create feedback for each acceptable answer.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
You can use the asterisk character (*) as a wildcard to match any series of characters. For example, use ran*ing to match any word or phrase starting with &amp;quot;ran&amp;quot; and ending with &amp;quot;ing&amp;quot;. If you really do want to match an asterisk then use a backslash like this: \*&lt;br /&gt;
&lt;br /&gt;
Without wildcards the answers are compared exactly, so be careful with your spelling!&lt;br /&gt;
&lt;br /&gt;
You may like to prototype your short answer questions to catch common acceptable answers you hadn’t thought of. Start out by creating a few acceptable answers, then include the question in a quiz for no points. Be sure to tell students you are testing a new question. Once the quiz is over, review students’ answers and add their acceptable answers to the list.&lt;br /&gt;
&lt;br /&gt;
==Numerical==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, a numerical question looks just like a short-answer question. The difference is that numerical answers are allowed to have an accepted error. This allows a continuous range of answers to be set. &lt;br /&gt;
&lt;br /&gt;
For example, if the answer is 30 with an accepted error of 5, then any number between 25 and 35 will be accepted as correct.&lt;br /&gt;
&lt;br /&gt;
Numerical questions can also have case-insensitive non-numerical answers. This is useful whenever the answer for a numerical question is something like N/A, +inf, -inf, NaN etc.&lt;br /&gt;
&lt;br /&gt;
Figure 5-8. Numerical Question&lt;br /&gt;
&lt;br /&gt;
To create a numerical question&lt;br /&gt;
#Give the question a descriptive name (This is only seen in the question list that you see as a teacher when you are putting together a quiz)&lt;br /&gt;
#Type the equation or numerical question for your students to solve&lt;br /&gt;
Moodle has a various text filters that allow you to type an equation and have it properly typeset when displayed. The Moodle Algebra filter is very good for writing common matematical expressions in a simple way. More complicated expressions kan use the TeX syntax. If they don&#039;t work the administrator may have not enabled them.&lt;br /&gt;
#Select an image to display if you want to add a picture to the question (see step 3 in the multiple choice description above for more detail).&lt;br /&gt;
#Enter the correct answer. 23.4 23,4 and 2.34E+1 would all work. (you can only add one correct answer in the user interface. If you import the question with a GIFT format file you can specifiy multiple answer(intervals) with accompanying feedback and point-percentage. This is done similar to the CLOZE [[Numerical]] format. There is no units support in the Cloze type.) It is possible, though not simple, to get support for  several answer intervals &#039;&#039;&#039;and&#039;&#039;&#039; unit support if you create the question in the numerical interface and export it in Moodle XML format. Than you can duplicate the &amp;lt;answer&amp;gt; segment and put in another answer interval and the feedback and grading factor you want for that interval. Than import it again. You will not be able to edit the question in the normal numerical interface though.&lt;br /&gt;
#Enter the accepted error, the range above or below the correct answer. For example, if the correct answer is 5, but you will accept 4 or 6 as answers, your accepted error is 1.&lt;br /&gt;
#Enter feedback for the question. It is possible to use all kinds of HTML formating for the feedback but it must be written by hand. Unfortunately (in 1.5.3 anyhow) it is right justified and has no identifying formatting. &lt;br /&gt;
#Units can be specified and work to a degree. Unfortunately if the student answers with the right number but no unit he can get full points. And if he thinks of another unit and has the right number and no unit, he gets no differentiated feedback, just wrong. You must also give the conversion factor . So if your main answer was &#039;&#039;&#039;5500&#039;&#039;&#039; with unit &#039;&#039;&#039;W&#039;&#039;&#039; and you wanted to allow the unit &#039;&#039;&#039;kW&#039;&#039;&#039; you would have to specify the factor &#039;&#039;&#039;0.001&#039;&#039;&#039;. If you wanted to allow &#039;&#039;&#039;Watt&#039;&#039;&#039; you would use the factor &#039;&#039;&#039;1&#039;&#039;&#039;.&lt;br /&gt;
#Click Save Changes to add the question to the category&lt;br /&gt;
&lt;br /&gt;
==True/false==&lt;br /&gt;
&lt;br /&gt;
In response to a question (that may include an image), the respondent selects from two options: True or False. &lt;br /&gt;
&lt;br /&gt;
If feedback is enabled, then the appropriate feedback message is shown to the respondent after answering the quiz. For example, if the correct answer is &amp;quot;False&amp;quot;, but they answer &amp;quot;True&amp;quot; (getting it wrong) then the &amp;quot;True&amp;quot; feedback is shown.&lt;br /&gt;
&lt;br /&gt;
==Matching==&lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question. &lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
==Embedded answers (Cloze)==&lt;br /&gt;
&lt;br /&gt;
[[Cloze|Embedded answers (Cloze)]] questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers. &lt;br /&gt;
&lt;br /&gt;
Questions consist of a passage of text (in Moodle format) that has various answers embedded within it, including multiple choice, short answers and numerical answers.&lt;br /&gt;
&lt;br /&gt;
There is currently no graphical interface to create these questions - you need to specify the question format using the text box or by importing them from external files.&lt;br /&gt;
&lt;br /&gt;
==Random short-answer matching==&lt;br /&gt;
&lt;br /&gt;
From the student perspective, this looks just like a Matching question. The difference is that the subquestions are drawn randomly from Short Answer questions in the current category. &lt;br /&gt;
&lt;br /&gt;
After an optional introduction, the respondent is presented with several sub-questions and several jumbled answers. There is one correct answer for each question.&lt;br /&gt;
&lt;br /&gt;
The respondent must select an answer to match each sub-question.&lt;br /&gt;
&lt;br /&gt;
Each sub-question is equally weighted to contribute towards the grade for the total question.&lt;br /&gt;
&lt;br /&gt;
The questions and answers are randomly drawn from the pool of &amp;quot;Short Answer&amp;quot; questions in the current category. Each attempt on a quiz will have different questions and answers.&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
This is not a real question. It simply prints some text (and possibly graphics) without requiring an answer. This can be used to provide some information to be used by a following group of questions, for example. &lt;br /&gt;
&lt;br /&gt;
==Calculated==&lt;br /&gt;
&lt;br /&gt;
Calculated questions offer a way to create individual numerical questions by the use of wildcards that are substituted with individual values when the quiz is taken.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Third-party question types==&lt;br /&gt;
&lt;br /&gt;
Besides the question types described above that are part of the core Moodle distribution there are question type plugins contributed by the community. &lt;br /&gt;
&lt;br /&gt;
===Rendered Matching===&lt;br /&gt;
&lt;br /&gt;
===Drag and Drop===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Teacher]]&lt;br /&gt;
&lt;br /&gt;
A simple example&lt;br /&gt;
&lt;br /&gt;
I want to make a drag and drop question&lt;br /&gt;
for a beginning french class - to test the knowledge of the words&lt;br /&gt;
pomme(apple), orange, and grenouille(frog).&lt;br /&gt;
&lt;br /&gt;
To do so, I will use a background image with these words, and&lt;br /&gt;
drag-and-droppable images of an apple, orange, and frog.  I create the&lt;br /&gt;
images and upload them to my moodle course files.&lt;br /&gt;
[[Image:words.jpg]]&lt;br /&gt;
[[Image:frog.gif]] [[Image:orange_transparent.gif]] [[Image:apple_transparent.gif]]&lt;br /&gt;
&lt;br /&gt;
Then I edit a new drag and drop question.  For this example, I&#039;ve left the &amp;quot;Text&amp;quot; field&lt;br /&gt;
empty.  If some text is entered here, it will be shown under the initial&lt;br /&gt;
position of the drag and drop image during the quiz.&lt;br /&gt;
[[Image:editing_screen1.jpg]]&lt;br /&gt;
(Note that the fields &amp;quot;Image: X, Y, Width, Height:&amp;quot;, &amp;quot; Hotspot: X, Y,&lt;br /&gt;
Width, Height :&amp;quot;, and &amp;quot; Alternative hotspots :&amp;quot; can be ignored.  These&lt;br /&gt;
are for advanced usage - when you need to align images accurate to the&lt;br /&gt;
pixel, or when you need to have more than one possible &amp;quot;correct&amp;quot; hotspot&lt;br /&gt;
for an image.  The x,y,width,height values will automatically be filled&lt;br /&gt;
in when graphically positioning the images/hotspots in the second step.)&lt;br /&gt;
&lt;br /&gt;
Then I click on &amp;quot;Position the hotspots&amp;quot; to proceed to the second step.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Initially, the images are underneath the background image &lt;br /&gt;
[[Image:editing_screen2-1.jpg]]  &lt;br /&gt;
&lt;br /&gt;
I drag and drop the images to where they should be [[Image:editing_screen2-2.jpg]]&lt;br /&gt;
&lt;br /&gt;
Now, I want to position the hotspots.  When the student answers the&lt;br /&gt;
question, if any part of the drag and drop image overlaps it&#039;s hotspot,&lt;br /&gt;
it will be considered correctly positioned.  I click the button &amp;quot;Snap&lt;br /&gt;
hotspots to all images&amp;quot;.  The hotspots are the red boxes that appear:&lt;br /&gt;
[[Image:editing_screen2-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
I&#039;d like to position the hotspots so that they cover each word, but not&lt;br /&gt;
any of the empty space around each word.  With the images and the&lt;br /&gt;
hotspots both visible, it&#039;s hard to see what I need to see - the words&lt;br /&gt;
on the background image.  It could also be a little difficult to&lt;br /&gt;
reposition and resize the hotspots, because it is easy to click on the&lt;br /&gt;
drag and drop image instead of the hotspot.  To make life easier, I&lt;br /&gt;
click on the button &amp;quot;Hide images&amp;quot;.   &lt;br /&gt;
[[Image:editing_screen2-4.jpg]]&lt;br /&gt;
Now I can see the background image without the drag and drop images getting in the way.&lt;br /&gt;
By holding down the shift key as I click and drag on the lower-right&lt;br /&gt;
side of the hotspots, I can resize the hotspots.  Without the shift key&lt;br /&gt;
pressed, I can position the hotspots by dragging them.  When I&#039;m done,&lt;br /&gt;
it looks like this:&lt;br /&gt;
[[Image:editing_screen2-5.jpg]]&lt;br /&gt;
&lt;br /&gt;
Satisfied, I click on the button &amp;quot;Save and continue&amp;quot;.  This finishes the&lt;br /&gt;
editing of the question.&lt;br /&gt;
&lt;br /&gt;
When added to a quiz, the question looks like this:&lt;br /&gt;
[[Image:quiz_view.jpg]]&lt;br /&gt;
[[Image:quiz_view-2.jpg]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Quiz_view-2.jpg&amp;diff=8173</id>
		<title>File:Quiz view-2.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Quiz_view-2.jpg&amp;diff=8173"/>
		<updated>2006-04-07T14:50:29Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Quiz_view.jpg&amp;diff=8172</id>
		<title>File:Quiz view.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Quiz_view.jpg&amp;diff=8172"/>
		<updated>2006-04-07T14:50:13Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Editing_screen2-5.jpg&amp;diff=8171</id>
		<title>File:Editing screen2-5.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Editing_screen2-5.jpg&amp;diff=8171"/>
		<updated>2006-04-07T14:49:56Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Editing_screen2-4.jpg&amp;diff=8170</id>
		<title>File:Editing screen2-4.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Editing_screen2-4.jpg&amp;diff=8170"/>
		<updated>2006-04-07T14:49:45Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Editing_screen2-3.jpg&amp;diff=8169</id>
		<title>File:Editing screen2-3.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Editing_screen2-3.jpg&amp;diff=8169"/>
		<updated>2006-04-07T14:49:32Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Editing_screen2-2.jpg&amp;diff=8168</id>
		<title>File:Editing screen2-2.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Editing_screen2-2.jpg&amp;diff=8168"/>
		<updated>2006-04-07T14:49:20Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Editing_screen2-1.jpg&amp;diff=8167</id>
		<title>File:Editing screen2-1.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Editing_screen2-1.jpg&amp;diff=8167"/>
		<updated>2006-04-07T14:49:06Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Editing_screen1.jpg&amp;diff=8166</id>
		<title>File:Editing screen1.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Editing_screen1.jpg&amp;diff=8166"/>
		<updated>2006-04-07T14:48:45Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Words.jpg&amp;diff=8165</id>
		<title>File:Words.jpg</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Words.jpg&amp;diff=8165"/>
		<updated>2006-04-07T14:48:26Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Orange_transparent.gif&amp;diff=8164</id>
		<title>File:Orange transparent.gif</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Orange_transparent.gif&amp;diff=8164"/>
		<updated>2006-04-07T14:48:15Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Frog.gif&amp;diff=8163</id>
		<title>File:Frog.gif</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Frog.gif&amp;diff=8163"/>
		<updated>2006-04-07T14:47:55Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/21/en/index.php?title=File:Apple_transparent.gif&amp;diff=8162</id>
		<title>File:Apple transparent.gif</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/21/en/index.php?title=File:Apple_transparent.gif&amp;diff=8162"/>
		<updated>2006-04-07T14:47:19Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
</feed>