<?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=GregLyon</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=GregLyon"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/Special:Contributions/GregLyon"/>
	<updated>2026-04-18T11:19:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development:XMLDB_defining_an_XML_structure&amp;diff=22425</id>
		<title>Development:XMLDB defining an XML structure</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development:XMLDB_defining_an_XML_structure&amp;diff=22425"/>
		<updated>2007-04-16T17:11:43Z</updated>

		<summary type="html">&lt;p&gt;GregLyon: /* The XMLDB editor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Development:XMLDB Documentation|XMLDB Documentation]] &amp;gt; [[Development:XMLDB roadmap|Roadmap]] &amp;gt; Defining one XML structure&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Justification ==&lt;br /&gt;
&lt;br /&gt;
Before Moodle 1.7, all the DB install and upgrade was developed twice (once to handle MySQL installations and another to handle PostgreSQL installations). This approach, although working, has caused some headaches in the past, mainly because it was really difficult to keep both lines of development 100% on sync. Some developers do they work against one RDBMS and it was complex to develop to the other one (two test environments, skills on both databases, slower development cycle...). And all this was happening with &#039;&#039;only&#039;&#039; two supported RDBMS!&lt;br /&gt;
&lt;br /&gt;
One of the main objectives of Moodle 1.7 is to extend the the number of supported RDBMS to other flavours (more exactly, to Oracle and MSSQL). And the old approach (one line of development for each DB) could become an absolute nightmare. &lt;br /&gt;
&lt;br /&gt;
Because of this we have planned to build one structure to define all the DB objects used by Moodle. This structure will provide the necessary level of abstraction to be shared by all the RDBMS systems, so the &amp;quot;multiple lines of development&amp;quot; explained in the previous paragraph will be out forever, giving us one robust and well defined way to handle DB objects independently of the exact RDBMS being used.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
Initially all our best wishes were to use the [http://phplens.com/lens/adodb/docs-datadict.htm#xmlschema AdoDB XML Schema]. As Moodle is using ADOdb libraries to communicate with databases it sounded like the natural approach to solve the problem. But, finally, two reasons prevented us to use it:&lt;br /&gt;
&lt;br /&gt;
# Although working, it seems to be one feature in progress, with important changes/evolutions arriving at the time of write this document.&lt;br /&gt;
# Its lack of support for &amp;quot;prefixes&amp;quot; (one Moodle key feature, to allow multiple instances to run in the same server), would force us to create some awful tricks to generate the objects.&lt;br /&gt;
&lt;br /&gt;
So, finally, we decided to build our own XML files, with everything we need to define every object present in the DB.&lt;br /&gt;
&lt;br /&gt;
== The XMLDB editor ==&lt;br /&gt;
&lt;br /&gt;
Although the XML is pretty simple to read (and to write), one of the major drawbacks was its easy and error-prone adoption by the developers. Also some problems with versioning systems getting crazy with XML files (thanks ML!) pointed us to the requirement to use one high-density format (it means, physically &#039;&#039;&#039;long lines&#039;&#039;&#039;) in our XML files. &lt;br /&gt;
&lt;br /&gt;
After some intense thoughts we decided to build one specialised editor for our XML format. This editor should be easy to use and provide support for all the objects present one Moodle DB. And it&#039;s done (and will support future enhancements easily, we hope).&lt;br /&gt;
&lt;br /&gt;
The XMLDB Editor makes the edition of tables/fields/keys/indexes practically a trivial task, allowing the developer to spend  the time coding and improving things instead of fighting against XML files and the errors caused by manual editing (of course, the developer is free to use such extra-time as desired, beers, dance, books, music...) ;-)&lt;br /&gt;
&lt;br /&gt;
All the new &#039;&#039;&#039;install.xml&#039;&#039;&#039; files, present under each &#039;&#039;&#039;db&#039;&#039;&#039; directory in Moodle can be edited (and we recommend it) with just some clicks and keystrokes. Those &#039;&#039;&#039;install.xml&#039;&#039;&#039; will contain all the info needed to generate the specific objects needed for each RDBMS supported. Obviously, such files, are the neutral replacement for all the *.sql files used until now.&lt;br /&gt;
&lt;br /&gt;
=== Launching ===&lt;br /&gt;
&lt;br /&gt;
Just login to your server as an administrator and, under the Miscellaneous tab of the Administration Block, you&#039;ll see a new link pointing to the &amp;quot;XMLDB Editor&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
One &#039;&#039;&#039;important note&#039;&#039;&#039; is that, to be able to handle files properly, the web server needs write access to all those &amp;quot;db&amp;quot; directories where the &amp;quot;install.xml&amp;quot; files reside (and to the files themselves, of course). ;-)&lt;br /&gt;
&lt;br /&gt;
That&#039;s all!&lt;br /&gt;
&lt;br /&gt;
=== Use===&lt;br /&gt;
&lt;br /&gt;
We really think the XMLDB Editor is pretty easy to use, so here you won&#039;t see a complete guide to use it. We highly recommend you to play with it for a while, viewing how it works and how it modifies the &#039;&#039;&#039;install.xml&#039;&#039;&#039; files.&lt;br /&gt;
&lt;br /&gt;
It&#039;s organised in a top-botton structure, where you start &#039;&#039;&#039;loading&#039;&#039;&#039; (or &#039;&#039;&#039;creating&#039;&#039;&#039;) a new XMLDB file. Then, you can &#039;&#039;&#039;edit&#039;&#039;&#039; such file and its &#039;&#039;&#039;general structure&#039;&#039;&#039; will be showed. This structure have two type of elements, &#039;&#039;&#039;tables&#039;&#039;&#039; and &#039;&#039;&#039;statements&#039;&#039;&#039; and the XMLDB Editor allows you to &#039;&#039;&#039;add&#039;&#039;&#039;, &#039;&#039;&#039;edit&#039;&#039;&#039;, &#039;&#039;&#039;delete&#039;&#039;&#039;, and &#039;&#039;&#039;move&#039;&#039;&#039; them easily. Also, for initial creation of tables, one small but effective &#039;&#039;&#039;reverse-enginery&#039;&#039;&#039; tool has been developed (only under MySQL) allowing you to retrofit any table from the DB to the XMLDB Editor.&lt;br /&gt;
&lt;br /&gt;
While editing tables you will see their &#039;&#039;&#039;fields&#039;&#039;&#039;, &#039;&#039;&#039;keys&#039;&#039;&#039; and &#039;&#039;&#039;indexes&#039;&#039;&#039; and you&#039;ll be able to handle all them easily. Note that some fields can be no-editable. It uses to be because they are being used in some way (part of one key or index) and the idea is to warn you about that.&lt;br /&gt;
&lt;br /&gt;
Fields can be edited and you can specify their &#039;&#039;&#039;name&#039;&#039;&#039;, &#039;&#039;&#039;type&#039;&#039;&#039;, &#039;&#039;&#039;length&#039;&#039;&#039;, &#039;&#039;&#039;decimals&#039;&#039;&#039;, &#039;&#039;&#039;null-ability&#039;&#039;&#039;, &#039;&#039;&#039;defaults&#039;&#039;&#039; and so one. Exactly the same for both &#039;&#039;&#039;keys&#039;&#039;&#039; and &#039;&#039;&#039;indexes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
While editing statements, you must think about them like &amp;quot;collections of sentences&amp;quot;. Once you select the &#039;&#039;&#039;type&#039;&#039;&#039; (only inserts are allowed for now) and &#039;&#039;&#039;table&#039;&#039;&#039; you are interested you&#039;ll be able to introduce the exact values easily, being able to &#039;&#039;&#039;duplicate&#039;&#039;&#039; them easily to gain some speed if you have a lot of sentences in your development. Sentences can be &#039;&#039;&#039;edited&#039;&#039;&#039; and &#039;&#039;&#039;deleted&#039;&#039;&#039; easily too.&lt;br /&gt;
&lt;br /&gt;
One interesting feature is that all the XMLDB Editor pages allow you to enter one &#039;&#039;&#039;comment&#039;&#039;&#039; about the item being modified (table, index, key, field, statement...). Use it at your entire needs, sure it helps other developers to understand a bit more the DB model.&lt;br /&gt;
&lt;br /&gt;
Please, don&#039;t forget to read and understand the next section, where we talk about &#039;&#039;&#039;some important guidelines&#039;&#039;&#039; to create and handle XMLDB files.&lt;br /&gt;
&lt;br /&gt;
== Conventions ==&lt;br /&gt;
&lt;br /&gt;
Apart of the [[Coding#Database_structures| Database Structures guidelines]], some more conventions should be followed:&lt;br /&gt;
&lt;br /&gt;
# About names:&lt;br /&gt;
## All lowercase names (tables, indexes, keys and fields).&lt;br /&gt;
## Table names and field names must use only a-z, 0-9 and _ chars.&lt;br /&gt;
## Key and index names under the XMLDB Files must be formed by concatenating the name of the fields present in the key/index with the &#039;&amp;quot;-&amp;quot; (minus) character.&lt;br /&gt;
## Primary key always must be named &amp;quot;primary&amp;quot; (this is one exception to the previous convention).&lt;br /&gt;
## It&#039;s highly recommended to avoid [[XMLDB_reserved_words|reserved words]] completely. We know we have some of them now but they should be completely out for next releases.&lt;br /&gt;
# About NULLS&lt;br /&gt;
## Avoid to create all the fields as NOT NULL with the &#039;&#039;silly&#039;&#039; default value &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt; (empty string). The underlying code used to create tables will handle it properly but the XMLDB structure must be REAL. Read more in the [[XMLDB Problems#NOT NULL fields using a DEFAULT &amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt; clause|Problems Page]].&lt;br /&gt;
# About FOREIGN KEYS&lt;br /&gt;
## Under the tables of every XMLDB file, you must define the existing &#039;&#039;&#039;Foreign Keys&#039;&#039;&#039; (FK) properly. This will allow everybody to know a bit better the structure, allow to evolve to a better constrained system in the future and will provide the underlying code with the needed info to create the proper indexes. &lt;br /&gt;
## Note that, if you define any field combination as FK you won&#039;t have to create any index on that fields, the code will do it automatically! &lt;br /&gt;
## This convention is only applicable for relations INSIDE one file. Don&#039;t generate FK constraints against other files (courseid, userid), use indexes there.&lt;br /&gt;
## Respect Convention 1.3&lt;br /&gt;
# About UNIQUE KEYS&lt;br /&gt;
## Declare any fields as UNIQUE KEY (UK) only if they are going to be used as target for one FK. Create unique indexes instead.&lt;br /&gt;
## Respect Convention 1.3&lt;br /&gt;
&lt;br /&gt;
== One example: the assignment module ==&lt;br /&gt;
&lt;br /&gt;
Here we are going to examine the [http://moodle.cvs.sourceforge.net/moodle/moodle/mod/assignment/db/install.xml?view=markup current implementation of the XMLDB Schema for the assignment module] (a simple one). It has been completely generated with the XMLDB Editor but it&#039;s nice to know a bit more about the XML internals.&lt;br /&gt;
&lt;br /&gt;
As you can see the structure is pretty simple:&lt;br /&gt;
&lt;br /&gt;
* XMLDB&lt;br /&gt;
** TABLES, one or more, each one with&lt;br /&gt;
*** FIELDS&lt;br /&gt;
*** KEYS&lt;br /&gt;
*** INDEXES&lt;br /&gt;
** STATEMENTS, none or more, each one with&lt;br /&gt;
*** SENTENCES&lt;br /&gt;
&lt;br /&gt;
First of all you should note that all the elements contain the &#039;&#039;&#039;PREVIOUS&#039;&#039;&#039; and &#039;&#039;&#039;NEXT&#039;&#039;&#039; attributes. They allow us to keep everything ordered although it isn&#039;t meaningful at all from the RDBMS perspective. Also the &#039;&#039;&#039;COMMENT&#039;&#039;&#039; field is present everywhere to be used as desired.&lt;br /&gt;
&lt;br /&gt;
=== The TABLE element ===&lt;br /&gt;
&lt;br /&gt;
We can ignore the TABLE element, as it&#039;s simply one container for the internals (FIELDS, KEYS and INDEXES). Let&#039;s go to examine them a bit more:&lt;br /&gt;
&lt;br /&gt;
==== The FIELD element ====&lt;br /&gt;
&lt;br /&gt;
It maps with one field in the DB (obviously). For each field you can define its &#039;&#039;&#039;name&#039;&#039;&#039;, &#039;&#039;&#039;type&#039;&#039;&#039; (from a list of [[XMLDB column types|neutral types]]), &#039;&#039;&#039;length&#039;&#039;&#039;, &#039;&#039;&#039;decimals&#039;&#039;&#039; (for some types), &#039;&#039;&#039;notnull&#039;&#039;&#039; (true/false), &#039;&#039;&#039;unsigned&#039;&#039;&#039; (true/false), &#039;&#039;&#039;sequence&#039;&#039;&#039; (if it&#039;s autonumeric or serial, true/false), &#039;&#039;&#039;enum&#039;&#039;&#039; (true/false), &#039;&#039;&#039;enumvalues&#039;&#039;&#039; (the list of values if the field has been declared as enum, for example &amp;lt;tt&amp;gt;&#039;frog&#039;,&#039;toad&#039;,&#039;newt&#039;&amp;lt;/tt&amp;gt;) and &#039;&#039;&#039;default&#039;&#039;&#039; (to assign a default value).&lt;br /&gt;
&lt;br /&gt;
So, in our example, we have two tables, assignment and assignment_submissions, each one with its own fields, defining all the information related above. Please note that naming conventions are followed.&lt;br /&gt;
&lt;br /&gt;
==== The KEY element ====&lt;br /&gt;
&lt;br /&gt;
Here is where all the PRIMARY KEYS (PK), UNIQUE KEYS (UK) and FOREIGN KEYS (FK) will be defined. For each key we define its &#039;&#039;&#039;name&#039;&#039;&#039;, &#039;&#039;&#039;type&#039;&#039;&#039;, &#039;&#039;&#039;fields&#039;&#039;&#039; (that belongs to it) and optionally (if the key is one FK) the target &#039;&#039;&#039;reftable&#039;&#039;&#039; and &#039;&#039;&#039;reffields&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In our example, the assignment table has one (mandatory!) PK (called, &amp;quot;primary&amp;quot;, rules are rules) built with the &amp;quot;id&amp;quot; field. &lt;br /&gt;
&lt;br /&gt;
The other table, the &amp;quot;assignment_submissions&amp;quot; one, also has its PK (called &amp;quot;primary&amp;quot; once more) and one FK, with the field &amp;quot;assignment&amp;quot; pointing to the field &amp;quot;id&amp;quot; of the table &amp;quot;assignment&amp;quot;. Note that the FK follows the name conventions and its name is, simply, the name of the fields being part of it (&amp;quot;assignment&amp;quot;). Also, the FK has as target to one PK of the same module.&lt;br /&gt;
&lt;br /&gt;
Finally, note that there isn&#039;t any index created for all these keys. Moodle will generate them automatically when the table is created. All the keys will have their corresponding index. Point. ;-)&lt;br /&gt;
&lt;br /&gt;
==== The INDEX element ====&lt;br /&gt;
&lt;br /&gt;
Where all the indexes will be defined. For each index you can define its &#039;&#039;&#039;name&#039;&#039;&#039;, &#039;&#039;&#039;unique&#039;&#039;&#039; (true/false) and the &#039;&#039;&#039;fields&#039;&#039;&#039; that conform it. Please note that naming conventions are followed.&lt;br /&gt;
&lt;br /&gt;
Also, some &amp;quot;obvious index&amp;quot;, like the one based in the &amp;quot;assignment&amp;quot; field of the &amp;quot;assignment_submissions&amp;quot; table doesn&#039;t exist. Yes, you know why: Because such column has been defined as a FK and the index will be automatically created (see previous section).&lt;br /&gt;
&lt;br /&gt;
=== The STATEMENT element ===&lt;br /&gt;
&lt;br /&gt;
This is the other &#039;&#039;&#039;big container&#039;&#039;&#039; in the XMLDB Schema (at the same level as the &#039;&#039;&#039;TABLES&#039;&#039;&#039; one) and we can define its &#039;&#039;&#039;name&#039;&#039;&#039;, &#039;&#039;&#039;type&#039;&#039;&#039; (only insert allowed for now) and &#039;&#039;&#039;table&#039;&#039;&#039; (against the sentences will be executed).&lt;br /&gt;
&lt;br /&gt;
Every statement is a collection of &#039;&#039;&#039;sentences&#039;&#039;&#039; &lt;br /&gt;
&lt;br /&gt;
==== The SENTENCE element ====&lt;br /&gt;
&lt;br /&gt;
Each sentence implies one simple action to be performed against the DB and it can be defined as the &amp;quot;missing part of the SQL statement&amp;quot;. In our example, we have one statement, of type &amp;quot;insert&amp;quot; on table &amp;quot;log_display&amp;quot;. With this Moodle knows the initial part of the sentence, i.e:&lt;br /&gt;
&lt;br /&gt;
 INSERT INTO log_display &lt;br /&gt;
&lt;br /&gt;
and then the text will be added to create this:&lt;br /&gt;
&lt;br /&gt;
 INSERT INTO log_display &lt;br /&gt;
   (module, action, mtable, field) &lt;br /&gt;
 VALUES &lt;br /&gt;
   (&#039;assignment&#039;, &#039;view&#039;, &#039;assignment&#039;, &#039;name&#039;)&lt;br /&gt;
&lt;br /&gt;
There is one important trick when handling sentences, although they aren&#039;t in the assignment example. Take a look to the [http://moodle.cvs.sourceforge.net/*checkout*/moodle/moodle/lib/db/install.xml Core Tables XML Schema] (it&#039;s a huge one!). If you go near the end, to the statements section, you will see some sentences like this:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;SENTENCE TEXT=&amp;quot;....VALUES (&#039;user&#039;, &#039;view&#039;, &#039;user&#039;, &#039;CONCAT(firstname,&amp;quot; &amp;quot;,lastname)&#039;)&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Such &amp;quot;CONCAT&amp;quot; function isn&#039;t standard at all (only MySQL supports it), but don&#039;t worry, we&#039;ll transform it to the correct concatenation operators for other RDBMS. Just be sure to use the syntax showed above.&lt;br /&gt;
&lt;br /&gt;
== DTD and XML schema ==&lt;br /&gt;
&lt;br /&gt;
Not sure if this will be usable for somebody but here you can find one [http://moodle.cvs.sourceforge.net/moodle/moodle/lib/xmldb/xmldb.dtd?view=markup automatically generated DTD] for the XMLDB files. Also one [http://moodle.cvs.sourceforge.net/moodle/moodle/lib/xmldb/xmldb.xsd?view=markup automatically generated XML Schema] is available. Any improvement/fix to them will be welcome!&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[XMLB List of files to create|List of files to create]]: The list of files to be created from scratch. Used to follow the progress.&lt;br /&gt;
* http://www.hitsw.com/xml_utilites/: One online XML-DTD-Schema converter.&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:XMLDB]]&lt;/div&gt;</summary>
		<author><name>GregLyon</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development:Question_type_plugin_how_to&amp;diff=21925</id>
		<title>Development:Question type plugin how to</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development:Question_type_plugin_how_to&amp;diff=21925"/>
		<updated>2007-03-29T20:29:17Z</updated>

		<summary type="html">&lt;p&gt;GregLyon: /* Getting started */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Quiz developer docs}}&lt;br /&gt;
