Note:

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

Developer documentation: Difference between revisions

From MoodleDocs
m (→‎Make a new plugin: + admin tools)
(39 intermediate revisions by 16 users not shown)
Line 1: Line 1:
<p class="note">'''Note:''' The Dev docs are currently being split from the User docs. During this time you will see quite a few red links.</p>
[[image:moodle-development-logo.jpg|right|400px]]
[[image:moodle-development-logo.jpg|right|400px]]


This [[:Category:Developer|Developer]] section of Moodle Docs is aimed at developers who contribute to the Moodle code, plugins, themes, and so on.
This Developer section of Moodle Docs is aimed at developers who contribute to the Moodle code, plugins, themes, and so on.


* If you manage a Moodle site, [[Administrator documentation]] may suit your needs better.
If you manage a Moodle site, or if you teach using Moodle, try the [[:en:Main_page|User docs]].
* If you teach using Moodle, try [[Teacher documentation]].
<br />
<p class="note">'''Note:''' New developer documentation pages should be added to the ''Development namespace'' by typing <code>Development:</code> before the new page name i.e. <code><nowiki>[[New page name]]</nowiki></code>. If you are a developer, you probably want to change your [[Special:Preferences|preferences]] to include the Development namespace in searches.<br /><br />


A page may be added to the Developer category by adding the template <code><nowiki>{{CategoryDeveloper}}</nowiki></code> to the bottom of the page. - If required, you can use <code><nowiki>[[Category:Sort key]]</nowiki></code> to provide a sort key other than the default page name.</p>


== Speaking in English E-Learning Course ==
==How Moodle development works==


Speaking in English E-Learning Course
The [[Overview|overview of the Moodle development process]] explains how Moodle development occurs and how people become Moodle developers. Current plans are listed on the [[Roadmap]].


