<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/310/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/310/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Brianking"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/Special:Contributions/Brianking"/>
	<updated>2026-06-06T02:38:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Multi-language_content_filter&amp;diff=106609</id>
		<title>Multi-language content filter</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Multi-language_content_filter&amp;diff=106609"/>
		<updated>2013-09-13T11:13:37Z</updated>

		<summary type="html">&lt;p&gt;Brianking: added link to german translation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Filters}}&lt;br /&gt;
The Multi-language content filter enables resources to be created in multiple languages. When turned on, it looks for &amp;lt;nowiki&amp;gt;&amp;lt;span lang=&amp;quot;xx&amp;quot; class=&amp;quot;multilang&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt; tags which indicate that a text contains multiple languages. Then it selects and outputs the best language for the current user. The language of the resource will change when the user changes their selected Moodle language.&lt;br /&gt;
&lt;br /&gt;
== How to use in a course ==&lt;br /&gt;
&lt;br /&gt;
To use this feature first create your contents in multiple languages (in the same resource). Then enclose each language block (aka multilang block) in the following tags:&lt;br /&gt;
&lt;br /&gt;
       &amp;lt;nowiki&amp;gt;&amp;lt;span lang=&amp;quot;XX&amp;quot; class=&amp;quot;multilang&amp;quot;&amp;gt;your_content_here&amp;lt;/span&amp;gt;&lt;br /&gt;
      &amp;lt;span lang=&amp;quot;YY&amp;quot; class=&amp;quot;multilang&amp;quot;&amp;gt;your_content_in_other_language_here&amp;lt;/span&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is essential to be in &#039;&#039;&#039;the code editing mode&#039;&#039;&#039; (press &amp;lt;nowiki&amp;gt;[&amp;lt;&amp;gt;]&amp;lt;/nowiki&amp;gt; in the HTML editor), when you enter these tags for them to work. Only spaces, tabs and enters can be used between the individual languages in the multilang block.&lt;br /&gt;