To follow this guide, you need to get hold of the qtype_NEW plugin template. You can get it from CVS in the contrib area or from the [http://moodle.org/mod/data/view.php?id=6009 modules and plugins database]. The rest of this guide is just a copy of the README.txt file from in there. (Or is the readme file a copy of this page?)&lt;br /&gt;
&lt;br /&gt;
==New question type template README file==&lt;br /&gt;
&lt;br /&gt;
Welcome to the new question type template.&lt;br /&gt;
&lt;br /&gt;
This blank skeleton is a good place to start if you want to implement your own Moodle question type plugin.&lt;br /&gt;
&lt;br /&gt;
Another good way to start is by looking at an existing question type that has good documentation in the code like TODO (if there is one, otherwise we&#039;ll hope that Tims will &amp;quot;light the way&amp;quot; :-) )&lt;br /&gt;
&lt;br /&gt;
The latest version of the template can be found in CVS in http://moodle.cvs.sourceforge.net/moodle/contrib/plugins/question/type/TEMPLATE/ (was in contrib/qtype_NEW module). Because you want your own copy do a cvs export, not a cvs checkout. The package can also been downloaded from [http://moodle.org/mod/data/view.php?d=13&amp;amp;rid=443 the Modules and plugins database].&lt;br /&gt;
&lt;br /&gt;
The latest version of this help can be read (nicely formatted) at  https://docs.moodle.org/en/How_to_write_a_question_type_plugin&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING, THIS TEMPLATE IS NOT COMPLETE YET!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Getting started==&lt;br /&gt;
&lt;br /&gt;
Before you get to the interesting bit, you need to do a bit of file-renaming and search-and-replacing to turn this generic template into your own question type. You need to have chosen two things &lt;br /&gt;
&lt;br /&gt;
;The identifier for your question type&lt;br /&gt;
:This is a string of lowercase letters and perhaps underscores that the Moodle code  uses to refer to your question type. This needs to be unique, so perhaps start it with your initials. For example, all the quetions types I create while working at the OU will be referred to as ou_something. For the rest of these instructions, I will assume you have chosen &#039;myqtypeidentifier&#039;.&lt;br /&gt;
;The name of your question type&lt;br /&gt;
:This is the name that people will see in the Moodle User-interface (in the English translation). For these instructions I will assume you have chosen  &#039;My Question Type Name&#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;NOTE:&amp;lt;/strong&amp;gt; depending on where you got the template, some of the files and folders may be called TEMPLATE instead of QTYPEID.  The contents of the files will still contain the text QTYPEID in either case.&lt;br /&gt;
&lt;br /&gt;
Then you need to&lt;br /&gt;
&lt;br /&gt;
# Rename the directory question/type/QTYPEID to question/type/myqtypeidentifier.&lt;br /&gt;
# Rename the language file lang/en_utf8/qtype_QTYPEID.html to  lang/en_utf8/qtype_myqtypeidentifier.html&lt;br /&gt;
# Rename the help file lang/en_utf8/help/quiz/QTYPEID.html to  lang/en_utf8/help/quiz/myqtypeidentifier.html&lt;br /&gt;
# Search and replace &#039;QTYPEID&#039; with &#039;myqtypeidentifier&#039; in all the files. You should find:&lt;br /&gt;
#* 2 occurrences in the language file&lt;br /&gt;
#* 1 occurrence in db/install.xml&lt;br /&gt;
#* 5 occurrences in simpletest/testquestiontype.php&lt;br /&gt;
#* 3 occurrences in editquestion.html&lt;br /&gt;
#* 1 occurrence in editquestion.php&lt;br /&gt;
#* 3 occurrences in questiontype.php&lt;br /&gt;
# Search and replace &#039;QTYPENAME&#039; with &#039;My Question Type Name&#039; in all the files. You should find:&lt;br /&gt;
#* 1 occurrence in the help file&lt;br /&gt;
#* 3 occurrences in the language file&lt;br /&gt;
#* 2 occurrences in questiontype.php&lt;br /&gt;
# Search and replace YOURNAME with your name. (This is only in the comments at  the top of each file so it is not critical, but surely you want to take credit for your work.) You should find one occurrence in:&lt;br /&gt;
#* the language file.&lt;br /&gt;
#* simpletest/testquestiontype.php&lt;br /&gt;
#* editquestion.html&lt;br /&gt;
#* editquestion.php&lt;br /&gt;
#* questiontype.php&lt;br /&gt;
# Search and replace YOUREMAILADDRESS with your email address. (Again, this is only in the file header comments, but it is helpful if people can contact you if they have any questions about your code.) You should find:&lt;br /&gt;
#*  There should be one occurrence of YOUREMAILADDRESS in each of the files listed under YOURNAME.&lt;br /&gt;
# Search and replace YOURPACKAGENAME with a package name for your code. This is used by PHPdoc when building the documentation for your classes. I suggest you make up one package name for all the question types you write. For example all the question types I write are in the package ou_questiontypes.&lt;br /&gt;
#* There should be one occurrence of YOURPACKAGENAME in each of the files listed under YOURNAME.&lt;br /&gt;
# Edit icon.gif to make an icon that represents your question type.&lt;br /&gt;
&lt;br /&gt;
Finally, so you can test your code while working on it, you need to copy the lang and question folders on top of the folders in your Moodle test installation. This copy should not ovewrite any existing files. It should just add some new files and folders to that directory tree.&lt;br /&gt;
&lt;br /&gt;
==Now for the interesting bit==&lt;br /&gt;
&lt;br /&gt;
Now you need to write the code to&lt;br /&gt;
&lt;br /&gt;
# Create any database tables you need. This works just like normal in Moodle with the files in the db directory and the version.php file. If you don&#039;t need to create any database tables, you can delete the db directory.&lt;br /&gt;
# Create the editing form for you question type, and the code to populate it.  That means adding code to the files editquestion.html and editquestion.php.&lt;br /&gt;
# Create the template that will display the question to the student. This is in display.html. To make good flexible formating you should use CSS classes and use already existing ones when possible. An easy way to find which existing CSS classes exist is TODO&lt;br /&gt;
# Implement the rest of the question type class. This is in questiontype.php. You need to &lt;br /&gt;
## TODO finish writing this section.&lt;br /&gt;
# Make sure that the language file contains all the strings you refer to. Note that some of the strings you want may already be in the qtype_base.php and moodle.php language files in Moodle core. If so, use the existing strings. An easy way to find the existing strings is TODO&lt;br /&gt;
# Write the help file for your question type, and any other help files you need.&lt;br /&gt;
# Write a set of unit tests for you question type.&lt;br /&gt;
&lt;br /&gt;
All the places in the code where you need to do things are marked TODO, and there are comments right there giving more detailed instructions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note that these comments are not complete or accurate yet. I have only just started implementing my own question type, and I will be filling in those comments and finishing this document as I go along.&#039;&#039;--[[User:Tim Hunt|Tim Hunt]] 16:29, 25 August 2006 (CDT)&lt;br /&gt;
&lt;br /&gt;
==When you have finished==&lt;br /&gt;
&lt;br /&gt;
Consider checking your question type into the contrib area of  the Moodle CVS server (if you have access) so that other people can share it.&lt;br /&gt;
&lt;br /&gt;
Add your new question type to the [http://moodle.org/mod/data/view.php?id=6009 modules and plugins database].&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Quiz]]&lt;/div&gt;</summary>
		<author><name>GregLyon</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development:Question_type_plugin_how_to&amp;diff=21924</id>
		<title>Development:Question type plugin how to</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development:Question_type_plugin_how_to&amp;diff=21924"/>
		<updated>2007-03-29T20:19:51Z</updated>

		<summary type="html">&lt;p&gt;GregLyon: /* New question type template README file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Quiz developer docs}}&lt;br /&gt;
To follow this guide, you need to get hold of the qtype_NEW plugin template. You can get it from CVS in the contrib area or from the [http://moodle.org/mod/data/view.php?id=6009 modules and plugins database]. The rest of this guide is just a copy of the README.txt file from in there. (Or is the readme file a copy of this page?)&lt;br /&gt;
&lt;br /&gt;
==New question type template README file==&lt;br /&gt;
&lt;br /&gt;
Welcome to the new question type template.&lt;br /&gt;
&lt;br /&gt;
This blank skeleton is a good place to start if you want to implement your own Moodle question type plugin.&lt;br /&gt;
&lt;br /&gt;
Another good way to start is by looking at an existing question type that has good documentation in the code like TODO (if there is one, otherwise we&#039;ll hope that Tims will &amp;quot;light the way&amp;quot; :-) )&lt;br /&gt;
&lt;br /&gt;
The latest version of the template can be found in CVS in http://moodle.cvs.sourceforge.net/moodle/contrib/plugins/question/type/TEMPLATE/ (was in contrib/qtype_NEW module). Because you want your own copy do a cvs export, not a cvs checkout. The package can also been downloaded from [http://moodle.org/mod/data/view.php?d=13&amp;amp;rid=443 the Modules and plugins database].&lt;br /&gt;
&lt;br /&gt;
The latest version of this help can be read (nicely formatted) at  https://docs.moodle.org/en/How_to_write_a_question_type_plugin&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING, THIS TEMPLATE IS NOT COMPLETE YET!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Getting started==&lt;br /&gt;
&lt;br /&gt;
Before you get to the interesting bit, you need to do a bit of file-renaming and search-and-replacing to turn this generic template into your own question type. You need to have chosen two things&lt;br /&gt;
&lt;br /&gt;
;The identifier for your question type&lt;br /&gt;
:This is a string of lowercase letters and perhaps underscores that the Moodle code  uses to refer to your question type. This needs to be unique, so perhaps start it with your initials. For example, all the quetions types I create while working at the OU will be referred to as ou_something. For the rest of these instructions, I will assume you have chosen &#039;myqtypeidentifier&#039;.&lt;br /&gt;
;The name of your question type&lt;br /&gt;
:This is the name that people will see in the Moodle User-interface (in the English translation). For these instructions I will assume you have chosen  &#039;My Question Type Name&#039;.&lt;br /&gt;
&lt;br /&gt;
Then you need to&lt;br /&gt;
&lt;br /&gt;
# Rename the directory question/type/QTYPEID to question/type/myqtypeidentifier.&lt;br /&gt;
# Rename the language file lang/en_utf8/qtype_QTYPEID.html to  lang/en_utf8/qtype_myqtypeidentifier.html&lt;br /&gt;
# Rename the help file lang/en_utf8/help/quiz/QTYPEID.html to  lang/en_utf8/help/quiz/myqtypeidentifier.html&lt;br /&gt;
# Search and replace &#039;QTYPEID&#039; with &#039;myqtypeidentifier&#039; in all the files. You should find:&lt;br /&gt;
#* 2 occurrences in the language file&lt;br /&gt;
#* 1 occurrence in db/install.xml&lt;br /&gt;
#* 5 occurrences in simpletest/testquestiontype.php&lt;br /&gt;
#* 3 occurrences in editquestion.html&lt;br /&gt;
#* 1 occurrence in editquestion.php&lt;br /&gt;
#* 3 occurrences in questiontype.php&lt;br /&gt;
# Search and replace &#039;QTYPENAME&#039; with &#039;My Question Type Name&#039; in all the files. You should find:&lt;br /&gt;
#* 1 occurrence in the help file&lt;br /&gt;
#* 3 occurrences in the language file&lt;br /&gt;
#* 2 occurrences in questiontype.php&lt;br /&gt;
# Search and replace YOURNAME with your name. (This is only in the comments at  the top of each file so it is not critical, but surely you want to take credit for your work.) You should find one occurrence in:&lt;br /&gt;
#* the language file.&lt;br /&gt;
#* simpletest/testquestiontype.php&lt;br /&gt;
#* editquestion.html&lt;br /&gt;
#* editquestion.php&lt;br /&gt;
#* questiontype.php&lt;br /&gt;
# Search and replace YOUREMAILADDRESS with your email address. (Again, this is only in the file header comments, but it is helpful if people can contact you if they have any questions about your code.) You should find:&lt;br /&gt;
#*  There should be one occurrence of YOUREMAILADDRESS in each of the files listed under YOURNAME.&lt;br /&gt;
# Search and replace YOURPACKAGENAME with a package name for your code. This is used by PHPdoc when building the documentation for your classes. I suggest you make up one package name for all the question types you write. For example all the question types I write are in the package ou_questiontypes.&lt;br /&gt;
#* There should be one occurrence of YOURPACKAGENAME in each of the files listed under YOURNAME.&lt;br /&gt;
# Edit icon.gif to make an icon that represents your question type.&lt;br /&gt;
&lt;br /&gt;
Finally, so you can test your code while working on it, you need to copy the lang and question folders on top of the folders in your Moodle test installation. This copy should not ovewrite any existing files. It should just add some new files and folders to that directory tree.&lt;br /&gt;
&lt;br /&gt;
==Now for the interesting bit==&lt;br /&gt;
&lt;br /&gt;
Now you need to write the code to&lt;br /&gt;
&lt;br /&gt;
# Create any database tables you need. This works just like normal in Moodle with the files in the db directory and the version.php file. If you don&#039;t need to create any database tables, you can delete the db directory.&lt;br /&gt;
# Create the editing form for you question type, and the code to populate it.  That means adding code to the files editquestion.html and editquestion.php.&lt;br /&gt;
# Create the template that will display the question to the student. This is in display.html. To make good flexible formating you should use CSS classes and use already existing ones when possible. An easy way to find which existing CSS classes exist is TODO&lt;br /&gt;
# Implement the rest of the question type class. This is in questiontype.php. You need to &lt;br /&gt;
## TODO finish writing this section.&lt;br /&gt;
# Make sure that the language file contains all the strings you refer to. Note that some of the strings you want may already be in the qtype_base.php and moodle.php language files in Moodle core. If so, use the existing strings. An easy way to find the existing strings is TODO&lt;br /&gt;
# Write the help file for your question type, and any other help files you need.&lt;br /&gt;
# Write a set of unit tests for you question type.&lt;br /&gt;
&lt;br /&gt;
All the places in the code where you need to do things are marked TODO, and there are comments right there giving more detailed instructions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Note that these comments are not complete or accurate yet. I have only just started implementing my own question type, and I will be filling in those comments and finishing this document as I go along.&#039;&#039;--[[User:Tim Hunt|Tim Hunt]] 16:29, 25 August 2006 (CDT)&lt;br /&gt;
&lt;br /&gt;
==When you have finished==&lt;br /&gt;
&lt;br /&gt;
Consider checking your question type into the contrib area of  the Moodle CVS server (if you have access) so that other people can share it.&lt;br /&gt;
&lt;br /&gt;
Add your new question type to the [http://moodle.org/mod/data/view.php?id=6009 modules and plugins database].&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Quiz]]&lt;/div&gt;</summary>
		<author><name>GregLyon</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development:lib/formslib.php_Usage&amp;diff=21255</id>
		<title>Development:lib/formslib.php Usage</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development:lib/formslib.php_Usage&amp;diff=21255"/>
		<updated>2007-03-09T19:59:02Z</updated>

		<summary type="html">&lt;p&gt;GregLyon: /* Basic Usage in A Normal Page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Formslib}}&lt;br /&gt;
==Usage of Formslib==&lt;br /&gt;
&lt;br /&gt;
There are many phpdoc style comments in lib/formslib.php&lt;br /&gt;
&lt;br /&gt;
course/edit.php and the included course/edit_form.php provide a good example of usage of this library.&lt;br /&gt;
&lt;br /&gt;
Also see the PEAR docs for [http://pear.php.net/package/HTML_QuickForm/ HTML_QuickForm docs] I found this [http://pear.php.net/manual/en/package.html.html-quickform.tutorial.php quick tutorial] and this [http://www.midnighthax.com/quickform.php slightly longer one] particularly useful.&lt;br /&gt;
&lt;br /&gt;
We created some special wrapper functions for moodle. $mform-&amp;gt;get_data() returns null if no data has been submitted or validation fails or returns an object with the contents of the submitted data.&lt;br /&gt;
&lt;br /&gt;
===Basic Usage in A Normal Page===&lt;br /&gt;
&lt;br /&gt;
Generally the structure of a page with a form on it looks like this :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
require_once(&#039;pathtoformdesctiption&#039;);&lt;br /&gt;
//you&#039;ll process some page parameters at the top here and get the info about&lt;br /&gt;
//what instance of your module and what course you&#039;re in etc. Make sure you&lt;br /&gt;
//include hidden variable in your forms which have their defaults set in set_data&lt;br /&gt;
//which pass these variables from page to page&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$mform = new yourmod_formfunction_form();//name of the form you defined in file above.&lt;br /&gt;
//default &#039;action&#039; for form is strip_querystring(qualified_me())&lt;br /&gt;
if ($mform-&amp;gt;is_cancelled()){&lt;br /&gt;
    //you need this section if you have a cancel button on your form&lt;br /&gt;
    //here you tell php what to do if your user presses cancel&lt;br /&gt;
    //probably a redirect is called for!&lt;br /&gt;
} else if ($fromform=$mform-&amp;gt;get_data()){&lt;br /&gt;
//this branch is where you process validated data.&lt;br /&gt;
&lt;br /&gt;
} else {&lt;br /&gt;
// this branch is executed if the form is submitted but the data doesn&#039;t validate and the form should be redisplayed&lt;br /&gt;
// or on the first display of the form.&lt;br /&gt;
    //setup strings for heading&lt;br /&gt;
    print_header_simple($streditinga, &#039;&#039;,&lt;br /&gt;
     &amp;quot;&amp;lt;a href=\&amp;quot;$CFG-&amp;gt;wwwroot/mod/$module-&amp;gt;name/index.php?id=$course-&amp;gt;id\&amp;quot;&amp;gt;$strmodulenameplural&amp;lt;/a&amp;gt; -&amp;gt;&lt;br /&gt;
     $strnav $streditinga&amp;quot;, $mform-&amp;gt;focus(), &amp;quot;&amp;quot;, false);&lt;br /&gt;
    //notice use of $mform-&amp;gt;focus() above which puts the cursor &lt;br /&gt;
    //in the first form field or the first field with an error.&lt;br /&gt;
&lt;br /&gt;
    //call to print_heading_with_help or print_heading? then :&lt;br /&gt;
    &lt;br /&gt;
    //put data you want to fill out in the form into array $toform here then :&lt;br /&gt;
&lt;br /&gt;
    $mform-&amp;gt;set_data($toform);&lt;br /&gt;
    $mform-&amp;gt;display();&lt;br /&gt;
    print_footer($course);&lt;br /&gt;
&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Defining Your Form Class===&lt;br /&gt;
&lt;br /&gt;
The form class tells us about the structure of the form. It is encouraged for you to put this in file called {function}_form.php probably in the same folder in which the page that uses it is located. The name of your class should be {modname}_{funciton}_form eg. forum_post_form or course_edit_form. These classes will extend class moodleform.&lt;br /&gt;
&lt;br /&gt;
Note the name you give the class is used as the id attrbute of your form in html (any trailing &#039;_form&#039; is chopped off&#039;). Your form class name should be unique in order for it to selectable in CSS by theme designers who may want to tweak the css just for that form.&lt;br /&gt;
&lt;br /&gt;
====definition()====&lt;br /&gt;
&lt;br /&gt;
[[Development:lib/formslib.php_Form_Definition|Help is here for defining your form]] by defining a function definition() in your form class that sets up your form structure.&lt;br /&gt;
&lt;br /&gt;
===Use in Activity Modules Add / Update Forms===&lt;br /&gt;
&lt;br /&gt;
Syntax is the same in activity modules to create your update / add page. We are still supporting mod.html but if you want to use the new formslib then you can in Moodle 1.8 just include in your module directory the file mod_form.php instead of mod.html and it will be automatically detected. Inside this file you define a class with class name &#039;{modname}__mod_form&#039; which extends the class &#039;moodleform_mod&#039;. See many examples of the core modules which have been converted to use formslib already.&lt;br /&gt;
&lt;br /&gt;
====defaults_preprocessing====&lt;br /&gt;
&lt;br /&gt;
For activity modules you use the same syntax to define your form. You may also want to override method defaults_preprocessing this can be used to take the data from the data base and tell the form how to fill out defaults in the form with this data. For example in the forum module in forum/mod_form.php we needed to tick an enable check box if a date had been selected in the date select. Normally data is loaded from the database and directly loaded into form fields with the same name as the database record you only need to use defaults_preprocessing if there isn&#039;t this one to one relationship. Another example is the lesson/mod_form.php which takes the data from the database and unserializes it. choice/mod_form.php shows an exampe of loading data from another db table referred to by a foreign key, to include in the form.&lt;br /&gt;
&lt;br /&gt;
====Post Processing Still Done in lib.php Functions====&lt;br /&gt;
&lt;br /&gt;
Post processing of data is done in lib.php functions modname_add_instance and modname_update_instance after the data has been validated. When migrating a from little change needs to be made in the post processing often. An exception is that date and date_time_selector fields automatically have their submitted data turned into timestamps so you don&#039;t need to do this in your add and update functions anymore.&lt;br /&gt;
&lt;br /&gt;
====Automatically Including Standard Activity Module Form Elements====&lt;br /&gt;
&lt;br /&gt;
Standard activity module form elements are automatically included using the moodleform_mod method standard_coursemodule_elements(). The default is to include a visibility and groupsmode select box and to include all necessary hidden fields. You can pass a parameter false to tell the method that your module doesn&#039;t support groups and so you don&#039;t want the groupsmode select button.&lt;br /&gt;
&lt;br /&gt;
[[Category:Formslib]]&lt;/div&gt;</summary>
		<author><name>GregLyon</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Development:CVS_for_developers&amp;diff=16871</id>
		<title>Development:CVS for developers</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Development:CVS_for_developers&amp;diff=16871"/>
		<updated>2006-10-09T16:48:23Z</updated>

		<summary type="html">&lt;p&gt;GregLyon: /* Feature branches for large changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;CVS&#039;&#039;&#039; is the Concurrent Versioning System, a commonly-used way of managing source code for large software projects. CVS keeps all versions of all files so that nothing is ever lost, and usage by different people is tracked. It also provides ways to merge code if two or more people are working on the same file. All code and all versions are stored on a central server (in the case of Moodle, at Sourceforge). The [http://cvsbook.red-bean.com/cvsbook.html CVS book] holds more information about CVS than you need.&lt;br /&gt;
&lt;br /&gt;
If you just want to download Moodle using CVS to run a site, then you probably don&#039;t need this page - please see [[CVS for Administrators]] instead.&lt;br /&gt;
&lt;br /&gt;
==Joining the project as a developer==&lt;br /&gt;
&lt;br /&gt;
So, you&#039;ve been offered CVS write access to help us develop and maintain Moodle! [http://sourceforge.net/project/memberlist.php?group_id=30935 Welcome aboard]!&lt;br /&gt;
&lt;br /&gt;
To be able to write changes into [http://moodle.cvs.sourceforge.net/moodle/moodle/ Moodle&#039;s CVS archive], you first need to have an account at Sourceforge ([http://sourceforge.net/account/newuser_emailverify.php registration is free and easy]). For the examples on this page, let&#039;s assume your username is myusername and your password is mypassword.&lt;br /&gt;
&lt;br /&gt;
Once you have a working Sourceforge account, contact [http://moodle.com/helpdesk Martin Dougiamas] so he can set up your account with write access to particular Moodle directories.&lt;br /&gt;
&lt;br /&gt;
To avoid being prompted for mypassword every time you run a CVS command, follow [http://sourceforge.net/docman/display_doc.php?docid=761&amp;amp;group_id=1 the Sourceforge directions for using authorized keys]. This step is optional, but it can make your CVS experience a lot nicer. &lt;br /&gt;
&lt;br /&gt;
With that done, you should have all the permissions you need, so you just need to set up your machine and download the current sources so you can start working on them. There is no need to read the [https://sourceforge.net/docs/E04 Sourceforge CVS documentation] unless you are interested.&lt;br /&gt;
&lt;br /&gt;
==CVS modules==&lt;br /&gt;
&lt;br /&gt;
Within CVS, the word &amp;quot;modules&amp;quot; refers to separate collections of code. In Moodle we have the following modules within our repository:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;moodle&#039;&#039;&#039; - the main Moodle source code&lt;br /&gt;
* &#039;&#039;&#039;contrib&#039;&#039;&#039; - user contributions and other assorted code in development&lt;br /&gt;
* &#039;&#039;&#039;mysql&#039;&#039;&#039; - a customised phpMyAdmin to plug into Moodle for database admin&lt;br /&gt;
* &#039;&#039;&#039;windows-cron&#039;&#039;&#039; - a small package that makes cron possible on Windows systems&lt;br /&gt;
* &#039;&#039;&#039;docs&#039;&#039;&#039; - various extra user-contributed documentation&lt;br /&gt;
&lt;br /&gt;
Most people are working on the existing features in the moodle module, but many are also contributing new ideas in the contrib modules. Once code reaches a certain level of maturity in the contrib area, it can be migrated over into the main moodle tree.&lt;br /&gt;
&lt;br /&gt;
==Basic CVS commands==&lt;br /&gt;
&lt;br /&gt;
===CVS on Unix===&lt;br /&gt;
&lt;br /&gt;
Sourceforge CVS uses ssh as a transport layer for security, so you will have to set a CVS_RSH environment variable in your Unix shell. It&#039;s best to put these commands in your .bashrc or .cshrc so you don&#039;t have to type it all the time:&lt;br /&gt;
        setenv CVS_RSH ssh (for csh, tcsh etc)&lt;br /&gt;
        export CVS_RSH=ssh (for sh, bash etc)&lt;br /&gt;
&lt;br /&gt;
Next, you can check out the latest development version of Moodle using this (all one line). NOTE: Don&#039;t try to do run this first CVS command over an existing moodle installation: start fresh with a new directory!:&lt;br /&gt;
        cvs -z3 -d:ext:myusername@moodle.cvs.sourceforge.net:/cvsroot/moodle co moodle&lt;br /&gt;
&lt;br /&gt;
The command is similar for other CVS modules:&lt;br /&gt;
        cvs -z3 -d:ext:myusername@moodle.cvs.sourceforge.net:/cvsroot/moodle co contrib&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note that you will be prompted for mypassword for each command unless you set up authorized keys.&lt;br /&gt;
&lt;br /&gt;
Now, you should have a new &#039;moodle&#039; directory. You can rename it and move it around if you like. Go into it:&lt;br /&gt;
        cd moodle&lt;br /&gt;
&lt;br /&gt;
All the latest Moodle files should be in there. You can now change files in your copy. To compare your files and directories against the main CVS copy on the server use cvs diff, e.g.:&lt;br /&gt;
        cvs diff -c config-dist.php&lt;br /&gt;
        cvs diff -c lang&lt;br /&gt;
&lt;br /&gt;
To fetch the latest updates from the server use:&lt;br /&gt;
        cvs update -dP&lt;br /&gt;
&lt;br /&gt;
To copy your new files back to the server you would do something like:&lt;br /&gt;
        cd lang/ca&lt;br /&gt;
        cvs commit&lt;br /&gt;
&lt;br /&gt;
You will be prompted to add some comments (depends on your default text editor) ... add a meaningful comment and close the editor ... the files will be sent to Sourceforge and stored. Done!&lt;br /&gt;
&lt;br /&gt;
To save more time you can put default arguments into a file called .cvsrc in your home directory. For example, mine contains:&lt;br /&gt;
        diff -c&lt;br /&gt;
        update -dP&lt;br /&gt;
&lt;br /&gt;
Try &#039;cvs help&#039; for more details ...&lt;br /&gt;
&lt;br /&gt;
===CVS on Mac OSX===&lt;br /&gt;
&lt;br /&gt;
You can follow the same instructions as for Unix (above) in a terminal window. However, the cvs command is not installed by default in an OSX. You first need to install the XCode Tools. You should find this on your original installation disk. Failing that it can be downloaded (a fairly hefty download) from the Apple developer web site ([http://developer.apple.com]).&lt;br /&gt;
&lt;br /&gt;
===CVS on Windows===&lt;br /&gt;
&lt;br /&gt;
First, you need to download a completely fresh copy of Moodle using your developer account.&lt;br /&gt;
&lt;br /&gt;
1. Get TortoiseCVS from tortoisecvs.org and install it, then reboot.&lt;br /&gt;
&lt;br /&gt;
2. Find or create a new folder somewhere where you want Moodle to be downloaded to.&lt;br /&gt;
&lt;br /&gt;
3. Right-mouse-click that folder and choose &amp;quot;CVS Checkout&amp;quot; from the menu. You should see a dialog box.&lt;br /&gt;
&lt;br /&gt;
4. Copy this text into the CVSROOT field (using your own username!):&lt;br /&gt;
&lt;br /&gt;
           :ext:myusername@moodle.cvs.sourceforge.net:/cvsroot/moodle&lt;br /&gt;
&lt;br /&gt;
5. Under the &amp;quot;Module&amp;quot; field, type &amp;quot;moodle&amp;quot; to get the latest development version of Moodle, &amp;quot;contrib&amp;quot; to get the contributions directory, or &amp;quot;mysql&amp;quot; to get the MySQL Admin module.&lt;br /&gt;
&lt;br /&gt;
6. Press the button: &amp;quot;OK&amp;quot; and everything should be downloaded.&lt;br /&gt;
&lt;br /&gt;
A dialog box should show all the files being downloaded, and after a while you should have a complete copy of Moodle. After this first checkout, you can fetch the latest updated files from the CVS server:&lt;br /&gt;
&lt;br /&gt;
# Right-mouse-click on your Moodle folder (or any file) and select &amp;quot;CVS Update&amp;quot;.&lt;br /&gt;
# Sit back and watch the logs scroll by. Take note of conflicts that may occur if your local code has changes that conflict with the incoming versions - you will need to edit these files and resolve the conflicts manually.&lt;br /&gt;
&lt;br /&gt;
After modifying files (you will notice their icons change from green to red!), you can commit them back to the CVS server like this:&lt;br /&gt;
&lt;br /&gt;
# Right-mouse-click on your Moodle folder (or any file) and select &amp;quot;CVS Commit...&amp;quot;.&lt;br /&gt;
# In the dialog box, type a clear description of the changes you are committing.&lt;br /&gt;
# Click &amp;quot;OK&amp;quot;. Your changes will be sent to the server.&lt;br /&gt;
&lt;br /&gt;
==Working with branches==&lt;br /&gt;
&lt;br /&gt;
This diagram shows how the main moodle module branches into different versions over time.&lt;br /&gt;
&lt;br /&gt;
[[Image:Cvstree.png|CVS tree]]&lt;br /&gt;
&lt;br /&gt;
To see all the current tags and branches that are available, use this command on any old file (such as index.php in the top moodle directory):&lt;br /&gt;
    cvs status -v index.php&lt;br /&gt;
&lt;br /&gt;
Some tagging guidelines:&lt;br /&gt;
* Tag and branch names should always be all upper-case.&lt;br /&gt;
* Tags and branches should ALWAYS be applied to the entire module (all of Moodle). Don&#039;t tag individual files or directories.&lt;br /&gt;
* We don&#039;t allow renaming of tags because people may be relying on them, so get them right the first time!&lt;br /&gt;
&lt;br /&gt;
===Trunk development===&lt;br /&gt;
&lt;br /&gt;
The Trunk of CVS is the main development version of Moodle. In CVS it is also known as the HEAD, or default branch.&lt;br /&gt;
&lt;br /&gt;
Moodle developers try to keep this stable as possible, but as it usually contains new code it probably has bugs and small instabilities.&lt;br /&gt;
&lt;br /&gt;
Every now and then we decide the product has enough features to make a release. At this time, the trunk is tagged with a MOODLE_XX_BETA tag (in case we ever want to roll back to that point) and a new branch is formed for the release, called MOODLE_XX_STABLE.&lt;br /&gt;
&lt;br /&gt;
A Beta package is also released at this point - it&#039;s for testers who don&#039;t use CVS but want to test the latest features and report bugs.&lt;br /&gt;
&lt;br /&gt;
===Stable branches for each release===&lt;br /&gt;
&lt;br /&gt;
As soon as the stable branch MOODLE_XX_STABLE is created, development efforts will fork into two streams for a while. Some people may continue working on new features in the trunk for the next release, but most developers should be concentrating on using the current STABLE branch and fixing bugs that are found in it.&lt;br /&gt;
&lt;br /&gt;
You can switch your local copy of Moodle to the STABLE version using the following command in Unix from the root directory:&lt;br /&gt;
    cvs update -dP -r MOODLE_XX_STABLE&lt;br /&gt;
&lt;br /&gt;
After that, all the commands described above will apply to that stable version. To return to the trunk version just issue:&lt;br /&gt;
    cvs update -dPA&lt;br /&gt;
&lt;br /&gt;
On Windows clients you should have a menu from which you can choose the branch.&lt;br /&gt;
&lt;br /&gt;
Once the new STABLE branch really stabilises, a release can be declared. Packages are created for distribution and the branch will be tagged (by Martin) with a tag named: MOODLE_XXX&lt;br /&gt;
&lt;br /&gt;
Periodically, bug fixes in the STABLE branch should be merged into the trunk so that they become available in future versions of Moodle. A floating tag called MOODLE_XX_MERGED will be maintained to keep track of the last merge. The procedure for such a merge is as follows:&lt;br /&gt;
&lt;br /&gt;
1. Get out the very latest trunk version.&lt;br /&gt;
&lt;br /&gt;
          cvs update -dPA&lt;br /&gt;
&lt;br /&gt;
2. Merge everything on the branch since the last merge, into your trunk version&lt;br /&gt;
&lt;br /&gt;
          cvs update -kk -j MOODLE_XX_MERGED -j MOODLE_XX_STABLE&lt;br /&gt;
&lt;br /&gt;
3. Carefully watch the update logs for conflicts, and fix every file that you see with a conflict&lt;br /&gt;
&lt;br /&gt;
4. Check the merged copy back into CVS trunk version&lt;br /&gt;
&lt;br /&gt;
          cvs commit&lt;br /&gt;
&lt;br /&gt;
5. Go back to the branch version&lt;br /&gt;
&lt;br /&gt;
          cvs update -dPr MOODLE_XX_STABLE&lt;br /&gt;
&lt;br /&gt;
6. Update the floating merge tag so that this process can be repeated next time&lt;br /&gt;
&lt;br /&gt;
          cvs tag -RF MOODLE_XX_MERGED&lt;br /&gt;
&lt;br /&gt;
Finally, the values for $version in all the Moodle version.php files within the stable branch should not be updated at all if possible (except the last digit if necessary). The reason is that someone updating from a very stable version to the next very stable version could miss database upgrades that happened on the trunk.&lt;br /&gt;
&lt;br /&gt;
===Feature branches for large changes===&lt;br /&gt;
&lt;br /&gt;
Occasionally, there may be a very large feature that needs to be checked in so several people can work on it, but it is too unstable to be included in the main development trunk.&lt;br /&gt;
&lt;br /&gt;
In these cases a short-term branch can be created to work on the feature, and then merged back into the main trunk as soon as possible. An example called MOODLE_17_WIDGET branch can be seen in the above diagram.&lt;br /&gt;
&lt;br /&gt;
If you need to do this for your new WIDGET feature, follow these steps:&lt;br /&gt;
&lt;br /&gt;
1. Discuss with other developers to make sure it&#039;s necessary!&lt;br /&gt;
&lt;br /&gt;
2. Make a new tag on the trunk (for all of moodle) called MOODLE_XX_WIDGET_PRE&lt;br /&gt;
&lt;br /&gt;
          cvs tag -R MOODLE_XX_WIDGET_PRE&lt;br /&gt;
&lt;br /&gt;
3. Create your branch called MOODLE_XX_WIDGET&lt;br /&gt;
&lt;br /&gt;
          cvs tag -Rb MOODLE_XX_WIDGET&lt;br /&gt;
&lt;br /&gt;
4. Work in that branch until the feature is reasonably stable. Commit as necessary.&lt;br /&gt;
&lt;br /&gt;
          cvs commit&lt;br /&gt;
&lt;br /&gt;
5. When ready, merge the whole branch into the trunk, fix conflicts, commit it to the trunk and then abandon the branch.&lt;br /&gt;
&lt;br /&gt;
          cvs update -dPA&lt;br /&gt;
          cvs update -kk -j MOODLE_XX_WIDGET&lt;br /&gt;
          cvs commit&lt;br /&gt;
&lt;br /&gt;
Good luck, be careful and have fun!&lt;br /&gt;
&lt;br /&gt;
==Tips and Hints==&lt;br /&gt;
* [[Tracking Moodle CVS with git]]&lt;br /&gt;
* [http://moodle.org/mod/forum/discuss.php?d=34472 Merging Custom Moodle Code With Stable Releases]&lt;br /&gt;
* [[Unmerged files]]: To see if you&#039;ve forgotten to merge any file.&lt;br /&gt;
&lt;br /&gt;
When you have difficulties accessing CVS this may be due to a problem at Sourceforge. You can check the&lt;br /&gt;
* [https://sourceforge.net/docs/A04/ Sourceforge status page] &lt;br /&gt;
for any news about outages.&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Developer tools]]&lt;br /&gt;
&lt;br /&gt;
[[es:CVS para desarrolladores]]&lt;/div&gt;</summary>
		<author><name>GregLyon</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=User:Greg_Lyon&amp;diff=12638</id>
		<title>User:Greg Lyon</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=User:Greg_Lyon&amp;diff=12638"/>
		<updated>2006-06-29T19:01:12Z</updated>

		<summary type="html">&lt;p&gt;GregLyon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hello!  Currently (June &#039;06) evaluating Moodle 1.6.&lt;/div&gt;</summary>
		<author><name>GregLyon</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/310/en/index.php?title=Administration_FAQ&amp;diff=12637</id>
		<title>Administration FAQ</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/310/en/index.php?title=Administration_FAQ&amp;diff=12637"/>
		<updated>2006-06-29T18:59:04Z</updated>

		<summary type="html">&lt;p&gt;GregLyon: /* When will Moodle 1.6 be released? */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{FAQ}}&lt;br /&gt;
&lt;br /&gt;
==Changing text in Moodle==&lt;br /&gt;
&lt;br /&gt;
Text in Moodle may be changed by editing the language files via Administration &amp;gt;&amp;gt; Configuration &amp;gt;&amp;gt; [[admin/lang | Language]].&lt;br /&gt;
&lt;br /&gt;
Please note that language files are overwritten with new versions when upgrading. To avoid this, you may create your own language pack by copying the contents of your language folder into a new folder, making it the default for the site, then editing this instead.&lt;br /&gt;
&lt;br /&gt;
==How do I make my Moodle site homepage look like the moodle.org homepage?==&lt;br /&gt;
&lt;br /&gt;
Please see the theme how-to [[Homepage design|homepage design of moodle.org]] for full details.&lt;br /&gt;
&lt;br /&gt;
== How do the limits on uploaded files work? ==&lt;br /&gt;
&lt;br /&gt;
File upload sizes are restricted in a number of ways - each one in the list restricts the following ones.&lt;br /&gt;
&lt;br /&gt;
1. Firstly, there is a setting in Apache 2 which you may need to change. On Redhat this setting is very low by default, you can change the limit by adding or editing a line in Apache&#039;s &#039;&#039;/etc/httpd/conf/httpd.conf&#039;&#039; and/or &#039;&#039;/etc/httpd/conf.d/php.conf&#039;&#039; with the upload size in bytes (different operating systems may have these files in different locations):&lt;br /&gt;
&lt;br /&gt;
 LimitRequestBody 10485760&lt;br /&gt;
&lt;br /&gt;
2. PHP also has two more byte limits, which you can set in &#039;&#039;php.ini&#039;&#039; and sometimes in a &#039;&#039;.htaccess&#039;&#039; file:&lt;br /&gt;
&lt;br /&gt;
 php_value upload_max_filesize 50000000&lt;br /&gt;
 php_value post_max_size 50000000&lt;br /&gt;
&lt;br /&gt;
To convert from Bytes to Megabytes use [http://www.onlineconversion.com/computer.htm this convertor ]&lt;br /&gt;
&lt;br /&gt;
Please note that a server re-start may be required for the above changes to take effect.&lt;br /&gt;
&lt;br /&gt;
3. Moodle has a site-wide limit called maxbytes that may be set in Administration &amp;gt;&amp;gt; Configuration &amp;gt;&amp;gt; [[admin/config|Variables]].&lt;br /&gt;
&lt;br /&gt;
4. A limit may be set by teachers in the [[course/edit|Course settings]].&lt;br /&gt;
&lt;br /&gt;
5. Activity modules such as [[Forums]] and [[Assignments]] have their own limits which may be set when adding or editing the activity.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;See also&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=39625 Detailed instructions to increase the maximum allowed size for uploaded files] forum discussion&lt;br /&gt;
&lt;br /&gt;
== I have forgotten the admin password ==&lt;br /&gt;
Firstly, try using the button &amp;quot;Send my details via email&amp;quot;. Otherwise, you will need to access the database using MySQL admin. Passwords for all users, including admin, are stored encrypted in the table &#039;&#039;mdl_user&#039;&#039;. Copy the guest password (guest) into the admin password field then login using it.&lt;br /&gt;
&lt;br /&gt;
Additional solutions are detailed in the discussions [http://moodle.org/mod/forum/discuss.php?d=18103 change admin&#039;s password] and [http://moodle.org/mod/forum/discuss.php?d=4552&amp;amp;parent=38070 login/password].&lt;br /&gt;
&lt;br /&gt;
== My log table has disappeared - No logs found! ==&lt;br /&gt;
The most likely cause is that the mdl_log table has become corrupted. It may be repaired using MySQL Admin as follows:&lt;br /&gt;
&lt;br /&gt;
Click the SQL tab, then in the &amp;quot;Run SQL query/queries on database moodle&amp;quot; field type &amp;lt;code&amp;gt;REPAIR TABLE mdl_log&amp;lt;/code&amp;gt; and click the Go button.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;External links&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
*[http://www.databasejournal.com/features/mysql/article.php/10897_3300511_2 Repairing Database Corruption in MySQL]&lt;br /&gt;
&lt;br /&gt;
==My style sheet changes aren&#039;t showing up==&lt;br /&gt;
&lt;br /&gt;
Browsers usually cache style sheets and so a forced refresh (CTRL + F5) is required before any changes show up.&lt;br /&gt;
&lt;br /&gt;
== Site-wide scales ==&lt;br /&gt;
To add a site-wide scale, available in all courses, follow the Scales link in any course Administration block. Add a new scale, then use the move down arrow to move the scale from custom scales to standard scales.&lt;br /&gt;
&lt;br /&gt;
== Users are being unenrolled for no apparent reason ==&lt;br /&gt;
Unenrolment may be controlled by the following:&lt;br /&gt;
*The &#039;&#039;longtimenosee&#039;&#039; variable in Administration &amp;gt;&amp;gt; Configuration &amp;gt;&amp;gt; [[admin/config|Variables]] which specifies the time limit for which, if students haven&#039;t logged in, they are unenrolled from courses.&lt;br /&gt;
*The &#039;&#039;Enrolment duration&#039;&#039; in the [[course/edit|Course settings]] which unenrols students after the specified time has elapsed.&lt;br /&gt;
&lt;br /&gt;
== When will Moodle 1.6 be released? ==&lt;br /&gt;
&lt;br /&gt;
Moodle 1.6 is now released!&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
*[http://download.moodle.org/modules/integrations.php Moodle Download: Integrations] - MySQL Admin for download&lt;br /&gt;
&lt;br /&gt;
[[Category:Administrator]]&lt;br /&gt;
[[Category:FAQ]]&lt;br /&gt;
&lt;br /&gt;
[[es:FAQ Administración]]&lt;/div&gt;</summary>
		<author><name>GregLyon</name></author>
	</entry>
</feed>