== Speaking in English E-Learning Course ==
You can also enrol in one of the [http://dev.moodle.org Moodle Developer Courses].


Speaking in English E-Learning Course
==Guidelines==
 
The following guidelines are crucial reading for anyone wanting to contribute to the Moodle code base:
*[[Coding|Coding guidelines]] have to be followed by all Moodle developers
*[[Moodle architecture]] gives an overview of how the Moodle code works
*[[Process]] explains how changes are incorporated into Moodle
*[[Tracker guide]] explains the Moodle Tracker for keeping track of bugs, issues, feature requests etc
*[[Working with the Community|Working with the Community]] explains how to engage with the dev community and discuss changes
*[[Unit tests|Unit tests]] explains how to run the unit tests, and how to write new test cases.
*[[Profiling PHP|Profiling PHP]] how to analyse your code to find out why it is slow.
*[[Fast portable SQL]] shows SQL techniques that are fast, efficient, and known to work on all supported DBs.
*[[Development hints and tips]] a (developing) list of general wisdom to help with your Moodle projects.
 
===Core components ===
 
*[[XMLDB_Documentation|Database abstraction layer]]
*[[Roles|Roles and Capabilities system]] for controlling who can do what
*[[lib/formslib.php|Forms library]] for creating accessible and secure HTML forms that let users edit things
*[[Using_the_file_API|File API]] for managing files stored by Moodle
*[[Database schema introduction|The database schema]]
*[[What happens when you require config.php|What happens when you require config.php]]
*[[lib/moodlelib.php|lib/moodlelib.php]]
*[[lib/weblib.php|lib/weblib.php]] for outputting stuff


==Documentation for core components==
==Documentation for core components==
Line 26: Line 46:
And don't forget that the most up-to-date and detailed description of how the code works is the code itself, and you can [http://xref.moodle.org/nav.html?index.html browse the code online] using [[PHPXref|PHPXref]].
And don't forget that the most up-to-date and detailed description of how the code works is the code itself, and you can [http://xref.moodle.org/nav.html?index.html browse the code online] using [[PHPXref|PHPXref]].


===Core components ===
===Reference for core components===


*[[XMLDB_Documentation|Database abstraction layer]] @ v[[1.7]]
This section is for those who may not be developers in the traditional sense, but often work under the hood with Moodle. Maybe they are sometimes know and amateurs or code hackers.
*[[Roles|Roles and Capabilities system]] @ v[[1.7]] for controlling who can do what
*[[lib/formslib.php|Forms library]] @ v[[1.8]] for creating accessible and secure HTML forms that let users edit things
*[[Using_the_file_API|File API]] @ v[[2.0]] for managing files stored by Moodle
*[[Database schema introduction|The database schema]]
*[[What happens when you require config.php|What happens when you require config.php]]
*[[lib/moodlelib.php|lib/moodlelib.php]]
*[[lib/weblib.php|lib/weblib.php]] for outputting stuff


===Core libraries with a more specific uses===
[[Reference|Reference]]
 
*[[Authentication API]]
*[[Cookieless Sessions]]
*[[Email processing]]
*[[Environment checking|Environment checking]] before install, check the user's server to ensure Moodle will work there.
*[[Groups|Groups system]]
*[[Grades|Gradebook]]
*[[Moodle Network|Moodle Network]]
*[[Question engine]]
*[[Stats package]]
*[[UTF-8 migration|Migration to UTF-8]] @ v[[:Category:Moodle 1.6|1.6]]
*[http://developer.yahoo.com/yui YUI JavaScript library] - YUI was selected as the official AJAX library for Moodle.
*[[lib/graphlib|lib/graphlib]]
*[[Admin settings|Admin settings]]


===Modules included in the standard distribution===
===Modules included in the standard distribution===


*[[Lesson Specification|Lesson Specification]]
*[[Lesson Specification|Lesson Specification]]
*[[Quiz developer docs|Quiz module]]
*[[Quiz|Quiz module]]
*[[SCORM schema|SCORM module 1.5 schema]]
*[[SCORM schema|SCORM module 1.5 schema]]


Line 66: Line 65:
*[[Modules|Activity modules]], see also [[NEWMODULE Documentation]] (work in progress)
*[[Modules|Activity modules]], see also [[NEWMODULE Documentation]] (work in progress)
**and [[Subplugins|Sub-Plugins]] (2.0 Onwards)
**and [[Subplugins|Sub-Plugins]] (2.0 Onwards)
*[[Admin reports|Admin reports]]
*[[Admin reports|Admin reports]] (deprecated since 2.2)
*[[Admin tools]]
*[[Assignment types|Assignment types]]
*[[Assignment types|Assignment types]]
*[[Authentication plugins|Authentication plugins]]
*[[Authentication plugins|Authentication plugins]]
*[[Blocks|Blocks]]
*[[Blocks|Blocks]]
*Content editors (2.0 onwards)
*Content editors (2.0 onwards)
*[[Course formats]]
*[[Course Format|Course Formats]]
*[[Course Report Plugins|Course reports]]
*[[Course Report Plugins|Course reports]]
*Course importers (2.0 onwards)
*Course importers (2.0 onwards)
*[[Database fields|Database fields]]
*[[Database fields|Database fields]]
*[[Database presets|Database presets]]
*[[:en:Database presets|Database presets]]
*[[Enrolment plugins|Enrolment plugins]]
*[[Enrolment plugins|Enrolment plugins]]
*[[Filters|Filters]]
*[[Filters|Filters]]
Line 81: Line 81:
*[[Gradebook export|Gradebook export]]
*[[Gradebook export|Gradebook export]]
*[[Gradebook import|Gradebook import]]
*[[Gradebook import|Gradebook import]]
*Message senders (2.0 onwards)
*[[Messaging_2.0|Messaging providers/consumers]] (2.0 onwards)
*Mnet services
*Mnet services
*Plagiarism detection plugins (2.0 onwards)
*Plagiarism detection plugins (2.0 onwards)
Line 88: Line 88:
*[[Question import/export formats|Question import/export formats]]
*[[Question import/export formats|Question import/export formats]]
*[[How to write a quiz report plugin|Quiz reports]]
*[[How to write a quiz report plugin|Quiz reports]]
*Report plugins
*[[Repository plugins|Repository plugins]] (2.0 onwards)
*[[Repository plugins|Repository plugins]] (2.0 onwards)
*[[Resource types|Resource types]]
*[[Resource types|Resource types]]
Line 107: Line 108:


===Change core code===
===Change core code===
Some types of change can only be made by editing the core Moodle code. Such changes are much harder to maintain than plugins. If you want your core change to be considered for inclusion in the official Moodle release, you need to create an issue in the [[Tracker|tracker]], and attach your change as a [[How_to_create_a_patch|patch]]. It is also a good idea to discuss your ideas in the forums first.  See [[Overview#Major_Development]] for more details.


===Ways to contribute that do not involve PHP programming===
===Ways to contribute that do not involve PHP programming===


*[[Themes|Create Moodle themes]]
*[[Theme development|Create Moodle themes]]
*[[Translation|Translate Moodle into other languages]]
*[[:en:Translation|Translate Moodle into other languages]]
*[[MoodleDocs:Guidelines for contributors|Help document Moodle]]
*[[:en:MoodleDocs:Guidelines for contributors|Help document Moodle]]
*[[Tests|Join the testing effort]], which involves [[Tracker|participating in the bug tracker]]
*[[Testing|Join the testing effort]], which involves [[Tracker|participating in the bug tracker]] and writing [[Acceptance testing|automated tests]] that will run weekly in our servers ([[Acceptance_testing/Contributing_automated_tests|guidelines for contributors]])


==Plans for the future==
==Plans for the future==
Line 137: Line 136:
*[[Unmerged files]] - changes on the stable branch in CVS that have not been merged to [[HEAD]]
*[[Unmerged files]] - changes on the stable branch in CVS that have not been merged to [[HEAD]]
*Browse the code online:
*Browse the code online:
**[http://cvs.moodle.org/moodle/ the code with a complete change history from CVS]
**[http://github.com/moodle/moodle/tree/master the code with complete change history (git)]
**[http://xref.moodle.org/index.html the code, with links generated by PHPXref]
*[http://phpdocs.moodle.org/ Moodle PHP doc reference] - [Out of date]
*[http://phpdocs.moodle.org/ Moodle PHP doc reference] - compiled nightly from the comment attached to each class and function in the code. 
*[[Database Schema|Database Schema]] - for recent releases
*[[Database Schema|Database Schema]] - for recent releases
*[http://moodle.org/course/view.php?id=5#4 Development news and discussion] section of Using Moodle course
*[http://moodle.org/course/view.php?id=5#4 Development news and discussion] section of Using Moodle course
**especially the [http://moodle.org/mod/forum/view.php?id=55 General developer forum]
**especially the [http://moodle.org/mod/forum/view.php?id=55 General developer forum]
**[[Filters used on the Moodle.org forums|cool tricks you can use in the moodle.org forums]]
**[[:en:Filters used on the Moodle.org forums|cool tricks you can use in the moodle.org forums]]


== Tools ==
== Tools ==
Line 154: Line 152:
* [[vim|Setting up Vim for Moodle development]]
* [[vim|Setting up Vim for Moodle development]]
* [http://www.aptana.com/ Aptana Studio 2]
* [http://www.aptana.com/ Aptana Studio 2]
* [http://www.jetbrains.com/phpstorm/ phpStorm] - PHP Editor, XDEBUG, CSS-X-FIRE, GIT, File/Folder compare, Advanced Find & Replace, MySQL Integration...


=== Browser add-ons ===
=== Browser add-ons ===
Line 164: Line 163:
*[[W3C_validation|W3C HTML validator]] - Moodle has built in support to make using it easier.
*[[W3C_validation|W3C HTML validator]] - Moodle has built in support to make using it easier.
*[[Windows Installer|Windows Installer]] - Windows Installer documentation for developer.
*[[Windows Installer|Windows Installer]] - Windows Installer documentation for developer.
*[[Moodle_Development_kit|Moodle Development kit]] - A set of tools for Moodle development.


See also: [http://dev.moodle.org/mod/forum/view.php?id=18 Useful Development Tools forum]in the [http://dev.moodle.org/course/view.php?id=2 Introduction to Moodle Programming course]
See also: [http://dev.moodle.org/mod/forum/view.php?id=18 Useful Development Tools forum]in the [http://dev.moodle.org/course/view.php?id=2 Introduction to Moodle Programming course]
Line 171: Line 171:
*[http://moodle.org/security/ Moodle Security Announcements]
*[http://moodle.org/security/ Moodle Security Announcements]
*[http://moodle.com/partners/ Moodle Partners] - providers of custom Moodle development services
*[http://moodle.com/partners/ Moodle Partners] - providers of custom Moodle development services
 
*[[Migrating contrib code to 2.0]]


[[Category:Developer tools]]
[[Category:Developer tools]]
[[ru:Development:Краткий обзор]]

Revision as of 15:29, 15 April 2014

Note: The Dev docs are currently being split from the User docs. During this time you will see quite a few red links.

moodle-development-logo.jpg

This Developer section of Moodle Docs is aimed at developers who contribute to the Moodle code, plugins, themes, and so on.

If you manage a Moodle site, or if you teach using Moodle, try the User docs.


How Moodle development works

The overview of the Moodle development process explains how Moodle development occurs and how people become Moodle developers. Current plans are listed on the Roadmap.

You can also enrol in one of the Moodle Developer Courses.

Guidelines

The following guidelines are crucial reading for anyone wanting to contribute to the Moodle code base:

Core components

Documentation for core components

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.

The documents below give a general overview. For detailed function-by-function documentation, see the phpDocumentor documentation that is automatically generated from the comments in the code.

And don't forget that the most up-to-date and detailed description of how the code works is the code itself, and you can browse the code online using PHPXref.

Reference for core components

This section is for those who may not be developers in the traditional sense, but often work under the hood with Moodle. Maybe they are sometimes know and amateurs or code hackers.

Reference

Modules included in the standard distribution

How you can contribute

Make a new plugin

The M in Moodle stands for modular, and the easiest, most maintainable way to add new functionality to Moodle is by using one of the many plugin APIs. There are many types of plugin you can write:

General information that applies to all types of plugins

Please see the Guidelines for contributed code for an overview of how to contribute to the Moodle code.

Sometimes it is not possible to write a proper plugin for what you want to do, in which case you may have to resort to using the local customisations hook.

Change core code

Ways to contribute that do not involve PHP programming

Plans for the future

Ideas for and details of planned future features of Moodle are initially discussed on the forums in the 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.

Once ideas begin to crystallize 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.

Resources

Tools

Some tools people use when working on Moodle code:

IDEs

Browser add-ons

Miscellaneous

See also: Useful Development Tools forumin the Introduction to Moodle Programming course

See also