&lt;br /&gt;
== How it works internally ==&lt;br /&gt;
&lt;br /&gt;
# Filter first looks for &#039;&#039;multilang blocks&#039;&#039; in the text&lt;br /&gt;
# For each multilang block:&lt;br /&gt;
#* If there are texts in the currently active language, print them&lt;br /&gt;
#* Else, if there exists texts in the current parent language, print them&lt;br /&gt;
#* Else, print the first language found in the text&lt;br /&gt;
# Text outside of multilang blocks will be shown always&lt;br /&gt;
&lt;br /&gt;
== Common problems ==&lt;br /&gt;
&lt;br /&gt;
* The multilang filter is not enabled. It can be enabled by a site administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Plugins &amp;gt; Filters &amp;gt; Manage filters&#039;&#039;.&lt;br /&gt;
* Extra characters between language span tags - editor might add &amp;lt;nowiki&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;/nowiki&amp;gt; or other tags, please review the html in source view&lt;br /&gt;
* If the course setting is &amp;quot;force&amp;quot; some language, you won&#039;t be able to change the displayed language.&lt;br /&gt;
* Extra spaces in language span tag&lt;br /&gt;
* Can not easily access language choice dropdown! Unfortunately you must go to the site homepage or your own profile to change the displayed language. It is possible to manually quickly change displayed lang by editing the URL in the browsers address bar. See Tips and tricks below!&lt;br /&gt;
&lt;br /&gt;
==Tips and tricks== &lt;br /&gt;
&lt;br /&gt;
===Changing language displayed without going to front page===&lt;br /&gt;
It is possible to change the displayed language by manually changing the link.  &lt;br /&gt;
*Here is the default language page at id=2306. This link is in English, the default language:&lt;br /&gt;
:http://moodle.org/mod/resource/view.php?id=2306&lt;br /&gt;
*The link to change the page display to Spanish is&lt;br /&gt;
:http://moodle.org/mod/resource/view.php?id=2306&amp;amp;lang=es ,&lt;br /&gt;
*When the default language is an other language, to change the page to an English version, the link would be:&lt;br /&gt;
:http://moodle.org/mod/resource/view.php?id=2306&amp;amp;lang=en&lt;br /&gt;
&lt;br /&gt;
Thus, with a bit of editing, you can manually change the displayed language by adding &amp;quot;&amp;amp;lang=xx&amp;quot; to the URL in the location bar of the browser. Where xx is the abbreviation for the language you want.&lt;br /&gt;
&lt;br /&gt;
==See also== &lt;br /&gt;
&lt;br /&gt;
*[[Language]]&lt;br /&gt;
*Custom menu items in [[Theme settings]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Language]]&lt;br /&gt;
&lt;br /&gt;
[[de:Mehrsprachiger Inhalt]]&lt;br /&gt;
[[es:Contenido multilingüe]]&lt;br /&gt;
[[fr:Contenu multilingue]]&lt;br /&gt;
[[ja:多言語シンタックス]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Beginning_Moodle_2.0_Administration&amp;diff=105786</id>
		<title>Beginning Moodle 2.0 Administration</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Beginning_Moodle_2.0_Administration&amp;diff=105786"/>
		<updated>2013-06-24T15:20:17Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* Why am I having trouble restoring my existing Moodle 1.9.x courses into Moodle 2.0? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The pages began life with the [https://docs.moodle.org/19/en/Beginning_Administration_FAQ Beginning v1.9 Administration FAQ] pages but are aimed specifically at Moodle 2.x. Many of the solutions to problems will work in both versions of Moodle so if you do not find something here, then you may find it in the other pages. The questions asked here are mostly questions that I was confronted with when I first started with administering a Moodle, but I had some experience as a user which helped me a lot. The other source of questions is the Moodle Forums.   &lt;br /&gt;
&lt;br /&gt;
===What kind of technical skills do I need to take on Moodle Administration?===&lt;br /&gt;
Reading and writing are handy skills, and probably the most useful. This is something of a loaded question, and the answer is actually, depends on what you want to do, and what skills you already have. &lt;br /&gt;
&lt;br /&gt;
Do you have any HTML, CSS and PHP skills? Do you have any SQL database skills. If you do, then you have a good start, if you do not, then do not worry about it. If you need them, you will pick these skills up as you go, and if you already have any programming skills, it is going to be fairly easy to do so. If you have never done any programming before, it is a little more difficult, but once you have the idea, it becomes a lot easier. Unless you intend on developing your Moodle, e.g. build your own home made theme, alter code to reflect your own organization, then you can get away without any of these skills. What you need is a way of developing a quick understanding of how Moodle works. With the introduction of Moodle v2, the learning curve has steepened somewhat, but it is still not that difficult. &lt;br /&gt;
&lt;br /&gt;
Installing and setting up a new Moodle is not as difficult as it used to be. Some servers and service providers do have problems, from time to time, but if you work with your ISP, and the Moodle Community, you will get your Moodle up and running. Once it is going, start looking at it. You won&#039;t break anything, unless you start deleting things. Your best bet would be to read the documents. Look at the page you are working on. Somewhere on that page is a link that points to &amp;quot;Moodle Docs for this page&amp;quot;. That is your best, most readily available, clues on how to do things. Once familiar with the environment, and how to get around it, how to get information on it, then the major steps have been taken, the rest is a continual refinement of that.        &lt;br /&gt;
&lt;br /&gt;
[[Image:lightbulb.png|frame|left|Tip]]As a newbie Administrator, it is easy to get overwhelmed with all the different things available, useful plugins and extra blocks and so on, but the majority of those things are third-party made, not Moodle.org in origin. Be aware that, as a general rule of thumb, the further you move away from the standard Moodle, the greater your risks of things going wrong. This does not mean the plugins are badly written, and some are really handy, just sometimes things go wrong. If you are going to use them, be deliberate in your choice, do not use them just because it might be a good idea. &lt;br /&gt;
&lt;br /&gt;
Perhaps the best thing is that you create a Moodle on your desktop, or laptop, and you use that as a testbed. It should be the same version as your production site, to make things easy. Try things there first, if there is no problems, then you can replicate it on your production site.&lt;br /&gt;
&lt;br /&gt;
===I am being told that I need the &#039;&#039;&#039;intl php plugin&#039;&#039;&#039; to continue to install Moodle 2.x===&lt;br /&gt;
The intl.dll from Zend is part of the PHP 5.2.8 release and later. It is aimed at improving the internationalization of php pages and Moodle 2.x uses it as part of this process. If your install is on a local machine or network, then you can download the latest version of PHP and update your PHP. You then have to uncomment all the required dynamic extensions you need, including the php_intl.dll extension. The problem is then solved. If the install is on a host server, then you need to contact your host and ask them to do the same, As an alternative, you can unzip/untar the download file, copy and paste the intl.dll file to your php/ext folder and include the line:&lt;br /&gt;
  extension=php_intl.dll&lt;br /&gt;
in the Dynamic Extensions section of your php.ini file.&lt;br /&gt;
&lt;br /&gt;
You can also set the error level using:&lt;br /&gt;
  intl.error_level = E_WARNING &lt;br /&gt;
but this is not essential&lt;br /&gt;
&lt;br /&gt;
If you are using a Linux install, use your system package manager or specify compilation flag.&lt;br /&gt;
    * Debian 5.0 (&amp;amp; Ubuntu) use: apt-get install php-intl or apt-get install php5-intl &lt;br /&gt;
    * CentOS 5.5 (&amp;amp; RedHat) you should (probably) be using php 5.3 from remi and then use: yum install php-intl&lt;br /&gt;
&lt;br /&gt;
This technique can be applied to any updated dynamic extension from Zend. You may want to use later dll files in your php/ext folder, you can do so by doing the same as above, but be careful, your version may not be able to take full advantage of the extension, or some very new extensions may cause an unexpected instability. The best option is still to update on a regular basis, perhaps once a year or so for the PHP.&lt;br /&gt;
&lt;br /&gt;
===What Dynamic Extensions do I really need uncommented in my php.ini file? What else do I need to change?===&lt;br /&gt;
This assumes you have complete control over the installation and running of your server, if your Moodle is hosted, you need to do something different, which is also discussed below. In the php.ini you need to delete the semi-colon, the ;, from the start of any line to uncomment it. For Moodle, you really should only need to change some values, and make sure the extensions you require are available. These are:&lt;br /&gt;
&lt;br /&gt;
Resource Limits&lt;br /&gt;
  memory_limit = 128M     //This is the maximum it requires and on a shared server you may get much less. &lt;br /&gt;
&lt;br /&gt;
Data Handling &lt;br /&gt;
  post_max_size = 512M    //This allows postings of up to 512MB, but set it to suit yourself and your circumstances&lt;br /&gt;
&lt;br /&gt;
Paths and Directories&lt;br /&gt;
  doc_root =&amp;quot;driveletter:\path\to\server\active\web\directory&amp;quot;  (e.g. d:\Apache\htdocs or e:\iis\wwwroot )&lt;br /&gt;
  and&lt;br /&gt;
  extension_dir = &amp;quot;driveletter:\path\to\php\ext&amp;quot; (e.g. d:\php\ext or e:\iis\php\ext)&lt;br /&gt;
&lt;br /&gt;
File Uploads&lt;br /&gt;
  upload_max_filesize = 512M    (This is different from the post_max_size this is for file uploads.)&lt;br /&gt;
&lt;br /&gt;
Dynamic Extensions&lt;br /&gt;
{| class=&amp;quot;nicetable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PHP 5.2.x (Moodle 1.9 with additions) &lt;br /&gt;
! PHP 5.3.x&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
  extension=php_curl.dll&lt;br /&gt;
  extension=php_exif.dll&lt;br /&gt;
  extension=php_gd2.dll&lt;br /&gt;
  extension=php_gettext.dll&lt;br /&gt;
  extension=php_imap.dll&lt;br /&gt;
  extension=php_ldap.dll&lt;br /&gt;
  extension=php_mbstring.dll&lt;br /&gt;
  extension=php_mcrypt.dll&lt;br /&gt;
  extension=php_mssql.dll&lt;br /&gt;
  extension=php_mysql.dll&lt;br /&gt;
  extension=php_mysqli.dll&lt;br /&gt;
  extension=php_openssl.dll&lt;br /&gt;
  extension=php_soap.dll&lt;br /&gt;
  extension=php_sockets.dll&lt;br /&gt;
  extension=php_sqlite.dll&lt;br /&gt;
  extension=php_xmlrpc.dll&lt;br /&gt;
  &#039;&#039;&#039;extension=php_intl.dll&#039;&#039;&#039;&lt;br /&gt;
  &#039;&#039;&#039;extension=php_zip.dll&#039;&#039;&#039;  ; Added Extensions&lt;br /&gt;
|&lt;br /&gt;
  extension=php_curl.dll&lt;br /&gt;
  extension=php_gd2.dll&lt;br /&gt;
  extension=php_gettext.dll&lt;br /&gt;
  extension=php_intl.dll&lt;br /&gt;
  extension=php_imap.dll&lt;br /&gt;
  extension=php_ldap.dll&lt;br /&gt;
  extension=php_mbstring.dll&lt;br /&gt;
  extension=php_exif.dll      ; Must be after mbstring as it depends on it&lt;br /&gt;
  extension=php_mysql.dll&lt;br /&gt;
  extension=php_mysqli.dll&lt;br /&gt;
  extension=php_openssl.dll&lt;br /&gt;
  extension=php_pdo_mssql.dll&lt;br /&gt;
  extension=php_pdo_mysql.dll&lt;br /&gt;
  extension=php_soap.dll&lt;br /&gt;
  extension=php_sockets.dll&lt;br /&gt;
  extension=php_sqlite.dll&lt;br /&gt;
  extension=php_xmlrpc.dll&lt;br /&gt;
  extension=php_zip.dll&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;NOTE:&#039;&#039;&#039; If you are using a PHP version earlier than v5.2.8, then for Moodle 2.0.x please add the Dynamic extensions of intl.dll and zip.dll as outlined above. Be aware this structure does &#039;&#039;&#039;not&#039;&#039;&#039; work in Moodle 2.1. &lt;br /&gt;
&lt;br /&gt;
These edits and Dynamic extensions cover a range of options here, there are a number of other possibilities, but these listed are the most common ones. Unless you have a specific need, there may not be any reason to deviate from these settings, but if you do, make sure you know what is going to happen. These extensions will also allow you to successfully install and run many other PHP applications. &lt;br /&gt;
&lt;br /&gt;
One example is the Oracle extensions are not shown here, but Oracle can be used for the Moodle database. Another area people often get themselves into trouble is using &amp;quot;Magic quotes&amp;quot;. Magic quotes really should be set to off, they were only introduced early in the use of PHP to allow for some inexperienced scripting practices, (read poor, shoddy or dodgy here). If someone is still writing poor scripts, then they deserve to draw attention to themselves and their scripts deleted.&lt;br /&gt;
&lt;br /&gt;
===My Host took my Moodle 2 down from the server due to an overload of the database.===&lt;br /&gt;
This happens far too often on shared servers. The additional memory requirements of Moodle 2+ for installation and the additional database storage required is going to make it worse. The best bet is to find a dedicated server, that is the optimum, but reality is that costs do play a large part in making decisions about where a Moodle will be stored. A dedicated server will give you the entire disc space and all the memory on that server to use as you need. A virtual dedicated server means you are sharing with a few other users on a server, possibly as many as 10, but more likely 5 or 6. A shared server mean you are sharing one box with as many of the Host&#039;s clientele that can be put onto one server. This means sharing all resources and Moodle&#039;s demands get higher as the number of Users increases which affects all other Clients of the Host. There are any number of Moodle Partners who may be willing to host your Moodle, and the Internet also means you are not restricted by national or natural boundaries or currency transactions - politics, oceans and banks have no impact on where you host your Moodle.&lt;br /&gt;
&lt;br /&gt;
===Why am I having trouble restoring my existing Moodle 1.9.x courses into Moodle 2.0?===&lt;br /&gt;
Simply put, the changes in coding between Moodle 1.9.x and Moodle 2.0 are large. Additional security has forced changes to the backup processes. In just looking at the databases there are an additional 60 or more tables, so that creates a number of restoring issues alone. To bring Moodle 1.9.x courses into Moodle 2.0 is a monumental challenge, and full credit to those who are trying it. There is, currently, one commercial Windows based solution but it is not fully successful in its restoration of courses. &lt;br /&gt;
 &lt;br /&gt;
: &#039;&#039;&#039;NOTE:&#039;&#039;&#039; Moodle 2.0 can backup and restore courses from within itself perfectly, the issue appears to be centred on v1.x.x courses.&lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;UPDATE:&#039;&#039;&#039; Moodle 2.1 was released on July 1, 2011 and can now restore course files from backups made in v1.9.x.  No users or user data can be restored.&lt;br /&gt;
&lt;br /&gt;
===How do I look up the error logs in Moodle 2.0?===&lt;br /&gt;
First, turn the error logs on, go to&lt;br /&gt;
&lt;br /&gt;
  Site administration ► Development ► Debugging&lt;br /&gt;
&lt;br /&gt;
and set error messages to DEVELOPER: .... Then go to&lt;br /&gt;
&lt;br /&gt;
  Site administration ► Reports ► Logs&lt;br /&gt;
&lt;br /&gt;
set your report options to Home 2.0(Site), All Participants, All Activities or Site Errors, View, Display on Page and then click, &amp;quot;Get these logs&amp;quot;. The report should give you something, and you may be able to develop an appropriate response from there.&lt;br /&gt;
&lt;br /&gt;
===Do I try to upgrade to Moodle 2.0 or just create a new install?=== &lt;br /&gt;
There is always debate around these issues, but simply put, Moodle 2.0 is a complete re-write of a tried and tested tool. This presents its own challenges, obviously, and those challenges need be met in the best way we can. It is a temptation to go all in and jump to the new tool, but this can be a dangerous practice when dealing with a lot of people who are resistant to change, and the change from Moodle 1.9.x to 2.0 is massive.&lt;br /&gt;
  Upgrading to Moodle 2.0 has always been an option, but make sure your environment will meet the newer specifications. &lt;br /&gt;
Consider your own circumstances. Are you starting out on the Moodle journey or have you just been dropped into it? Perhaps you are starting out, and you have no resources or courses and you are building for the next few months when you want it to become a part of your learning centre and a showpiece for your institute. A complete new Moodle 2.x.x install and starting from scratch is most appropriate in this circumstance. All major features work in it and some of the tools are a lot more interesting than for Moodle 1.9.x. &lt;br /&gt;
  Don&#039;t worry about Moodle 1.9.x, just use the new Moodle 2.x.x and learn it if you are starting from scratch.&lt;br /&gt;
If you have been dropped into it, and have a lot of courses, and you need to administer your Moodle 1.9.x as well as look at updating, then the next best option is to install a new Moodle and open it just for your Administrators and Staff. Let them get used to the new interface, develop training courses around the new Moodle, not just for staff but for Users as well. Aim at your staff first, let them learn it then they can be more confident in using the new Moodle when they come to teaching their Users/Students. &lt;br /&gt;
  In short, best advice is NOT to install a Moodle 2.0 as a production site without thoroughly testing and training first. &lt;br /&gt;
To install and run more than one Moodle successfully is actually simple. Install your Moodle 2.0 and then go to &#039;&#039;&#039;&#039;&#039;Site administration &amp;gt; Server &amp;gt; Session handling&#039;&#039;&#039;&#039;&#039;. Look for the Cookie prefix dialogue and add a value to it. Repeat the exercise in every other Moodle you have on your server, it should all work as it is supposed to - as long as the cookie prefixes are different for every Moodle, of course. &lt;br /&gt;
&lt;br /&gt;
[[Image:cookieprefix.png|frame|center|Cookie prefix for Moodle 2.0]]&lt;br /&gt;
&lt;br /&gt;
Essentially, take your time and not be in too much of a rush if you have to convert your Staff and Learners to a new tool. Let the Staff get used to it first, then you can make the swap any time.&lt;br /&gt;
&lt;br /&gt;
If you do update your v1.9.x to v 2.0, and experience some problems, you may want to consider putting the issues and any error messages into a [http://tracker.moodle.org/secure/Dashboard.jspa Moodle Tracker item]. If you do, you may be providing information to resolve a number of updating issues for a lot of people.&lt;br /&gt;
&lt;br /&gt;
===Well, we want to try and upgrade to test our systems.===&lt;br /&gt;
Try, by all means. However, there are a couple of issues you may need be aware of. &lt;br /&gt;
&lt;br /&gt;
A rough guide and checklist: &lt;br /&gt;
#Plugins that work in Moodle 1.9.x may not be updated to Moodle 2.0. Check your plugins. Are you using any non-core plugins? &lt;br /&gt;
#Can you remove any non-core plugins? &lt;br /&gt;
#Have you backed up your database?&lt;br /&gt;
#Have you backed up your moodledata folder? &lt;br /&gt;
#Have you allocated additional time make the update, as a contingency?&lt;br /&gt;
&lt;br /&gt;
You may not necessarily have to remove the non-core plugins from the Moodle, or, they may still be present in the database even if you have deleted them from your Moodle Mod folder. The issue arising is that some plugins appear to be causing update errors as there is no matching core plugin from Moodle 2.0, or the plugin APIs are different and cannot accommodate the older plugins, or the older plugins that have not been properly maintained, cannot handle the newer environment. &lt;br /&gt;
&lt;br /&gt;
: &#039;&#039;&#039;NOTE:&#039;&#039;&#039;This is not meant to be an exhaustive checklist or to scare people off trying to upgrade their v1.9.x to v2.0.x, just be aware that Moodle 2.0 is still a work in progress, as is this checklist.&lt;br /&gt;
&lt;br /&gt;
===We have extensively used the Book for parts of our previous Moodle, can we do so for Moodle 2.0?===&lt;br /&gt;
The really good news is that Petr Skoda (Skodak) has the Maintainer role for the [http://moodle.org/mod/data/view.php?d=13&amp;amp;rid=319&amp;amp;filter=1 Book plugin/module]. Petr announced some time back that when his major coding tasks for Moodle 2.0 had been done, he was taking a short break then he would begin work on updating the Book for Moodle 2.0. &lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;&#039;UPDATE&#039;&#039;&#039;: Petr&#039;s updating of the Book module is now complete, and is available at the above link. Initial testing shows it installs easily and seems to run faster than the original. Seems the code has been better optimized by Petr, who deserves a hearty congratulations!!!&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please note:&#039;&#039;&#039; the book module is available as standard in Moodle 2.3&lt;br /&gt;
&lt;br /&gt;
===That is OK for the Book, but what about other plugins and blocks?===&lt;br /&gt;
As a general rule-of-thumb, if a plugin or block has not been maintained through Moodle 1.9.x then it is extremely unlikely it will make it to Moodle 2.0.x. This means the developer has not kept it current and may feel it is too much of a distraction from their current projects to keep active. This does not mean that you, or someone else, may not take it on, as long as you ensure that what you are working with is creative commons, open source or other non-proprietal software and you are not infringing either copyright or intellectual property rights. If you are not sure, try to contact the developer or last maintainer, they may be different - if required, get permission from them to continue development. Of course, you may also seek to develop an entirely new plugin, or block, but it is clear that it is actually duplicating something that already exists or was used in earlier versions of Moodle, but is no longer current. As long as you can prove the provenance of such a plugin or block, and do not use any code from anywhere else that is not original or acknowledged where the code came from, then you should be OK. For ideas and guidelines around developing or updating a plugin, look at this page from [https://docs.moodle.org/dev/Developer_documentation Developer Documentation].  You can also join a [http://dev.moodle.org/ class of developers] and learn how it can be done.&lt;br /&gt;
&lt;br /&gt;
===I am getting error messages about plugins and the installation stops when upgrading. What do I do?===&lt;br /&gt;
Quite frequently, not a lot at all, you can just continue on. Many of these messages are just that, messages, they are not supposed to stop or break the installation, they are just warnings that not all is working as you may be used to in an install. Usually they relate to plugins that are not part of Moodle 2.0 yet. Moodle is designed to display a message, but continue on. Or, you can consider that, given the above, upgrading is not really viable and just do a fresh install. If those messages continue, then you have another problem. If there were database errors, or code errors, then it is different, you really do need to stop and investigate.&lt;br /&gt;
&lt;br /&gt;
===We are installing Moodle and getting error messages about not using the unicode or UTF-8 charset===&lt;br /&gt;
In recent times, this has become an issue with CPanel and Fantastico installers on some Linux servers. Apparently the default charset for these tools is a latin_swedish_ci charset. Moodle requires the UTF-8 charset. This is a relatively simple fix, if you have the right tools. Install phpMyAdmin and check it is working, if you do not already have it. You can then go to the SQL page and enter the following code:&lt;br /&gt;
  ALTER DATABASE `moodle` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;&lt;br /&gt;
There have been, in the past, reports of tables that do not change using this SQL code, so try:  &lt;br /&gt;
  ALTER TABLE `mdl_tablename` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; &lt;br /&gt;
There have been no reasons as to why some tables are missed, but you can alter individual tables by using the code above. The code should look something like: &lt;br /&gt;
&lt;br /&gt;
[[Image:altertablesqlm202.png|frame|center|Changing the charset in Moodle 2.0]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;This also works in Moodle 1.9.x IF you use the utf8_general_ci charset.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; This SQL is supposed to work across the database, but recent reports suggest that the ALTER DATABASE seems to have a number of issues stemming from problems with the GRANT command. GRANT &amp;lt;nowiki&amp;gt;[permissiontype]&amp;lt;/nowiki&amp;gt; is supposed to allow a user to access the entire database, but it no longer appears to be the case. The ALTER TABLE SQL has not been affected by this issue.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;FURTHER NOTE:&#039;&#039;&#039; When using the ALTER DATABASE SQL, it appears to be diverted to altering the &#039;&#039;db.opt&#039;&#039; file, but is not continued into the tables of the database. So whether this is a deliberate security feature of more recent editions of MySQL or not is, at this stage, unknown. How this affects Postgres, or Oracle databases is also unknown.&lt;br /&gt;
&lt;br /&gt;
===OK, but how can we tell what tables are not converted?===&lt;br /&gt;
Using phpMyAdmin, you can find out almost anything you like about your database, as long as you know where to look. There is some real documentation about using phpMyAdmin that is linked both in the left and right panels. Go to the Database tab and then select the database you want to look at.&lt;br /&gt;
&lt;br /&gt;
[[Image:selectdatabasetab.png|thumb|150px|frame|center|Selecting the database tab in Moodle 2.0]]&lt;br /&gt;
&lt;br /&gt;
Once selected, you will see what the charset is of each table. Any table that does not comply you can change using the table SQL code above. &lt;br /&gt;
&lt;br /&gt;
[[Image:phpmyadmintablelisting.png|frame|center|Checking the table listings in phpMyAdmin]]&lt;br /&gt;
&lt;br /&gt;
===How do I get and install phpMyAdmin?===&lt;br /&gt;
phpMyAdmin is another very useful plugin. In Moodle 2.0 the plugin has been updated and is now located in a different place than it was in earlier versions. Go to the [http://moodle.org/mod/data/view.php?d=13&amp;amp;rid=448&amp;amp;filter=1 phpMyAdmin page in Modules and Plugins] and download the Moodle 2.0 version. Unzip it to the &#039;&#039;&#039;moodle/local&#039;&#039;&#039; folder and then go to &#039;&#039;&#039;Notifications&#039;&#039;&#039;. Moodle will then tell you it has been successfully installed. If you look in Administration &amp;gt; Server you will now find a line &amp;quot;phpMyAdmin&amp;quot;. To access your database, click the link. &lt;br /&gt;
&lt;br /&gt;
===When I update over a 1.9 install, I get an error message about an incompatible plugin and it all stops. What can I do?===&lt;br /&gt;
&lt;br /&gt;
One piece of advice is that you just do not do that!&lt;br /&gt;
&lt;br /&gt;
Sometimes, a file/folder will be removed from the code between one version of Moodle and the next. If you upgrade Moodle by copying the new Moodle code over the top of the old code, then the older files not duplicated or no longer existent, or just disused and dropped, will remain, and can break things.&lt;br /&gt;
&lt;br /&gt;
The correct way to upgrade is (assuming your Moodle code is in a folder called &amp;lt;tt&amp;gt;moodle&amp;lt;/tt&amp;gt; on the server:&lt;br /&gt;
# Upload the new code onto the server into a folder with a temporary name, like &amp;lt;tt&amp;gt;moodle_new&amp;lt;/tt&amp;gt;.&lt;br /&gt;
# Copy the &amp;lt;tt&amp;gt;config.php&amp;lt;/tt&amp;gt; file from the moodle folder to the &amp;lt;tt&amp;gt;moodle_new&amp;lt;/tt&amp;gt; folder.&lt;br /&gt;
# For any third-party plugins you have installed, copy them into &amp;lt;tt&amp;gt;moodle_new&amp;lt;/tt&amp;gt;. (Make sure the plugin is compatible with the version of Moodle you are upgrading to.)&lt;br /&gt;
# Then rename the &amp;lt;tt&amp;gt;moodle&amp;lt;/tt&amp;gt; folder to &amp;lt;tt&amp;gt;moodle_old&amp;lt;/tt&amp;gt;, and then rename &amp;lt;tt&amp;gt;moodle_new&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;moodle&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you insist though, then you can expect to be getting all sorts of error messages. Given the fundamental changes to the database and the manner in which plugins are structured, and employed, in Moodle 2.0.x this is a very time consuming and, ultimately, futile (I would suggest) approach. You can, of course, remove all non-core plugins, and their corresponding tables from the database, and then you give yourself a chance at getting through it somewhat less scathed, but I doubt it.&lt;br /&gt;
&lt;br /&gt;
===What is happening to my uploaded files? I cannot see them in the moodledata folder!===&lt;br /&gt;
To improve security, Moodle has change how files are stored in the moodledata folder. There are there, but no longer obvious. When a file is uploaded it is given a storage name, an encrypted name, and it is placed into a specific folder within the moodledata folder. That folder&#039;s name is directly related to the file storage name. So we have a file with an encrypted name, inside a folder with a related name, inside the moodledata folder. Now comes the nifty part, these encrypted names are used as connections to the database. The database stores those encrypted names as aliases for the files and uses them to link the files to the courses. You see them, but you do not see them, well they are not obvious. Unfortunately, you cannot edit them in place, like you could files in Moodle 1.9.x you have to edit them, delete the older file and upload the new ones.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
*[[Beginning Moodle 2.x Administration 2 FAQ |  Beginning Moodle 2.x Administration 2 FAQ ]] &lt;br /&gt;
*[[:Category:Administrator | Index of all Administrator-related pages]]&lt;br /&gt;
&lt;br /&gt;
[[Category:FAQ]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101075</id>
		<title>Performance settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101075"/>
		<updated>2012-10-04T13:15:20Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* config.php settings which may affect performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
==Performance settings==&lt;br /&gt;
&lt;br /&gt;
Various performance settings can be changed by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Performance&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Other site administration settings which may affect performance==&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Cleanup&#039;&#039;&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
* Don&#039;t use database sessions unless you really need them. On-disc sessions tend to be much faster.&lt;br /&gt;
&lt;br /&gt;
===config.php settings which may affect performance===&lt;br /&gt;
Increasing the value of CONTEXT_CACHE_MAX_SIZE &#039;&#039;&#039;may&#039;&#039;&#039; reduce the number of database queries for certain pages.  It will also increase memory usage, so be careful.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// Moodle 2.3: Increasing this from the default saved about &amp;gt; 1000 db queries on the course/index.php page for &lt;br /&gt;
// a Moodle having 1250 course categories.&lt;br /&gt;
// This value is specified in lib/accesslib.php, but it&#039;s OK to add a define for it in config.php:&lt;br /&gt;
define(&#039;CONTEXT_CACHE_MAX_SIZE&#039;, 7500);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[de:Geschwindigkeitseinstellungen]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101074</id>
		<title>Performance settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101074"/>
		<updated>2012-10-04T13:14:48Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* config.php settings which may affect performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
==Performance settings==&lt;br /&gt;
&lt;br /&gt;
Various performance settings can be changed by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Performance&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Other site administration settings which may affect performance==&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Cleanup&#039;&#039;&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
* Don&#039;t use database sessions unless you really need them. On-disc sessions tend to be much faster.&lt;br /&gt;
&lt;br /&gt;
===config.php settings which may affect performance===&lt;br /&gt;
Increasing the value of CONTEXT_CACHE_MAX_SIZE &#039;&#039;&#039;may&#039;&#039;&#039; reduce the number of database queries for certain pages.  It will also increase memory usage, so be careful.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
  // Moodle 2.3: Increasing this from the default saved about &amp;gt; 1000 db queries on the course/index.php page for &lt;br /&gt;
  // a Moodle having 1250 course categories.&lt;br /&gt;
  // This value is specified in lib/accesslib.php, but it&#039;s OK to add a define for it in config.php:&lt;br /&gt;
  define(&#039;CONTEXT_CACHE_MAX_SIZE&#039;, 7500);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[de:Geschwindigkeitseinstellungen]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101073</id>
		<title>Performance settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101073"/>
		<updated>2012-10-04T13:12:13Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* config.php settings which may affect performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
==Performance settings==&lt;br /&gt;
&lt;br /&gt;
Various performance settings can be changed by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Performance&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Other site administration settings which may affect performance==&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Cleanup&#039;&#039;&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
* Don&#039;t use database sessions unless you really need them. On-disc sessions tend to be much faster.&lt;br /&gt;
&lt;br /&gt;
===config.php settings which may affect performance===&lt;br /&gt;
Increasing the value of CONTEXT_CACHE_MAX_SIZE &#039;&#039;&#039;may&#039;&#039;&#039; reduce the number of database queries for certain pages.  It will also increase memory usage, so be careful.&lt;br /&gt;
&lt;br /&gt;
  // Moodle 2.3: Increasing this from the default saved about &amp;gt; 1000 db queries on the course/index.php page for &lt;br /&gt;
  // a Moodle having 1250 course categories.&lt;br /&gt;
  // This value is specified in lib/accesslib.php, but it&#039;s OK to add a define for it in config.php:&lt;br /&gt;
  define(&#039;CONTEXT_CACHE_MAX_SIZE&#039;, 7500);&lt;br /&gt;
&lt;br /&gt;
[[de:Geschwindigkeitseinstellungen]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101072</id>
		<title>Performance settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101072"/>
		<updated>2012-10-04T13:11:40Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* config.php settings which may affect performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
==Performance settings==&lt;br /&gt;
&lt;br /&gt;
Various performance settings can be changed by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Performance&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Other site administration settings which may affect performance==&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Cleanup&#039;&#039;&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
* Don&#039;t use database sessions unless you really need them. On-disc sessions tend to be much faster.&lt;br /&gt;
&lt;br /&gt;
===config.php settings which may affect performance===&lt;br /&gt;
Increasing the value of CONTEXT_CACHE_MAX_SIZE *may* reduce the number of database queries for certain pages.  It will also increase memory usage, so be careful.&lt;br /&gt;
&lt;br /&gt;
  // Moodle 2.3: Increasing this from the default saved about &amp;gt; 1000 db queries on the course/index.php page for &lt;br /&gt;
  // a Moodle having 1250 course categories.&lt;br /&gt;
  // This value is specified in lib/accesslib.php, but it&#039;s OK to add a define for it in config.php:&lt;br /&gt;
  define(&#039;CONTEXT_CACHE_MAX_SIZE&#039;, 7500);&lt;br /&gt;
&lt;br /&gt;
[[de:Geschwindigkeitseinstellungen]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101071</id>
		<title>Performance settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101071"/>
		<updated>2012-10-04T13:09:57Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* config.php settings which may affect performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
==Performance settings==&lt;br /&gt;
&lt;br /&gt;
Various performance settings can be changed by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Performance&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Other site administration settings which may affect performance==&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Cleanup&#039;&#039;&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
* Don&#039;t use database sessions unless you really need them. On-disc sessions tend to be much faster.&lt;br /&gt;
&lt;br /&gt;
===config.php settings which may affect performance===&lt;br /&gt;
Increasing the value of CONTEXT_CACHE_MAX_SIZE *may* reduce the number of database queries for certain pages.  It will also increase memory usage, so be careful.&lt;br /&gt;
{no-format}&lt;br /&gt;
// Moodle 2.3: Increasing this from the default saved about &amp;gt; 1000 db queries on the course/index.php page for &lt;br /&gt;
// a Moodle having 1250 course categories.&lt;br /&gt;
// This value is specified in lib/accesslib.php, but it&#039;s OK to add a define for it in config.php:&lt;br /&gt;
define(&#039;CONTEXT_CACHE_MAX_SIZE&#039;, 7500);&lt;br /&gt;
{no-format}&lt;br /&gt;
&lt;br /&gt;
[[de:Geschwindigkeitseinstellungen]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101070</id>
		<title>Performance settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101070"/>
		<updated>2012-10-04T13:09:35Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* config.php settings which may affect performance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
==Performance settings==&lt;br /&gt;
&lt;br /&gt;
Various performance settings can be changed by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Performance&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Other site administration settings which may affect performance==&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Cleanup&#039;&#039;&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
* Don&#039;t use database sessions unless you really need them. On-disc sessions tend to be much faster.&lt;br /&gt;
&lt;br /&gt;
===config.php settings which may affect performance===&lt;br /&gt;
Increasing the value of CONTEXT_CACHE_MAX_SIZE *may* reduce the number of database queries for certain pages.  It will also increase memory usage, so be careful.&lt;br /&gt;
{noformat}&lt;br /&gt;
// Moodle 2.3: Increasing this from the default saved about &amp;gt; 1000 db queries on the course/index.php page for &lt;br /&gt;
// a Moodle having 1250 course categories.&lt;br /&gt;
// This value is specified in lib/accesslib.php, but it&#039;s OK to add a define for it in config.php:&lt;br /&gt;
define(&#039;CONTEXT_CACHE_MAX_SIZE&#039;, 7500);&lt;br /&gt;
{noformat}&lt;br /&gt;
&lt;br /&gt;
[[de:Geschwindigkeitseinstellungen]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101069</id>
		<title>Performance settings</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Performance_settings&amp;diff=101069"/>
		<updated>2012-10-04T13:09:13Z</updated>

		<summary type="html">&lt;p&gt;Brianking: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Performance}}&lt;br /&gt;
==Performance settings==&lt;br /&gt;
&lt;br /&gt;
Various performance settings can be changed by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Performance&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==Other site administration settings which may affect performance==&lt;br /&gt;
&lt;br /&gt;
* Enable the &#039;&#039;&#039;language cache&#039;&#039;&#039;.&lt;br /&gt;
* Large log files can cause overall performance to degrade over time. If you observe that the site has gradually got slower loading pages in the browser, &#039;&#039;&#039;reduce your Log life time&#039;&#039;&#039; setting in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Server &amp;gt; Cleanup&#039;&#039;&lt;br /&gt;
* Performance can be greatly improved by allowing Moodle to use the system &#039;&#039;&#039;zip/unzip&#039;&#039;&#039; commands (rather than PHP-based zip libraries) - visit Admin/Server/System Paths and enter the path to the relevant executables. (Similarly, filling in the path to &#039;&#039;&#039;du&#039;&#039;&#039; will improve Moodle&#039;s speed at listing directory contents.)&lt;br /&gt;
* Note that using &#039;&#039;&#039;secure web connections&#039;&#039;&#039; (&#039;&#039;&#039;https&#039;&#039;&#039; rather than &#039;&#039;&#039;http&#039;&#039;&#039;) carries a higher processing burden, both for the webserver and the client - particularly because cacheing cannot be used as effectively, so the number of file requests is likely to increase dramatically. For this reason using https for all Moodle pages is not recommended. You can enable https just for the login screen, simply from Moodle&#039;s config page.&lt;br /&gt;
* Check your &#039;&#039;&#039;filters&#039;&#039;&#039;. Having too many filters active can have serious effects on server load, especially on lower-end systems. The number of active filters has a direct effect on the perceived latency of your site; that is the time taken for each page impression. &lt;br /&gt;
* Enable the &#039;&#039;&#039;text cache&#039;&#039;&#039; but do not &amp;quot;Filter all strings&amp;quot; unless you have a specific need. If in doubt profile the performance, and see how your changes affect the processing time.&lt;br /&gt;
* Check your &#039;&#039;&#039;anti-virus&#039;&#039;&#039; measures on the server.  Although they are useful for preventing security holes being exploited, some &amp;quot;On-Demand&amp;quot; scanners can affect performance by scanning page content (word, ppt files etc).&lt;br /&gt;
* If there are performance problems loading course pages, check the &#039;&#039;&#039;Resource module settings&#039;&#039;&#039;. The setting resource_filterexternalpages is known to slow-down course pages and should be set to &#039;No&#039; for better performance.&lt;br /&gt;
* Check your &#039;&#039;&#039;forum settings&#039;&#039;&#039;. To improve performance set forum_trackreadposts = No and forum_usermarksread = Yes (this will impact on the convenience of your users&#039; forum experience). Also consider setting the time of the day when old posts are cleared from the read table (forum_cleanreadtime) to when your site is less busy.&lt;br /&gt;
* Don&#039;t use database sessions unless you really need them. On-disc sessions tend to be much faster.&lt;br /&gt;
&lt;br /&gt;
===config.php settings which may affect performance===&lt;br /&gt;
Increasing the value of CONTEXT_CACHE_MAX_SIZE *may* reduce the number of database queries for certain pages.  It will also increase memory usage, so be careful.&lt;br /&gt;
{code}&lt;br /&gt;
// Moodle 2.3: Increasing this from the default saved about &amp;gt; 1000 db queries on the course/index.php page for &lt;br /&gt;
// a Moodle having 1250 course categories.&lt;br /&gt;
// This value is specified in lib/accesslib.php, but it&#039;s OK to add a define for it in config.php:&lt;br /&gt;
define(&#039;CONTEXT_CACHE_MAX_SIZE&#039;, 7500);&lt;br /&gt;
{code}&lt;br /&gt;
[[de:Geschwindigkeitseinstellungen]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Debugging&amp;diff=99362</id>
		<title>Debugging</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Debugging&amp;diff=99362"/>
		<updated>2012-07-20T15:43:42Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* In config.php */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developer tools}}&lt;br /&gt;
Debugging messages can be enabled by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Development &amp;gt; Debugging&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Debugging messages are intended to help diagnose problems and/or help Moodle developers. If you have a problem with your Moodle site and ask for help in a Moodle.org forum, a developer may ask you to turn debug messages on, in order to locate the cause of the problem. By default Moodle does not show any error messages at all. If you are having problems (e.g. blank screens or incomplete screens) turning on debugging is usually the first thing to try. &lt;br /&gt;
&lt;br /&gt;
==Debugging settings==&lt;br /&gt;
Here are the settings on the Debugging page:&lt;br /&gt;
&lt;br /&gt;
===Debug messages===&lt;br /&gt;
The default is none, your choices are:&lt;br /&gt;
&lt;br /&gt;
;NONE : Do not show any errors or warnings (Default) &lt;br /&gt;
;ALL : Show all reasonable PHP debug messages&lt;br /&gt;
;MINIMAL : Show only fatal errors&lt;br /&gt;
;NORMAL : Show warnings, errors and notices&lt;br /&gt;
;DEVELOPER : extra Moodle debug messages for developers&lt;br /&gt;
&lt;br /&gt;
There is rarely any advantage in going to Developer level, unless you are a developer, in which case it is strongly recommended.&lt;br /&gt;
&lt;br /&gt;
Once you have got the error message, and copied and pasted it somewhere.  HIGHLY RECOMMENDED to turn Debug back to NONE. Debug messages can give clues to a hacker as to the setup of your site.&lt;br /&gt;
&lt;br /&gt;
===Display debug messages===&lt;br /&gt;
&lt;br /&gt;
There is an option to choose whether to display error messages or simply record them in the server logs.&lt;br /&gt;
&lt;br /&gt;
===Debug email sending===&lt;br /&gt;
&lt;br /&gt;
Determines whether or not to enable verbose debug information during sending of email messages to SMTP server.&lt;br /&gt;
&lt;br /&gt;
===Performance info===&lt;br /&gt;
&lt;br /&gt;
The Performance info option determines whether performance info will be included in the footer of the standard theme (and some other themes). Performance info includes the time for the page to load, the amount of memory used to generate the page, cpu usage, load, and the record cache hit/miss ration.&lt;br /&gt;
&lt;br /&gt;
If you add&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
define(&#039;MDL_PERF&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFDB&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFTOLOG&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFTOFOOT&#039;, true);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
to your config.php file, then it will also count database queries. (This has to be in config.php, because Moodle starts doing DB queries before it loads the config information in the database!&lt;br /&gt;
&lt;br /&gt;
===Show origin of language strings===&lt;br /&gt;
Helps translators.&lt;br /&gt;
&lt;br /&gt;
===Show validator links===&lt;br /&gt;
Be careful, read the warning.&lt;br /&gt;
&lt;br /&gt;
===Show page information===&lt;br /&gt;
To show page information printed in the page footer.&lt;br /&gt;
&lt;br /&gt;
==What to do if you cannot get to the admin screens==&lt;br /&gt;
&lt;br /&gt;
If the error is stopping you even getting to the admin screens to turn on debugging, then you can set the debugging setting manually.&lt;br /&gt;
&lt;br /&gt;
===Try typing the URL directly===&lt;br /&gt;
&lt;br /&gt;
The debug settings are at the URL &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://.../admin/settings.php?section=debugging&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; on your server. Sometimes that URL will work, even though the pages you need to go to to get there (for example the site front page) do not. So it is worth trying to enter that URL directly.&lt;br /&gt;
&lt;br /&gt;
===In config.php===&lt;br /&gt;
&lt;br /&gt;
In moodle/config.php you can add the lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;debug = 2047; &lt;br /&gt;
$CFG-&amp;gt;debugdisplay = 1;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or even more debugging messages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;debug = 6143; &lt;br /&gt;
$CFG-&amp;gt;debugdisplay = 1;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.0 the possible settings are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// Force a debugging mode regardless the settings in the site administration&lt;br /&gt;
// @error_reporting(1023);  // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
@ini_set(&#039;display_errors&#039;, &#039;1&#039;); // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
$CFG-&amp;gt;debug = 32767;         // DEBUG_DEVELOPER // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
// for Moodle 2.0 - 2.2, use:  $CFG-&amp;gt;debug = 38911;  &lt;br /&gt;
$CFG-&amp;gt;debugdisplay = true;   // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
&lt;br /&gt;
// You can specify a comma separated list of user ids that that always see&lt;br /&gt;
// debug messages, this overrides the debug flag in $CFG-&amp;gt;debug and $CFG-&amp;gt;debugdisplay&lt;br /&gt;
// for these users only.&lt;br /&gt;
$CFG-&amp;gt;debugusers = &#039;2&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember to remove those lines again when you have finished diagnosing your problem.&lt;br /&gt;
&lt;br /&gt;
===In the database===&lt;br /&gt;
&lt;br /&gt;
Using a tool like phpMyAdmin, execute the following SQL commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
UPDATE mdl_config SET value = 2047 WHERE name = &#039;debug&#039;;&lt;br /&gt;
UPDATE mdl_config SET value = 1 WHERE name = &#039;debugdisplay&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To turn it back off, use the admin screens, or the commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
UPDATE mdl_config SET value = 0 WHERE name = &#039;debug&#039;;&lt;br /&gt;
UPDATE mdl_config SET value = 0 WHERE name = &#039;debugdisplay&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(If you use a different database prefix, you will need to adjust those commands accordingly.)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Developers can also use [http://xdebug.org/ XDEBUG] (Installed as a module on the Apache server) to further dig into the code, step by step using an [http://xdebug.org/docs/remote XDEBUG client application]. Probably, as part of their favorite IDE. For example: [http://php.netbeans.org/ NetBeans], [http://www.jetbrains.com/phpstorm/ phpStorm] or...&lt;br /&gt;
&lt;br /&gt;
[[fr:Débogage]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Debugging&amp;diff=99361</id>
		<title>Debugging</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Debugging&amp;diff=99361"/>
		<updated>2012-07-20T15:40:38Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* In config.php */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developer tools}}&lt;br /&gt;
Debugging messages can be enabled by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Development &amp;gt; Debugging&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Debugging messages are intended to help diagnose problems and/or help Moodle developers. If you have a problem with your Moodle site and ask for help in a Moodle.org forum, a developer may ask you to turn debug messages on, in order to locate the cause of the problem. By default Moodle does not show any error messages at all. If you are having problems (e.g. blank screens or incomplete screens) turning on debugging is usually the first thing to try. &lt;br /&gt;
&lt;br /&gt;
==Debugging settings==&lt;br /&gt;
Here are the settings on the Debugging page:&lt;br /&gt;
&lt;br /&gt;
===Debug messages===&lt;br /&gt;
The default is none, your choices are:&lt;br /&gt;
&lt;br /&gt;
;NONE : Do not show any errors or warnings (Default) &lt;br /&gt;
;ALL : Show all reasonable PHP debug messages&lt;br /&gt;
;MINIMAL : Show only fatal errors&lt;br /&gt;
;NORMAL : Show warnings, errors and notices&lt;br /&gt;
;DEVELOPER : extra Moodle debug messages for developers&lt;br /&gt;
&lt;br /&gt;
There is rarely any advantage in going to Developer level, unless you are a developer, in which case it is strongly recommended.&lt;br /&gt;
&lt;br /&gt;
Once you have got the error message, and copied and pasted it somewhere.  HIGHLY RECOMMENDED to turn Debug back to NONE. Debug messages can give clues to a hacker as to the setup of your site.&lt;br /&gt;
&lt;br /&gt;
===Display debug messages===&lt;br /&gt;
&lt;br /&gt;
There is an option to choose whether to display error messages or simply record them in the server logs.&lt;br /&gt;
&lt;br /&gt;
===Debug email sending===&lt;br /&gt;
&lt;br /&gt;
Determines whether or not to enable verbose debug information during sending of email messages to SMTP server.&lt;br /&gt;
&lt;br /&gt;
===Performance info===&lt;br /&gt;
&lt;br /&gt;
The Performance info option determines whether performance info will be included in the footer of the standard theme (and some other themes). Performance info includes the time for the page to load, the amount of memory used to generate the page, cpu usage, load, and the record cache hit/miss ration.&lt;br /&gt;
&lt;br /&gt;
If you add&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
define(&#039;MDL_PERF&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFDB&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFTOLOG&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFTOFOOT&#039;, true);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
to your config.php file, then it will also count database queries. (This has to be in config.php, because Moodle starts doing DB queries before it loads the config information in the database!&lt;br /&gt;
&lt;br /&gt;
===Show origin of language strings===&lt;br /&gt;
Helps translators.&lt;br /&gt;
&lt;br /&gt;
===Show validator links===&lt;br /&gt;
Be careful, read the warning.&lt;br /&gt;
&lt;br /&gt;
===Show page information===&lt;br /&gt;
To show page information printed in the page footer.&lt;br /&gt;
&lt;br /&gt;
==What to do if you cannot get to the admin screens==&lt;br /&gt;
&lt;br /&gt;
If the error is stopping you even getting to the admin screens to turn on debugging, then you can set the debugging setting manually.&lt;br /&gt;
&lt;br /&gt;
===Try typing the URL directly===&lt;br /&gt;
&lt;br /&gt;
The debug settings are at the URL &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://.../admin/settings.php?section=debugging&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; on your server. Sometimes that URL will work, even though the pages you need to go to to get there (for example the site front page) do not. So it is worth trying to enter that URL directly.&lt;br /&gt;
&lt;br /&gt;
===In config.php===&lt;br /&gt;
&lt;br /&gt;
In moodle/config.php you can add the lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;debug = 2047; &lt;br /&gt;
$CFG-&amp;gt;debugdisplay = 1;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or even more debugging messages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;debug = 6143; &lt;br /&gt;
$CFG-&amp;gt;debugdisplay = 1;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.0 the possible settings are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// Force a debugging mode regardless the settings in the site administration&lt;br /&gt;
// @error_reporting(1023);  // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
@ini_set(&#039;display_errors&#039;, &#039;1&#039;); // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
$CFG-&amp;gt;debug = 38911;  // DEBUG_DEVELOPER // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
// for Moodle 2.3, use: $CFG-&amp;gt;debug = 32767; &lt;br /&gt;
$CFG-&amp;gt;debugdisplay = true;   // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
&lt;br /&gt;
// You can specify a comma separated list of user ids that that always see&lt;br /&gt;
// debug messages, this overrides the debug flag in $CFG-&amp;gt;debug and $CFG-&amp;gt;debugdisplay&lt;br /&gt;
// for these users only.&lt;br /&gt;
$CFG-&amp;gt;debugusers = &#039;2&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember to remove those lines again when you have finished diagnosing your problem.&lt;br /&gt;
&lt;br /&gt;
===In the database===&lt;br /&gt;
&lt;br /&gt;
Using a tool like phpMyAdmin, execute the following SQL commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
UPDATE mdl_config SET value = 2047 WHERE name = &#039;debug&#039;;&lt;br /&gt;
UPDATE mdl_config SET value = 1 WHERE name = &#039;debugdisplay&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To turn it back off, use the admin screens, or the commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
UPDATE mdl_config SET value = 0 WHERE name = &#039;debug&#039;;&lt;br /&gt;
UPDATE mdl_config SET value = 0 WHERE name = &#039;debugdisplay&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(If you use a different database prefix, you will need to adjust those commands accordingly.)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Developers can also use [http://xdebug.org/ XDEBUG] (Installed as a module on the Apache server) to further dig into the code, step by step using an [http://xdebug.org/docs/remote XDEBUG client application]. Probably, as part of their favorite IDE. For example: [http://php.netbeans.org/ NetBeans], [http://www.jetbrains.com/phpstorm/ phpStorm] or...&lt;br /&gt;
&lt;br /&gt;
[[fr:Débogage]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Debugging&amp;diff=99360</id>
		<title>Debugging</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Debugging&amp;diff=99360"/>
		<updated>2012-07-20T15:40:10Z</updated>

		<summary type="html">&lt;p&gt;Brianking: /* In config.php */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Developer tools}}&lt;br /&gt;
Debugging messages can be enabled by an administrator in &#039;&#039;Settings &amp;gt; Site administration &amp;gt; Development &amp;gt; Debugging&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Debugging messages are intended to help diagnose problems and/or help Moodle developers. If you have a problem with your Moodle site and ask for help in a Moodle.org forum, a developer may ask you to turn debug messages on, in order to locate the cause of the problem. By default Moodle does not show any error messages at all. If you are having problems (e.g. blank screens or incomplete screens) turning on debugging is usually the first thing to try. &lt;br /&gt;
&lt;br /&gt;
==Debugging settings==&lt;br /&gt;
Here are the settings on the Debugging page:&lt;br /&gt;
&lt;br /&gt;
===Debug messages===&lt;br /&gt;
The default is none, your choices are:&lt;br /&gt;
&lt;br /&gt;
;NONE : Do not show any errors or warnings (Default) &lt;br /&gt;
;ALL : Show all reasonable PHP debug messages&lt;br /&gt;
;MINIMAL : Show only fatal errors&lt;br /&gt;
;NORMAL : Show warnings, errors and notices&lt;br /&gt;
;DEVELOPER : extra Moodle debug messages for developers&lt;br /&gt;
&lt;br /&gt;
There is rarely any advantage in going to Developer level, unless you are a developer, in which case it is strongly recommended.&lt;br /&gt;
&lt;br /&gt;
Once you have got the error message, and copied and pasted it somewhere.  HIGHLY RECOMMENDED to turn Debug back to NONE. Debug messages can give clues to a hacker as to the setup of your site.&lt;br /&gt;
&lt;br /&gt;
===Display debug messages===&lt;br /&gt;
&lt;br /&gt;
There is an option to choose whether to display error messages or simply record them in the server logs.&lt;br /&gt;
&lt;br /&gt;
===Debug email sending===&lt;br /&gt;
&lt;br /&gt;
Determines whether or not to enable verbose debug information during sending of email messages to SMTP server.&lt;br /&gt;
&lt;br /&gt;
===Performance info===&lt;br /&gt;
&lt;br /&gt;
The Performance info option determines whether performance info will be included in the footer of the standard theme (and some other themes). Performance info includes the time for the page to load, the amount of memory used to generate the page, cpu usage, load, and the record cache hit/miss ration.&lt;br /&gt;
&lt;br /&gt;
If you add&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
define(&#039;MDL_PERF&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFDB&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFTOLOG&#039;, true);&lt;br /&gt;
define(&#039;MDL_PERFTOFOOT&#039;, true);&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
to your config.php file, then it will also count database queries. (This has to be in config.php, because Moodle starts doing DB queries before it loads the config information in the database!&lt;br /&gt;
&lt;br /&gt;
===Show origin of language strings===&lt;br /&gt;
Helps translators.&lt;br /&gt;
&lt;br /&gt;
===Show validator links===&lt;br /&gt;
Be careful, read the warning.&lt;br /&gt;
&lt;br /&gt;
===Show page information===&lt;br /&gt;
To show page information printed in the page footer.&lt;br /&gt;
&lt;br /&gt;
==What to do if you cannot get to the admin screens==&lt;br /&gt;
&lt;br /&gt;
If the error is stopping you even getting to the admin screens to turn on debugging, then you can set the debugging setting manually.&lt;br /&gt;
&lt;br /&gt;
===Try typing the URL directly===&lt;br /&gt;
&lt;br /&gt;
The debug settings are at the URL &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://.../admin/settings.php?section=debugging&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; on your server. Sometimes that URL will work, even though the pages you need to go to to get there (for example the site front page) do not. So it is worth trying to enter that URL directly.&lt;br /&gt;
&lt;br /&gt;
===In config.php===&lt;br /&gt;
&lt;br /&gt;
In moodle/config.php you can add the lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;debug = 2047; &lt;br /&gt;
$CFG-&amp;gt;debugdisplay = 1;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or even more debugging messages:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;debug = 6143; &lt;br /&gt;
$CFG-&amp;gt;debugdisplay = 1;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Moodle 2.0 the possible settings are as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code php&amp;gt;&lt;br /&gt;
// Force a debugging mode regardless the settings in the site administration&lt;br /&gt;
// @error_reporting(1023);  // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
@ini_set(&#039;display_errors&#039;, &#039;1&#039;); // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
$CFG-&amp;gt;debug = 38911;  // DEBUG_DEVELOPER // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
// for Moodle 2.3, use:&lt;br /&gt;
// $CFG-&amp;gt;debug = 32767; &lt;br /&gt;
$CFG-&amp;gt;debugdisplay = true;   // NOT FOR PRODUCTION SERVERS!&lt;br /&gt;
&lt;br /&gt;
// You can specify a comma separated list of user ids that that always see&lt;br /&gt;
// debug messages, this overrides the debug flag in $CFG-&amp;gt;debug and $CFG-&amp;gt;debugdisplay&lt;br /&gt;
// for these users only.&lt;br /&gt;
$CFG-&amp;gt;debugusers = &#039;2&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember to remove those lines again when you have finished diagnosing your problem.&lt;br /&gt;
&lt;br /&gt;
===In the database===&lt;br /&gt;
&lt;br /&gt;
Using a tool like phpMyAdmin, execute the following SQL commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
UPDATE mdl_config SET value = 2047 WHERE name = &#039;debug&#039;;&lt;br /&gt;
UPDATE mdl_config SET value = 1 WHERE name = &#039;debugdisplay&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To turn it back off, use the admin screens, or the commands:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code sql&amp;gt;&lt;br /&gt;
UPDATE mdl_config SET value = 0 WHERE name = &#039;debug&#039;;&lt;br /&gt;
UPDATE mdl_config SET value = 0 WHERE name = &#039;debugdisplay&#039;;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(If you use a different database prefix, you will need to adjust those commands accordingly.)&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* Developers can also use [http://xdebug.org/ XDEBUG] (Installed as a module on the Apache server) to further dig into the code, step by step using an [http://xdebug.org/docs/remote XDEBUG client application]. Probably, as part of their favorite IDE. For example: [http://php.netbeans.org/ NetBeans], [http://www.jetbrains.com/phpstorm/ phpStorm] or...&lt;br /&gt;
&lt;br /&gt;
[[fr:Débogage]]&lt;/div&gt;</summary>
		<author><name>Brianking</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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/310/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>
</feed>