<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Chad.burrus</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Chad.burrus"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/Special:Contributions/Chad.burrus"/>
	<updated>2026-04-18T19:13:10Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Coding&amp;diff=931</id>
		<title>Coding</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Coding&amp;diff=931"/>
		<updated>2007-02-21T23:02:05Z</updated>

		<summary type="html">&lt;p&gt;Chad.burrus: /* Security issues (and handling form and URL data) */  added period to end of first point&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Any collaborative project needs consistency and stability to stay strong.&lt;br /&gt;
&lt;br /&gt;
These &#039;&#039;&#039;coding guidelines&#039;&#039;&#039; are to provide a goal for all Moodle code to strive to. It&#039;s true that some of the older existing code falls short in a few areas, but it will all be fixed eventually. All new code definitely must adhere to these standards as closely as possible.&lt;br /&gt;
&lt;br /&gt;
==General rules==&lt;br /&gt;
&lt;br /&gt;
# All code files should use the .php extension.&lt;br /&gt;
# All template files should use the .html extension.&lt;br /&gt;
# All text files should use Unix-style text format (most text editors have this as an option).&lt;br /&gt;
# All php tags must be &#039;full&#039; tags like &amp;lt;?php ?&amp;gt; ... not &#039;short&#039; tags like &amp;lt;? ?&amp;gt;.&lt;br /&gt;
# All existing copyright notices must be retained. You can add your own if necessary.&lt;br /&gt;
# Each file should include the main config.php file.&lt;br /&gt;
# Each file should check that the user is authenticated correctly, using require_login() and isadmin(), isteacher(), iscreator() or isstudent().&lt;br /&gt;
# All access to databases should use the functions in &#039;&#039;lib/dmllib.php&#039;&#039; whenever possible - this allows compatibility across a wide range of databases. You should find that almost anything is possible using these functions. If you must write SQL code then make sure it is: cross-platform; restricted to specific functions within your code (usually a lib.php file); and clearly marked.&lt;br /&gt;
# Don&#039;t create or use global variables except for the standard $CFG, $SESSION, $THEME, $SITE, $COURSE and $USER.&lt;br /&gt;
# All variables should be initialised or at least tested for existence using isset() or empty() before they are used.&lt;br /&gt;
# All strings should be translatable - create new texts in the &amp;quot;lang/en_utf8&amp;quot; files with concise English lowercase names and retrieve them from your code using get_string() or print_string(). Never delete strings to ensure backwards compatibility of the language packs is maintained.&lt;br /&gt;
# All help files should be translatable - create new texts in the &amp;quot;lang/en_utf8/help&amp;quot; directory and call them using helpbutton(). If you need to update a help file:&lt;br /&gt;
#* with a minor change, where an old translation of the file would still make sense, then it&#039;s OK to make the change but you should notify translation AT moodle DOT org.&lt;br /&gt;
#* for a major change you should create a new file by adding an incrementing number (eg filename2.html) so that translators can easily see it&#039;s a new version of the file. Obviously the new code and the help index files should also be modified to point to the newest versions.&lt;br /&gt;
# Incoming data from the browser (sent via GET or POST) automatically has magic_quotes applied (regardless of the PHP settings) so that you can safely insert it straight into the database. All other raw data (from files, or from databases) must be escaped with addslashes() before inserting it into the database. Because this is so often done incorrectly, there is more explanation on this issue of adding and stripping slashes on a [[Developer:Slashes|separate page]].&lt;br /&gt;
# VERY IMPORTANT: All texts within Moodle, especially those that have come from users, should be printed using the format_text() function. This ensures that text is filtered and cleaned correctly. More information can be found on the page about [[Output_functions|output functions]].&lt;br /&gt;
# User actions should be logged using the [[Logs|add_to_log()]] function. These logs are used for [[Settings#Show_activity_reports|activity reports]] and [[Logs]].&lt;br /&gt;
&lt;br /&gt;
==Coding style==&lt;br /&gt;
&lt;br /&gt;
I know it can be a little annoying to change your style if you&#039;re used to something else, but balance that annoyance against the annoyance of all the people trying later on to make sense of Moodle code with mixed styles. There are obviously many good points for and against any style that people use, but the current style just is, so please stick to it.&lt;br /&gt;
&lt;br /&gt;
1. Indenting should be consistently 4 spaces. Don&#039;t use tabs AT ALL.&lt;br /&gt;
&lt;br /&gt;
2. Variable names should always be easy-to-read, meaningful lowercase English words. If you really need more than one word then run them together, but keep them short as possible. Use plural names for arrays of objects.&lt;br /&gt;
&lt;br /&gt;
      GOOD: $quiz&lt;br /&gt;
      GOOD: $errorstring&lt;br /&gt;
      GOOD: $assignments (for an array of objects)&lt;br /&gt;
      GOOD: $i (but only in little loops)&lt;br /&gt;
&lt;br /&gt;
      BAD: $Quiz&lt;br /&gt;
      BAD: $aReallyLongVariableNameWithoutAGoodReason&lt;br /&gt;
      BAD: $error_string&lt;br /&gt;
&lt;br /&gt;
3. Constants should always be in upper case, and always start with the name of the module. They should have words separated by underscores.&lt;br /&gt;
&lt;br /&gt;
      define(&amp;quot;FORUM_MODE_FLATOLDEST&amp;quot;, 1);&lt;br /&gt;
4. Function names should be simple English lowercase words, and start with the name of the module to avoid conflicts between modules. Words should be separated by underscores. Parameters should always have sensible defaults if possible. Note there is no space between the function name and the following (brackets).&lt;br /&gt;
&lt;br /&gt;
      function forum_set_display_mode($mode=0) {&lt;br /&gt;
          global $USER, $CFG;&lt;br /&gt;
          &lt;br /&gt;
          if ($mode) {&lt;br /&gt;
              $USER-&amp;gt;mode = $mode;&lt;br /&gt;
          } else if (empty($USER-&amp;gt;mode)) {&lt;br /&gt;
              $USER-&amp;gt;mode = $CFG-&amp;gt;forum_displaymode;&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
5. Blocks must always be enclosed in curly braces (even if there is only one line). Moodle uses this style:&lt;br /&gt;
&lt;br /&gt;
      if ($quiz-&amp;gt;attempts) {&lt;br /&gt;
          if ($numattempts &amp;gt; $quiz-&amp;gt;attempts) {&lt;br /&gt;
              error($strtoomanyattempts, &amp;quot;view.php?id=$cm-&amp;gt;id&amp;quot;);&lt;br /&gt;
          }&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
6. Strings should be defined using single quotes where possible, for increased speed.&lt;br /&gt;
&lt;br /&gt;
      $var = &#039;some text without any variables&#039;;&lt;br /&gt;
      $var = &amp;quot;with special characters like a new line \n&amp;quot;;&lt;br /&gt;
      $var = &#039;a very, very long string with a &#039;.$single.&#039; variable in it&#039;;&lt;br /&gt;
      $var = &amp;quot;some $text with $many variables $within it&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
7. Comments should be added as much as is practical, to explain the code flow and the purpose of functions and variables.&lt;br /&gt;
&lt;br /&gt;
* Every function (and class) should use the popular [http://www.phpdoc.org/ phpDoc format]. This allows code documentation to be generated automatically.&lt;br /&gt;
* Inline comments should use the // style, laid out neatly so that it fits among the code and lines up with it.&lt;br /&gt;
&lt;br /&gt;
      /**&lt;br /&gt;
      * The description should be first, with asterisks laid out exactly&lt;br /&gt;
      * like this example. If you want to refer to a another function,&lt;br /&gt;
      * do it like this: {@link clean_param()}. Then, add descriptions&lt;br /&gt;
      * for each parameter as follows.&lt;br /&gt;
      *&lt;br /&gt;
      * @param int $postid The PHP type is followed by the variable name&lt;br /&gt;
      * @param array $scale The PHP type is followed by the variable name&lt;br /&gt;
      * @param array $ratings The PHP type is followed by the variable name&lt;br /&gt;
      * @return mixed&lt;br /&gt;
      */&lt;br /&gt;
      function forum_get_ratings_mean($postid, $scale, $ratings=NULL) {&lt;br /&gt;
          if (!$ratings) {&lt;br /&gt;
              $ratings = array();     // Initialize the empty array&lt;br /&gt;
              if ($rates = get_records(&amp;quot;forum_ratings&amp;quot;, &amp;quot;post&amp;quot;, $postid)) {&lt;br /&gt;
                  // Process each rating in turn&lt;br /&gt;
                  foreach ($rates as $rate) {&lt;br /&gt;
      ....etc&lt;br /&gt;
&lt;br /&gt;
8. Space should be used liberally - don&#039;t be afraid to spread things out a little to gain some clarity. Generally, there should be one space between brackets and normal statements, but no space between brackets and variables or functions:&lt;br /&gt;
&lt;br /&gt;
      foreach ($objects as $key =&amp;gt; $thing) {&lt;br /&gt;
          process($thing);&lt;br /&gt;
      }&lt;br /&gt;
      &lt;br /&gt;
      if ($x == $y) {&lt;br /&gt;
          $a = $b;&lt;br /&gt;
      } else if ($x == $z) {&lt;br /&gt;
          $a = $c;&lt;br /&gt;
      } else {&lt;br /&gt;
          $a = $d;&lt;br /&gt;
      }&lt;br /&gt;
&lt;br /&gt;
9. When making a COPY of an object, always use the php5 clone() function (otherwise you may end up with just a reference to the first object).  Moodle will make sure this works consistently on php4 too.&lt;br /&gt;
&lt;br /&gt;
      BAD:   $b = $a;&lt;br /&gt;
      GOOD:  $b = clone($a);&lt;br /&gt;
&lt;br /&gt;
If the thing you want to copy is not an object, but may contain objects (eg an array of objects) then use fullclone() instead.&lt;br /&gt;
&lt;br /&gt;
==Database structures==&lt;br /&gt;
&lt;br /&gt;
# Every table must have an auto-incrementing id field (INT10) as primary index. (see [[IdColumnReasons]])&lt;br /&gt;
# The main table containing instances of each module must have the same name as the module (eg widget) and contain the following minimum fields:&lt;br /&gt;
#* id - as described above&lt;br /&gt;
#* course - the id of the course that each instance belongs to&lt;br /&gt;
#* name - the full name of each instance of the module&lt;br /&gt;
# Other tables associated with a module that contain information about &#039;things&#039; should be named widget_things (note the plural).&lt;br /&gt;
# Table and column names should avoid using [[Database reserved words|reserved words in any database]]. Please check them before creation.&lt;br /&gt;
# Column names should be always lowercase, simple and short, following the same rules as for variable names.&lt;br /&gt;
# Where possible, columns that contain a reference to the id field of another table (eg widget) should be called widgetid. (Note that this convention is newish and not followed in some older tables)&lt;br /&gt;
# Boolean fields should be implemented as small integer fields (eg INT4) containing 0 or 1, to allow for later expansion of values if necessary.&lt;br /&gt;
# Most tables should have a timemodified field (INT10) which is updated with a current timestamp obtained with the PHP time() function.&lt;br /&gt;
# Always define a default value for each field (and make it sensible)&lt;br /&gt;
# Each table name should start with the database prefix ($CFG-&amp;gt;prefix). In a lot of cases, this is taken care of for you automatically. Also, under Postgres, the name of every index must start with the prefix too.&lt;br /&gt;
# In order to guarantee [[XMLDB problems#Table and column aliases - the AS keyword|cross-db compatibility]] follow these simple rules about the use of the &#039;&#039;&#039;AS&#039;&#039;&#039; keyword (only if you need table/colum aliases, of course):&lt;br /&gt;
#* &#039;&#039;&#039;Don&#039;t use&#039;&#039;&#039; the &#039;&#039;&#039;AS&#039;&#039;&#039; keyword for &#039;&#039;&#039;table aliases&#039;&#039;&#039;.&lt;br /&gt;
#* &#039;&#039;&#039;Do use&#039;&#039;&#039; the &#039;&#039;&#039;AS&#039;&#039;&#039; keyword for &#039;&#039;&#039;column aliases&#039;&#039;&#039;.&lt;br /&gt;
# &#039;&#039;&#039;Never&#039;&#039;&#039; create UNIQUE KEYs (constraints) at all. Instead use UNIQUE INDEXes. In the future, if we decide to add referential integrity to Moodle and we need UNIQUE KEYs they will be used, but not now. Please note that the XMLDB editor allows you to specify both XMLDB-only UNIQUE and FOREIGN constraints (and that&#039;s good, in order to have the XML well defined) but only underlying INDEXes will be generated. &lt;br /&gt;
# Those XMLDB-only UNIQUE KEYs (read previous point) only must be defined if such field/fields &#039;&#039;&#039;are going to be the target&#039;&#039;&#039; for some (XMLDB-only too) FOREIGN KEY. Else, create them as simple UNIQUE INDEXes.&lt;br /&gt;
# Tables associated &#039;&#039;&#039;with one block&#039;&#039;&#039; must follow this convention with their names: &#039;&#039;&#039;$CFG-&amp;gt;prefix + &amp;quot;block_&amp;quot; + name_of_the_block + anything_else&#039;&#039;&#039;. For example, assuming that $CFG-&amp;gt;prefix is &#039;mdl_&#039;, all the tables for the block &amp;quot;rss_client&amp;quot; must start by &#039;mdl_block_rss_client&#039; (being possible to add more words at the end, i.e. &#039;mdl_block_rss_client_anothertable&#039;...). This rule will be 100% enforced with Moodle 2.0, giving time to developers until then. See [http://tracker.moodle.org/browse/MDL-6786 Task 6786] for more info about this.&lt;br /&gt;
&lt;br /&gt;
==Security issues (and handling form and URL data)==&lt;br /&gt;
&lt;br /&gt;
# Do not rely on &#039;register_globals&#039;. Every variable must be properly initialised in every code file. It must be obvious where the variable came from.&lt;br /&gt;
# Initialise all arrays and objects, even if empty. $a = array() or $obj = new stdClass();.&lt;br /&gt;
# Do not use the optional_variable() function (this function is now deprecated). Use the optional_param() function instead. Pick the correct PARAM_XXXX value for the data type you expect.&lt;br /&gt;
# Do not use the require_variable() function (this function is now deprecated). Use the required_param() function instead. Pick the correct PARAM_XXXX value for the data type you expect.&lt;br /&gt;
# Use data_submitted(), with care. Data must still be cleaned before use.&lt;br /&gt;
# Do not use $_GET, $_POST or $_REQUEST. Use the appropriate required_param() or optional_param() appropriate to your need.&lt;br /&gt;
# Do not check for an action using something like if (isset($_GET[&#039;something&#039;])). Use, e.g., $something = optional_param( &#039;something&#039;,-1,PARAM_INT ) and then perform proper test for it being in its expected range of values e.g., if ($something&amp;gt;=0) {....&lt;br /&gt;
# Wherever possible group all your required_param(), optional_param() and other variables initialisation at the beginning of each file to make them easy to find.&lt;br /&gt;
# Use &#039;sesskey&#039; mechanism to protect form handling routines from attack. Basic example of use: when form is generated, include &amp;lt;input type=&amp;quot;hidden&amp;quot; name=&amp;quot;sesskey&amp;quot; value=&amp;quot;&amp;lt;?php echo sesskey(); ?&amp;gt;&amp;quot; /&amp;gt;. When you process the form check with if (!confirm_sesskey()) {error(&#039;Bad Session Key&#039;);}.&lt;br /&gt;
# All filenames must be &#039;cleaned&#039; using the clean_filename() function, if this has not been done already by appropriate use of required_param() or optional_param()&lt;br /&gt;
# Any data read from the database must have [[Developer:Slashes|addslashes()]] applied to it before it can be written back. A whole object of data can be hit at once with addslashes_object().&lt;br /&gt;
# Wherever possible, data to be stored in the database must come from POST data (from a form with method=&amp;quot;POST&amp;quot;) as opposed to GET data (ie, data from the URL line).&lt;br /&gt;
# Do not use data from $_SERVER if you can avoid it. This has portability issues.&lt;br /&gt;
# If it hasn&#039;t been done somewhere else, make sure all data written to the database has been through the clean_param() function using the appropriate PARAM_XXXX for the datatype.&lt;br /&gt;
# If you write custom SQL code, make very sure it is correct. In particular watch out for missing quotes around values. Possible SQL &#039;injection&#039; exploit.&lt;br /&gt;
# Check all data (particularly that written to the database) in every file it is used. Do not expect or rely on it being done somewhere else.&lt;br /&gt;
# Blocks of code to be included should contain a definite PHP structure (e.g, a class declaration, function definition(s) etc.) - straight blocks of code promote uninitialised variable usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Manual de Estilo de Código]]&lt;br /&gt;
[[zh:代码指南]]&lt;/div&gt;</summary>
		<author><name>Chad.burrus</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Developer_documentation&amp;diff=517</id>
		<title>Developer documentation</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Developer_documentation&amp;diff=517"/>
		<updated>2007-02-11T00:48:45Z</updated>

		<summary type="html">&lt;p&gt;Chad.burrus: /* Documentation for contributed code */ changed &amp;quot;go&amp;quot; into &amp;quot;goes&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; New developer documentation pages should be added to the &#039;&#039;Development namespace&#039;&#039; by typing &amp;lt;code&amp;gt;Development:&amp;lt;/code&amp;gt; before the new page name i.e. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[New page name]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;If you are a developer, you probably want to change your [[Special:Preferences|preferences]] to include the Development namespace in searches.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Guidelines==&lt;br /&gt;
The following guidelines are crucial reading for anyone wanting to contribute to the Moodle code base:&lt;br /&gt;
*[[Coding|Coding guidelines]] have to be followed by all Moodle developers&lt;br /&gt;
*[[Moodle design goals]] spells out the basic design goals behind Moodle&lt;br /&gt;
*[[Interface guidelines]] aim to provide a common feel to the Moodle user interface&lt;br /&gt;
*[[CVS (developer)|Moodle CVS for developers]] explains how to work with the Moodle code in CVS&lt;br /&gt;
*[[Unit tests]] explains how to run the unit tests, and how to write new test cases.&lt;br /&gt;
*[[Tracker]] explains the Moodle Tracker for keeping track of bugs, issues, feature requests etc&lt;br /&gt;
*[[Working with the Community|Working with the Community]] explains how to engage with the dev community and discuss changes&lt;br /&gt;
&lt;br /&gt;
== Resources and tools ==&lt;br /&gt;
&lt;br /&gt;
*[[Developer FAQ]] - frequently asked questions, especially useful for newcomers to Moodle&lt;br /&gt;
*[http://tracker.moodle.org/ Moodle tracker] - bug reports, feature requests and other tracked issues&lt;br /&gt;
*[http://moodle.org/mod/forum/view.php?id=55 General developer forum]&lt;br /&gt;
*[http://moodle.cvs.sourceforge.net/moodle/moodle/ CVS code] - browse the Moodle code via the web&lt;br /&gt;
*[http://moodle.org/xref/nav.html?index.html Cross reference] - phpxref output for browsing Moodle source code&lt;br /&gt;
*[http://phpdocs.moodle.org/ Moodle PHP doc reference] - automatically generated documentation&lt;br /&gt;
*[[Database Schema|Database Schema]] - for recent releases&lt;br /&gt;
*[http://moodle.org/course/view.php?id=5#4 Development news and discussion] section of Using Moodle course&lt;br /&gt;
*[http://developer.yahoo.com/yui YUI documentation] - YUI is the official AJAX library in moodle.&lt;br /&gt;
*[[Setting up Eclipse for Moodle development]] - Eclipse is a great editor to use for php development, if you can work out how to set it up.&lt;br /&gt;
*[[Unmerged files]] - changes on the stable branch in CVS that have not been merged to HEAD&lt;br /&gt;
&lt;br /&gt;
==How you can contribute==&lt;br /&gt;
&lt;br /&gt;
The M in Moodle stands for &#039;Modular&#039;. There are many different types of components that you can contribute that can be plugged into Moodle to provide additional functionality. When you have developed a new component please publish it in the [http://moodle.org/mod/data/view.php?id=6009 database of Moodle modules and plugins]. The following types of plugins currently exist (in alphabetical order):&lt;br /&gt;
*[[Modules (developer)|Activity modules]]&lt;br /&gt;
*[[Admin reports|Admin reports]]&lt;br /&gt;
*[[Assignment types]]&lt;br /&gt;
*[[Authentication|Authentication methods]]&lt;br /&gt;
*[[Blocks|Blocks]]&lt;br /&gt;
*[[Course formats]]&lt;br /&gt;
*[[Database fields (developer)|Database fields]]&lt;br /&gt;
*[[Database presets]]&lt;br /&gt;
*[[Enrolment plugins (developer)|Enrolment plugins]]&lt;br /&gt;
*[[Filters|Filters]]&lt;br /&gt;
*[[Question_engine]]&lt;br /&gt;
*[[Question import/export formats]]&lt;br /&gt;
*[[Question bank|Question bank teacher docs]]&lt;br /&gt;
*[[Question_engine#Question_types|Question types developper docs]]&lt;br /&gt;
*[[Quiz reports]]&lt;br /&gt;
*[[Resource types]]&lt;br /&gt;
*[[SSO plugins]]&lt;br /&gt;
&lt;br /&gt;
There are also ways you can contribute that don&#039;t involve PHP programming:&lt;br /&gt;
*[[Themes]]&lt;br /&gt;
*[[Translation]]&lt;br /&gt;
*[[Database Schemas|Database schemas]]&lt;br /&gt;
&lt;br /&gt;
You can also help a lot by&lt;br /&gt;
*[[Tests|Testing]]&lt;br /&gt;
*[[Tracker|Participating in the bug tracker]]&lt;br /&gt;
&lt;br /&gt;
==Plans for the future==&lt;br /&gt;
Ideas for and details of planned future features of Moodle are initially discussed on the forums in the [http://moodle.org/course/view.php?id=5 Using Moodle] course at moodle.org. That developer discussions are intermixed with user discussions in the same forums may seem strange at first but is one of the reasons for the success of Moodle. It is important that both end-users and developers discuss the future features together.&lt;br /&gt;
&lt;br /&gt;
Once ideas begin to crystalize on the forums they can be summarized in this wiki, either as part of the [[Roadmap]] or in the form of [[Developer notes]]. These pages then form the basis for further discussion in the forums.&lt;br /&gt;
*[[Roadmap]]&lt;br /&gt;
*[[Developer notes]]&lt;br /&gt;
*[[Student projects]]&lt;br /&gt;
*[[Developer conference|Developer conferences]]&lt;br /&gt;
&lt;br /&gt;
==Documentation for core components==&lt;br /&gt;
This section is for documentation of specific components of the existing core Moodle code. Discussion of components that are under discussion or in development can be found in the [[Developer notes]] or on the [[Roadmap]].&lt;br /&gt;
&lt;br /&gt;
*[[Migration to Role-driven model|Migration to Role-driven model]] @ v[[1.7]]&lt;br /&gt;
*[[UTF-8 migration|Migration to UTF-8]] @ v[[:Category:Moodle 1.6|1.6]]&lt;br /&gt;
*[[Question engine]]&lt;br /&gt;
*[[Quiz developer docs|Quiz module]]&lt;br /&gt;
*[[SCORM schema|SCORM module 1.5 schema]]&lt;br /&gt;
*[[Authentication API]]&lt;br /&gt;
*[[Stats package]]&lt;br /&gt;
*[[Email processing]]&lt;br /&gt;
*[[Cookieless Sessions]]&lt;br /&gt;
*[[lib/formslib.php|Formslib]] for quickly writing code to display and process more accessible and secure forms.&lt;br /&gt;
*[[Moodle Network|Moodle Network]]&lt;br /&gt;
&lt;br /&gt;
==Documentation for contributed code==&lt;br /&gt;
Many Moodle users contribute code for the benefit of other Moodle users. This can take the form of new activity modules, blocks, themes, resource plug-ins, assignment plug-ins, question type plug-ins, question import/export formats, quiz report plug-ins, course formats, ... This code is initially posted on the forums in the [http://moodle.org/course/view.php?id=5 Using Moodle] course and then often goes into the [http://moodle.cvs.sourceforge.net/moodle/contrib/ contrib area] of the Moodle [[CVS]] repository. When you have developed a new component please publish it in the [http://moodle.org/mod/data/view.php?id=6009 database of Moodle modules and plugins]. Developer documentation for these components should be listed here.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[http://security.moodle.org/ Moodle Security Centre]&lt;br /&gt;
*[http://moodle.com/partners/ Moodle Partners] - providers of custom Moodle development services&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Documentación para Desarrolladores]]&lt;br /&gt;
[[fr:Documentation développeur]]&lt;br /&gt;
[[zh:开发者文档]]&lt;br /&gt;
[[ja:開発者ドキュメント]]&lt;/div&gt;</summary>
		<author><name>Chad.burrus</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Developer_documentation&amp;diff=516</id>
		<title>Developer documentation</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Developer_documentation&amp;diff=516"/>
		<updated>2007-02-11T00:47:52Z</updated>

		<summary type="html">&lt;p&gt;Chad.burrus: /* Documentation for contributed code */  fixed apparently dead link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;&#039;&#039;&#039;Note:&#039;&#039;&#039; New developer documentation pages should be added to the &#039;&#039;Development namespace&#039;&#039; by typing &amp;lt;code&amp;gt;Development:&amp;lt;/code&amp;gt; before the new page name i.e. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;[[New page name]]&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;If you are a developer, you probably want to change your [[Special:Preferences|preferences]] to include the Development namespace in searches.&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Guidelines==&lt;br /&gt;
The following guidelines are crucial reading for anyone wanting to contribute to the Moodle code base:&lt;br /&gt;
*[[Coding|Coding guidelines]] have to be followed by all Moodle developers&lt;br /&gt;
*[[Moodle design goals]] spells out the basic design goals behind Moodle&lt;br /&gt;
*[[Interface guidelines]] aim to provide a common feel to the Moodle user interface&lt;br /&gt;
*[[CVS (developer)|Moodle CVS for developers]] explains how to work with the Moodle code in CVS&lt;br /&gt;
*[[Unit tests]] explains how to run the unit tests, and how to write new test cases.&lt;br /&gt;
*[[Tracker]] explains the Moodle Tracker for keeping track of bugs, issues, feature requests etc&lt;br /&gt;
*[[Working with the Community|Working with the Community]] explains how to engage with the dev community and discuss changes&lt;br /&gt;
&lt;br /&gt;
== Resources and tools ==&lt;br /&gt;
&lt;br /&gt;
*[[Developer FAQ]] - frequently asked questions, especially useful for newcomers to Moodle&lt;br /&gt;
*[http://tracker.moodle.org/ Moodle tracker] - bug reports, feature requests and other tracked issues&lt;br /&gt;
*[http://moodle.org/mod/forum/view.php?id=55 General developer forum]&lt;br /&gt;
*[http://moodle.cvs.sourceforge.net/moodle/moodle/ CVS code] - browse the Moodle code via the web&lt;br /&gt;
*[http://moodle.org/xref/nav.html?index.html Cross reference] - phpxref output for browsing Moodle source code&lt;br /&gt;
*[http://phpdocs.moodle.org/ Moodle PHP doc reference] - automatically generated documentation&lt;br /&gt;
*[[Database Schema|Database Schema]] - for recent releases&lt;br /&gt;
*[http://moodle.org/course/view.php?id=5#4 Development news and discussion] section of Using Moodle course&lt;br /&gt;
*[http://developer.yahoo.com/yui YUI documentation] - YUI is the official AJAX library in moodle.&lt;br /&gt;
*[[Setting up Eclipse for Moodle development]] - Eclipse is a great editor to use for php development, if you can work out how to set it up.&lt;br /&gt;
*[[Unmerged files]] - changes on the stable branch in CVS that have not been merged to HEAD&lt;br /&gt;
&lt;br /&gt;
==How you can contribute==&lt;br /&gt;
&lt;br /&gt;
The M in Moodle stands for &#039;Modular&#039;. There are many different types of components that you can contribute that can be plugged into Moodle to provide additional functionality. When you have developed a new component please publish it in the [http://moodle.org/mod/data/view.php?id=6009 database of Moodle modules and plugins]. The following types of plugins currently exist (in alphabetical order):&lt;br /&gt;
*[[Modules (developer)|Activity modules]]&lt;br /&gt;
*[[Admin reports|Admin reports]]&lt;br /&gt;
*[[Assignment types]]&lt;br /&gt;
*[[Authentication|Authentication methods]]&lt;br /&gt;
*[[Blocks|Blocks]]&lt;br /&gt;
*[[Course formats]]&lt;br /&gt;
*[[Database fields (developer)|Database fields]]&lt;br /&gt;
*[[Database presets]]&lt;br /&gt;
*[[Enrolment plugins (developer)|Enrolment plugins]]&lt;br /&gt;
*[[Filters|Filters]]&lt;br /&gt;
*[[Question_engine]]&lt;br /&gt;
*[[Question import/export formats]]&lt;br /&gt;
*[[Question bank|Question bank teacher docs]]&lt;br /&gt;
*[[Question_engine#Question_types|Question types developper docs]]&lt;br /&gt;
*[[Quiz reports]]&lt;br /&gt;
*[[Resource types]]&lt;br /&gt;
*[[SSO plugins]]&lt;br /&gt;
&lt;br /&gt;
There are also ways you can contribute that don&#039;t involve PHP programming:&lt;br /&gt;
*[[Themes]]&lt;br /&gt;
*[[Translation]]&lt;br /&gt;
*[[Database Schemas|Database schemas]]&lt;br /&gt;
&lt;br /&gt;
You can also help a lot by&lt;br /&gt;
*[[Tests|Testing]]&lt;br /&gt;
*[[Tracker|Participating in the bug tracker]]&lt;br /&gt;
&lt;br /&gt;
==Plans for the future==&lt;br /&gt;
Ideas for and details of planned future features of Moodle are initially discussed on the forums in the [http://moodle.org/course/view.php?id=5 Using Moodle] course at moodle.org. That developer discussions are intermixed with user discussions in the same forums may seem strange at first but is one of the reasons for the success of Moodle. It is important that both end-users and developers discuss the future features together.&lt;br /&gt;
&lt;br /&gt;
Once ideas begin to crystalize on the forums they can be summarized in this wiki, either as part of the [[Roadmap]] or in the form of [[Developer notes]]. These pages then form the basis for further discussion in the forums.&lt;br /&gt;
*[[Roadmap]]&lt;br /&gt;
*[[Developer notes]]&lt;br /&gt;
*[[Student projects]]&lt;br /&gt;
*[[Developer conference|Developer conferences]]&lt;br /&gt;
&lt;br /&gt;
==Documentation for core components==&lt;br /&gt;
This section is for documentation of specific components of the existing core Moodle code. Discussion of components that are under discussion or in development can be found in the [[Developer notes]] or on the [[Roadmap]].&lt;br /&gt;
&lt;br /&gt;
*[[Migration to Role-driven model|Migration to Role-driven model]] @ v[[1.7]]&lt;br /&gt;
*[[UTF-8 migration|Migration to UTF-8]] @ v[[:Category:Moodle 1.6|1.6]]&lt;br /&gt;
*[[Question engine]]&lt;br /&gt;
*[[Quiz developer docs|Quiz module]]&lt;br /&gt;
*[[SCORM schema|SCORM module 1.5 schema]]&lt;br /&gt;
*[[Authentication API]]&lt;br /&gt;
*[[Stats package]]&lt;br /&gt;
*[[Email processing]]&lt;br /&gt;
*[[Cookieless Sessions]]&lt;br /&gt;
*[[lib/formslib.php|Formslib]] for quickly writing code to display and process more accessible and secure forms.&lt;br /&gt;
*[[Moodle Network|Moodle Network]]&lt;br /&gt;
&lt;br /&gt;
==Documentation for contributed code==&lt;br /&gt;
Many Moodle users contribute code for the benefit of other Moodle users. This can take the form of new activity modules, blocks, themes, resource plug-ins, assignment plug-ins, question type plug-ins, question import/export formats, quiz report plug-ins, course formats, ... This code is initially posted on the forums in the [http://moodle.org/course/view.php?id=5 Using Moodle] course and then often go into the [http://moodle.cvs.sourceforge.net/moodle/contrib/ contrib area] of the Moodle [[CVS]] repository. When you have developed a new component please publish it in the [http://moodle.org/mod/data/view.php?id=6009 database of Moodle modules and plugins]. Developer documentation for these components should be listed here.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
*[http://security.moodle.org/ Moodle Security Centre]&lt;br /&gt;
*[http://moodle.com/partners/ Moodle Partners] - providers of custom Moodle development services&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[es:Documentación para Desarrolladores]]&lt;br /&gt;
[[fr:Documentation développeur]]&lt;br /&gt;
[[zh:开发者文档]]&lt;br /&gt;
[[ja:開発者ドキュメント]]&lt;/div&gt;</summary>
		<author><name>Chad.burrus</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/dev/index.php?title=Setting_up_Eclipse&amp;diff=4925</id>
		<title>Setting up Eclipse</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/dev/index.php?title=Setting_up_Eclipse&amp;diff=4925"/>
		<updated>2007-02-07T00:06:34Z</updated>

		<summary type="html">&lt;p&gt;Chad.burrus: /* Installing Eclipse */  replaced &amp;quot;upzip&amp;quot; with &amp;quot;unzip&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://www.eclipse.org/ Eclipse] is an IDE originally designed for Java, but now with plugins for many languages including PHP. It has lots of very powerful features, and it is the editor that some Moodle developers like to use. Other (more) popular choices are vim and emacs.&lt;br /&gt;
&lt;br /&gt;
However, Eclipse is not the easiest program in the world to get started with, so I&#039;m going to take you through it step by step. These instructions assume Eclipse 3.2, the current version at the time of writing. It should not change much between releases.&lt;br /&gt;
&lt;br /&gt;
This article started off as a brain-dump by [[User:Tim Hunt|Tim Hunt]]. Since then, several other people have worked through it and made corrections, so the information here should be pretty accurate.&lt;br /&gt;
&lt;br /&gt;
==Prerequisites==&lt;br /&gt;
&lt;br /&gt;
Eclipse is written in Java, so I recommend getting the latest Java runtime environment from http://java.com/ for maximum speed and reliability.&lt;br /&gt;
&lt;br /&gt;
Eclipse is quite big, so I recommend lots of memory in your computer. I have used it on Windows, MacOS X and Linux, in each case with 1GB of memory, and that is plenty.&lt;br /&gt;
&lt;br /&gt;
==Installing Eclipse==&lt;br /&gt;
&lt;br /&gt;
Go to http://www.eclipse.org/downloads/. Click on the link where it says &#039;&#039;&#039;Download now: Eclipse SDK 3.2&#039;&#039;&#039; It should have automatically detected which platform you are using. Choose a Mirror, and wait for the ~100MB download.&lt;br /&gt;
&lt;br /&gt;
You will notice that what you have got is a zip file (unless your system automatically decompresses it for you).&lt;br /&gt;
&lt;br /&gt;
On Windows, unzip it into &#039;&#039;&#039;C:\Program Files&#039;&#039;&#039; (all the files go into an &#039;&#039;&#039;Eclipse&#039;&#039;&#039; folder there). Then look in the Eclipse folder and drag Eclipse.exe to the Start menu/Desktop/Quicklaunch bar to make a shortcut for starting it.&lt;br /&gt;
&lt;br /&gt;
On MacOS, unzip and copy the Eclipse folder into Applications. Go into the Eclipse folder and drag the Eclipse app to the Dock for ease of launching.&lt;br /&gt;
&lt;br /&gt;
On Linux, unzip somewhere suitable, and make an easy way to launch it.&lt;br /&gt;
&lt;br /&gt;
==The first time you run Eclipse==&lt;br /&gt;
&lt;br /&gt;
The first time you launch Eclipse it does a bit of setup stuff, for instance, it create a &#039;&#039;&#039;workspace&#039;&#039;&#039;. This is where it stores the things you are working on. The default location is sensible on all platforms, so use that. &lt;br /&gt;
&lt;br /&gt;
For some reason, every time you start Eclipse, it asks you which workspace you want to use. I have never seen the need to have more than one, so I recommend turning on the checkbox that says &amp;quot;Don&#039;t ask me this again&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Another thing that happens the first time you run Eclipse is that you arrive at a welcome screen. This has links to various bits of help, which you can read if you like, but you probably don&#039;t need to if you are following these instructions. So find the button on the welcome page that closes it and gets you to the main Eclipse screen.&lt;br /&gt;
&lt;br /&gt;
==Installing the necessary plugins==&lt;br /&gt;
&lt;br /&gt;
By default, Eclipse comes with the Java tools. For everything else you will need to install some plugins.&lt;br /&gt;
&lt;br /&gt;
If you are sitting behind a web proxy, from the &#039;&#039;&#039;Window&#039;&#039;&#039; menu choose &#039;&#039;&#039;Preferences ...&#039;&#039;&#039;. Choose &#039;&#039;&#039;Install/Update&#039;&#039;&#039; from the tree view on the left, and enter the proxy information in the boxes on the right. If you aren&#039;t behind a proxy, ignore this step.&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;&#039;Help&#039;&#039;&#039; menu choose &#039;&#039;&#039;Software Updates -&amp;gt; Find and Install&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
On the first screen of the wizard, make sure that &amp;quot;Search for new features to install&amp;quot; is selected, then click &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The next screen is a list of upgrade sites to check. You need to add one to the list, so click the &#039;&#039;&#039;New Remote Site ...&#039;&#039;&#039; Button.&lt;br /&gt;
&lt;br /&gt;
In the pop-up dialog, give the remote site a name like &#039;&#039;&#039;PHPeclipse Update Site&#039;&#039;&#039;; set the URL to http://phpeclipse.sourceforge.net/update/releases/; then click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Back in the wizard, turn on just two things in the box &amp;quot;Sites to include in search&amp;quot;:&lt;br /&gt;
* Your newly created &#039;&#039;&#039;Phpeclipse Update Site&#039;&#039;&#039;; and&lt;br /&gt;
* the one called &#039;&#039;&#039;Callisto Discovery Site&#039;&#039;&#039;.&lt;br /&gt;
Then click &#039;&#039;&#039;Finish&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
It goes off sees what updates are available at those sites. As it does so, it may occasionally pop up a dialog asking you to choose a mirror. Each time, select a sensible one.&lt;br /&gt;
&lt;br /&gt;
Eventually, you get to a new wizard for selecting and installing the updates you want. The ones you want (you may have to search the tree structure) are, &#039;&#039;&#039;PHPeclipse&#039;&#039;&#039; (from your newly created PHPEclipse Update Site) and all the &#039;&#039;&#039;Web Standard Tools (WST)&#039;&#039;&#039; (usually under Callisto Discovery Site --&amp;gt; Web and J2EE Development).&lt;br /&gt;
&lt;br /&gt;
Next, and very importantly, you must click the &#039;&#039;&#039;Select Required&#039;&#039;&#039; button which should resolve dependencies and remove the warning message you are probably worrying about. Then you can click the &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
Read and agree to all the license agreements. Then click &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;Finish&#039;&#039;&#039;, and wait for the plugins to download.&lt;br /&gt;
&lt;br /&gt;
Once the downloads have finished, a warning will pop-up telling you that all the plugins you downloaded are not digitally signed. The Eclipse Foundation build digital signing of plugins into their architecture as a security measure, and then did not sign any of their own plugins! Anyway, click the &#039;&#039;&#039;Install All&#039;&#039;&#039; button.&lt;br /&gt;
&lt;br /&gt;
Finally, a window will pop up asking you to restart Eclipse. Do so.&lt;br /&gt;
&lt;br /&gt;
==Setting the preferences for Moodle development==&lt;br /&gt;
&lt;br /&gt;
Now go to the &#039;&#039;&#039;Window&#039;&#039;&#039; menu, and choose &#039;&#039;&#039;Preferences ...&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The Eclipse preferences are immense, with a tree view on the left, which selects which screen to display on the right. Don&#039;t panic, we&#039;ll guide you through it.&lt;br /&gt;
&lt;br /&gt;
===General settings===&lt;br /&gt;
&lt;br /&gt;
If you have strong feelings about fonts (I would hate to edit code an anything except Andale Mono), choose &#039;&#039;&#039;General -&amp;gt; Appearance -&amp;gt; Colors and Fonts&#039;&#039;&#039; from the tree on the left. Then on the right look under &#039;&#039;&#039;Basic&#039;&#039;&#039; and change &#039;&#039;&#039;Text Font&#039;&#039;&#039;. All the other editor font settings will inherit from this, so this is probably the only one you have to change.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;General -&amp;gt; Content Types&#039;&#039;&#039;, select PHP Source File, and add &#039;&#039;&#039;*.html&#039;&#039;&#039; to the box at the bottom.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;General -&amp;gt; Editors -&amp;gt; File Associations&#039;&#039;&#039;, if it is not already there, add &#039;&#039;&#039;*.php&#039;&#039;&#039; to the top box. With &#039;&#039;&#039;*.php&#039;&#039;&#039; selected in the top box, make sure &#039;&#039;&#039;PHP Editor&#039;&#039;&#039; is set to default in the bottom box. With &#039;&#039;&#039;*.html&#039;&#039;&#039; selected in the top box, select &#039;&#039;&#039;PHP Editor&#039;&#039;&#039; in the bottom box and click the &#039;&#039;&#039;Default&#039;&#039;&#039; button to change it, because in Moodle, most HTML files actually contain PHP code.&lt;br /&gt;
&lt;br /&gt;
If you use a web proxy, enter the details under &#039;&#039;&#039;Internet -&amp;gt; Proxy Settings&#039;&#039;&#039;. (Yes, I know you have entered the somewhere else before. Now you have to enter them again here. I don&#039;t know why. You just do.)&lt;br /&gt;
&lt;br /&gt;
===PHP Settings===&lt;br /&gt;
&lt;br /&gt;
These are all hidden under the &#039;&#039;&#039;PHPeclipse Web Development&#039;&#039;&#039; bit of the tree.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;PHPeclipse Web Development -&amp;gt; Browser Preview Defaults&#039;&#039;&#039;, turn off both checkboxes.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;PHPeclipse Web Development -&amp;gt; PHP&#039;&#039;&#039;, on the &#039;&#039;&#039;Appearance&#039;&#039;&#039; tab, set &#039;&#039;&#039;Displayed tab width&#039;&#039;&#039; to 4.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;PHPeclipse Web Development -&amp;gt; PHP&#039;&#039;&#039;, on the &#039;&#039;&#039;Typing&#039;&#039;&#039; tab, turn off all the options except &#039;&#039;&#039;Pasting for correct indentation&#039;&#039;&#039;, &#039;&#039;&#039;Insert spaces for tab&#039;&#039;&#039; and &#039;&#039;&#039;Close PHPdocs and comments&#039;&#039;&#039; and &#039;&#039;&#039;Remove trailing spaces on editor save&#039;&#039;&#039;. It would be nice to turn on more of these options, but most of the rest don&#039;t work very well.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;PHPeclipse Web Development -&amp;gt; PHP -&amp;gt; Formatter&#039;&#039;&#039;, on the &#039;&#039;&#039;New Lines&#039;&#039;&#039; tab, turn on &#039;&#039;&#039;Clear all blank lines&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;PHPeclipse Web Development -&amp;gt; PHP -&amp;gt; Formatter&#039;&#039;&#039;, on the &#039;&#039;&#039;Style&#039;&#039;&#039; tab, turn off &#039;&#039;&#039;Indentation is represented by a tab&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;PHPeclipse Web Development -&amp;gt; PHP -&amp;gt; Templates&#039;&#039;&#039;, I like to define a new template to help with debugging:&lt;br /&gt;
;Name&lt;br /&gt;
:dump &lt;br /&gt;
;Description&lt;br /&gt;
:Dump a PHP variable&lt;br /&gt;
;Pattern&lt;br /&gt;
&amp;lt;pre&amp;gt;echo &#039;&amp;amp;lt;pre&amp;gt;&#039;; //DONOTCOMMIT&lt;br /&gt;
    print_r(${cursor});&lt;br /&gt;
echo &#039;&amp;amp;lt;/pre&amp;gt;&#039;;&amp;lt;/pre&amp;gt;&lt;br /&gt;
You can do other useful things with templates too.&lt;br /&gt;
&lt;br /&gt;
There is a really stupid bug. Under &#039;&#039;&#039;PHPeclipse Web Development -&amp;gt; Project Defaults&#039;&#039;&#039;, you would like to add &amp;quot;.&amp;quot; to the &#039;&#039;&#039;Include Paths&#039;&#039;&#039;, but you can&#039;t using the GUI. You will have to edit one of the Eclipse config files by hand. So&lt;br /&gt;
# Note down the path to your Eclipse profile. On Windows it will be something like &#039;&#039;&#039;C:/Documents and settings/XXXX/workspace&#039;&#039;&#039;, and on Unixy systems something like &#039;&#039;&#039;~/workspace&#039;&#039;&#039;.&lt;br /&gt;
# Close Eclipse. &lt;br /&gt;
# Open the file &#039;&#039;&#039;net.sourceforge.phpeclipse.ui.prefs&#039;&#039;&#039; that is in the directory &#039;&#039;&#039;(your workspace)/.metadata/.plugins/org.eclipse.core.runtime/.settings&#039;&#039;&#039; in a text editor.&lt;br /&gt;
# Look for a line in the file that starts &#039;&#039;&#039;_php_include_paths=&#039;&#039;&#039; If it is not there, add it at the end.&lt;br /&gt;
# Change this line to say &#039;&#039;&#039;_php_include_paths=.&#039;&#039;&#039;&lt;br /&gt;
# Run Eclipse again.&lt;br /&gt;
&lt;br /&gt;
===CVS Settings===&lt;br /&gt;
&lt;br /&gt;
These are all hidden under the &#039;&#039;&#039;Team&#039;&#039;&#039; bit of the tree.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;Team -&amp;gt; CVS -&amp;gt; SSH2 Connection Method&#039;&#039;&#039;, you can set up a public/private key pair. If you do this, you won&#039;t have to keep typing your Sourceforge password when doing CVS operations. See http://sourceforge.net/docs/F02/ for the instructions of what you have to do at the Sourceforge end to make this work. That should make it clear what you have to do in Eclipse.&lt;br /&gt;
&lt;br /&gt;
The rest of the ones in this section are personal preferences, but I recommend them because the default settings are very irritating.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;Team&#039;&#039;&#039;, set &#039;&#039;&#039;Perspectives&#039;&#039;&#039; to &#039;&#039;&#039;None&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;Team -&amp;gt; CVS -&amp;gt; Annotate&#039;&#039;&#039; set &#039;&#039;&#039;Use Quick Diff annotate mode for local file annotations&#039;&#039;&#039; to &#039;&#039;&#039;Yes&#039;&#039;&#039;, and &#039;&#039;&#039;Open perspective after a &#039;Show Annotations&#039; operation&#039;&#039;&#039; to &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;Team -&amp;gt; CVS -&amp;gt; Label Decorations&#039;&#039;&#039;, switch to the &#039;&#039;&#039;Icon Decorations&#039;&#039;&#039; tab and turn on all the settings, and then on the &#039;&#039;&#039;Text Decorations&#039;&#039;&#039; tab change both &#039;&#039;&#039;File Decoration&#039;&#039;&#039; and &#039;&#039;&#039;Folder Decoration&#039;&#039;&#039; to be just &#039;&#039;&#039;{name}&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Web and XML settings===&lt;br /&gt;
&lt;br /&gt;
Foreach XXX in CSS, HTML, Javascript, XML:&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;Web and XML -&amp;gt; XXX Files -&amp;gt;XXX Source&#039;&#039;&#039;, choose &#039;&#039;&#039;Indent using spaces&#039;&#039;&#039; and &#039;&#039;&#039;indentation size&#039;&#039;&#039; 4.&lt;br /&gt;
&lt;br /&gt;
==Checking out the Moodle code==&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;&#039;File&#039;&#039;&#039; menu, choose &#039;&#039;&#039;New -&amp;gt; Project ...&#039;&#039;&#039;, then click &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
In the wizard that pops up, choose &#039;&#039;&#039;CVS -&amp;gt; Projects from CVS&#039;&#039;&#039;, then click &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Select &#039;&#039;&#039;Create a new repository location&#039;&#039;&#039;, then click &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Fill in&lt;br /&gt;
&amp;lt;div style=&amp;quot;float: right; border: 1px solid orange; padding: 0 1em;&amp;quot;&amp;gt;&lt;br /&gt;
For anonymous CVS access use&lt;br /&gt;
;Host&lt;br /&gt;
:moodle.cvs.sourceforge.net&lt;br /&gt;
;Repository path&lt;br /&gt;
:/cvsroot/moodle&lt;br /&gt;
;User&lt;br /&gt;
:anonymous&lt;br /&gt;
;Password&lt;br /&gt;
:(leave blank)&lt;br /&gt;
;Connection type&lt;br /&gt;
:pserver&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
;Host&lt;br /&gt;
:moodle.cvs.sourceforge.net&lt;br /&gt;
;Repository path&lt;br /&gt;
:/cvsroot/moodle&lt;br /&gt;
;User&lt;br /&gt;
:(your sourceforge username)&lt;br /&gt;
;Password&lt;br /&gt;
:(if you set up the SSH2 key thing in preferences, leave this blank, otherwise, type in your sourceforge password.)&lt;br /&gt;
;Connection type&lt;br /&gt;
:extssh&lt;br /&gt;
(CVS experts, if you are confused by that last one, know it is an Eclipse-specific thing.) Then click &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
On the next screen of the Wizard, choose &#039;&#039;&#039;Use an existing module&#039;&#039;&#039;. Wait a moment, then select &#039;&#039;&#039;moodle&#039;&#039;&#039; from the list. Click &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
On the next screen, make sure the option &#039;&#039;&#039;Check out as a project configured using the New Project Wizard&#039;&#039;&#039; is selected, then click &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;Refresh Tags&#039;&#039;&#039;, then choose the branch you want. For now leave it set to &#039;&#039;&#039;HEAD&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;Finish&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now you  will find yourself back at the start of the &#039;&#039;&#039;New Project&#039;&#039;&#039; Wizard. This is because of the option you chose three paragraphs ago. This time you should select &#039;&#039;&#039;PHP -&amp;gt; PHP Project&#039;&#039;&#039;, then click &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Make up a project name. &#039;&#039;&#039;moodle&#039;&#039;&#039; would be sensible.&lt;br /&gt;
&lt;br /&gt;
Click &#039;&#039;&#039;Finish&#039;&#039;&#039;, and wait while all the moodle files are checked out of CVS.&lt;br /&gt;
&lt;br /&gt;
Once it has finished, it will probably ask you if you want to switch to the PHP perspective. Answer &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you also need the 1.6 stable branch, or another branch, repeat all the other steps with a few changes:&lt;br /&gt;
* This time you can choose &#039;&#039;&#039;Use and existing repository location&#039;&#039;&#039; instead of typing all the sourceforge CVS details again.&lt;br /&gt;
* Select the appropriate branch.&lt;br /&gt;
* Use a different project name.&lt;br /&gt;
&lt;br /&gt;
==Let your development web server know where your files are==&lt;br /&gt;
&lt;br /&gt;
Either by editing you web server&#039;s config files, or using a symbolic link. Make sure your webserver can see your new working set of files at a sensible URL, so you can test the code you are working on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Quick tour of some cool features, and remaining configuration changes==&lt;br /&gt;
&lt;br /&gt;
I find the default workbench setup is pretty good. Here is a quick guide to some of the bits.&lt;br /&gt;
&lt;br /&gt;
===Navigator===&lt;br /&gt;
&lt;br /&gt;
To the left is the &#039;&#039;&#039;Navigator&#039;&#039;&#039;. This is a tree view of all your files. If you double-click on a file, it opens in the editor in the middle. Try opening &#039;&#039;&#039;course/lib.php&#039;&#039;&#039; now. You will notice that it comes up nicely syntax-hightlighted.&lt;br /&gt;
&lt;br /&gt;
===Error highlighting===&lt;br /&gt;
&lt;br /&gt;
In the middle of the file, just type any old text, for example &amp;quot;I like Eclipse&amp;quot;. Obviously, this is not valid PHP syntax, and Eclipse will notice this, and put a red underline under it. Also, by the scrollbar is a ruler with a red mark in it to show the error.&lt;br /&gt;
&lt;br /&gt;
You will see some yellow marks lower down the ruler. There are warnings. Click on one, and you will be taked to where that warning is in the file. Hover your mouse over the warning, and you will get a tooltip explaining what the problem might be.&lt;br /&gt;
&lt;br /&gt;
Save the edited file. (Don&#039;t worry that it is broken, we&#039;ll clean up the mess later.) Notice that a red error marker is added to the file in the navigator, so you can see that there is a problem. Also, error markers are added to the course folder, and the whole project, so you could see there was an error even if the navigator tree was collapsed.&lt;br /&gt;
&lt;br /&gt;
You will probably find lots of warnings that the config.php file can&#039;t be found. In the navigator, find the file &#039;&#039;&#039;config-dist.php&#039;&#039;&#039;. Do &#039;&#039;&#039;Copy&#039;&#039;&#039; then &#039;&#039;&#039;Paste&#039;&#039;&#039; and choose to call the new file &#039;&#039;&#039;config.php&#039;&#039;&#039;. Edit this new config.php as normal. You should fine that most of the include file warnings have gone now.&lt;br /&gt;
&lt;br /&gt;
Notice also that there is another marker on each file icon. A little yellow cylinder on most files, but a white-on-brown star on the one you have edited. This is telling you the CVS status of each file. The brown stars are changes you have made but not checked in yet.&lt;br /&gt;
&lt;br /&gt;
===Outline===&lt;br /&gt;
&lt;br /&gt;
Over to the right is the Outline view. This shows a list of functions and classes defined in this file. By default, they are listed in the same order as in the file, but if you click on the &#039;&#039;&#039;az&#039;&#039;&#039; toolbar button, they are sorted into alphabetical order.&lt;br /&gt;
&lt;br /&gt;
Click on the function name &#039;&#039;&#039;add_course_module&#039;&#039;&#039; in the Outline. You will see that the editor scrolls to the definition of that function.&lt;br /&gt;
&lt;br /&gt;
===Code navigation===&lt;br /&gt;
&lt;br /&gt;
In that function, hover the mouse pointer over the function name &#039;&#039;&#039;insert_record&#039;&#039;&#039;. After a while, the documentation for that function will appear in a big tooltip.&lt;br /&gt;
&lt;br /&gt;
Hold down CTRL, move the mouse pointer over the function name &#039;&#039;&#039;insert_record&#039;&#039;&#039;, then click. Eclipse should load &#039;&#039;&#039;dmllib.php&#039;&#039;&#039;, and scroll you to where this function is defined.&lt;br /&gt;
&lt;br /&gt;
In the main Eclipse toolbar, there are forward and back arrows like in a web browser. Click back now to get back to &#039;&#039;&#039;course/lib.php&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
===Open resource===&lt;br /&gt;
&lt;br /&gt;
From the &#039;&#039;&#039;Navigate&#039;&#039;&#039; menu, choose &#039;&#039;&#039;Open Resource...&#039;&#039;&#039;. In the dialog that pops up, start typing a filename for instance type &#039;&#039;&#039;moodlel&#039;&#039;&#039;. In the box in the middle of the dialog, you will see it list all the files in the project whose names start that way. At the bottom is a box which lists the different folders that contain a file with that name. This can be a very quick way of opening files with fairly unique names like moodlelib.php, without having to click through the levels of the navigator tree. Of course, it is not so useful for an index.php file! Click OK now to open moodlelib.php. (It would actually work if you just did CTRL + Shift + R, moodlel, Enter.)&lt;br /&gt;
&lt;br /&gt;
===Multi-file search===&lt;br /&gt;
&lt;br /&gt;
Scroll down moodlelib a little bit, and double click on the name of the constant &#039;&#039;&#039;MOODLE_INTERNAL&#039;&#039;&#039; where it is defined, so that the text is selected. Then, from the &#039;&#039;&#039;Search&#039;&#039;&#039; menu, choose &#039;&#039;&#039;Search...&#039;&#039;&#039;. Notice that the &#039;&#039;&#039;Containing text&#039;&#039;&#039; box has already been filled in for you with the text you just selected. Of course you can just type text into this box without selecting it first. Notice that you can do regular expression searches, but leave that turned off for now. In the &#039;&#039;&#039;File name patterns&#039;&#039;&#039; box type &#039;&#039;&#039;*.css, *.html, *.inc, *.js, *.php, *.xml&#039;&#039;&#039;. (This is the most useful general setting for working on moodle. Eclipse will remember this setting, so you only have to enter it once.) Click &#039;&#039;&#039;Search&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The search results will appear in a new view underneath the editor. That view has a toolbar with yellow up and down arrows. Click the down arrow a few times and it will take you to the first few matches in the code, opening the relevant files as necessary.&lt;br /&gt;
&lt;br /&gt;
===Synchronize view===&lt;br /&gt;
&lt;br /&gt;
I think this is my favorite feature. From the &#039;&#039;&#039;Window&#039;&#039;&#039; menu, select &#039;&#039;&#039;Show View -&amp;gt; Other...&#039;&#039;&#039;. In the dialog that pops up, select &#039;&#039;&#039;Team -&amp;gt; Synchronize&#039;&#039;&#039;, then click &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This opens the Synchronize view below the editor. The view has a toolbar. Click on the first toolbar button, which pops up the Synchronize wizard.&lt;br /&gt;
&lt;br /&gt;
On the first screen, there will probably only be one option: &#039;&#039;&#039;CVS&#039;&#039;&#039;. Make sure that is selected, then click &#039;&#039;&#039;Next &amp;gt;&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Under &#039;&#039;&#039;Scope&#039;&#039;&#039;, choose &#039;&#039;&#039;Workspace&#039;&#039;&#039;, then click &#039;&#039;&#039;Finish&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Wait while it talks to the CVS server. After a while, you will see that the Synchronize view lists course/lib.php, and something called &#039;&#039;&#039;.project.... That is, it is listing just the files you have edited, but not checked in yet.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;.project&#039;&#039;&#039; is something that belongs to Eclipse that we don&#039;t care about. So select it and bring up the context menu, and choose &#039;&#039;&#039;Add to .cvsignore...&#039;&#039;&#039;. In the dialog that pops up, choose the top option, then click &#039;&#039;&#039;OK&#039;&#039;&#039;. Then you will find the Synchronize view shows you a &#039;&#039;&#039;.cvsignore&#039;&#039;&#039; file that you aren&#039;t interested in, so add that to .cvsignore too!&lt;br /&gt;
&lt;br /&gt;
If you double-click on &#039;&#039;&#039;course/lib.php&#039;&#039;&#039; here, you will see that it opens the compare editor, which is a nice graphical display of the changes in this file.&lt;br /&gt;
&lt;br /&gt;
If you select a file or files here, then bring up the context menu, you will see the option to &#039;&#039;&#039;Commit...&#039;&#039;&#039; the changes. (But don&#039;t do that now!). This is the easiest way to commit things in Eclipse.&lt;br /&gt;
&lt;br /&gt;
However, our changes were rubbish, so we want to undo them. So open the context menu again, and choose &#039;&#039;&#039;Override and Update&#039;&#039;&#039;. This checks a clean copy of the file out of CVS, removing our changes.&lt;br /&gt;
&lt;br /&gt;
Note that the easiest way to do an ordinary CVS Update is to select the top-level project-folder in the Navigator view on the left, open the context menu, and choose &#039;&#039;&#039;Team -&amp;gt; Update&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
That&#039;s all the really important features. I sure you can learn everything else on your own. An you could always read the built in help!&lt;br /&gt;
&lt;br /&gt;
===Creating a patch===&lt;br /&gt;
&lt;br /&gt;
In the synchronise view, right click on an item (file or folder) and choose &#039;&#039;&#039;Create Patch...&#039;&#039;&#039;. Or in the navigator, right click on an item and choose &#039;&#039;&#039;Team -&amp;gt; Create Patch...&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
This brings up a two-page wizard. On the first page you can select where you want the patch made. For small patches it can be useful to create them on the clipboard, but normally you will want to save them in a file.&lt;br /&gt;
&lt;br /&gt;
On the second page, you can set some options, but normally you don&#039;t need to change the defaults which are &#039;&#039;&#039;Unified&#039;&#039;&#039; diff format, and Patch root set to &#039;&#039;&#039;Workspace&#039;&#039;&#039;. Well, sometimes it is helpful to change the second one to &#039;&#039;&#039;Project&#039;&#039;&#039; but it is not important.&lt;br /&gt;
&lt;br /&gt;
There is a corresponding apply patch wizard that you can use to apply a patch to a project.&lt;/div&gt;</summary>
		<author><name>Chad.burrus</name></author>
	</entry>
</feed>