• About
    • What is Moodle?
    • Moodle.org: Moodle Statistics
    • Demonstration site
  • News
    • Recent news
    • Security news
    • Planet Moodle
    • Moodle Buzz
    • Calendar
  • Support
    • Documentation
    • Forums
    • Books and manuals
    • Commercial services
  • Community
    • Forums
    • Events
    • Registered sites
    • Connected sites
    • Moodle Jobs
    • Recent participants
    • Donations
    • Moodle Shop
  • Development
    • Developers
    • Developer documentation
    • Moodle Tracker
    • Open source code
  • Downloads
    • Moodle standard packages
    • Plugins
    • Language packs
    • Moodle logos

You are here

Developer documentation

From MoodleDocs
Jump to: navigation, search

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

spacer

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.


Contents

  • 1 How Moodle development works
  • 2 Guidelines
    • 2.1 Core components
  • 3 Documentation for core components
    • 3.1 Reference for core components
    • 3.2 Modules included in the standard distribution
  • 4 How you can contribute
    • 4.1 Make a new plugin
    • 4.2 Change core code
    • 4.3 Ways to contribute that do not involve PHP programming
  • 5 Plans for the future
  • 6 Resources
  • 7 Tools
    • 7.1 IDEs
    • 7.2 Browser add-ons
    • 7.3 Miscellaneous
  • 8 See also

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:

  • 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 explains how to engage with the dev community and discuss changes
  • Unit tests explains how to run the unit tests, and how to write new test cases.
  • 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

  • Database abstraction layer
  • Roles and Capabilities system for controlling who can do what
  • Forms library for creating accessible and secure HTML forms that let users edit things
  • File API for managing files stored by Moodle
  • The database schema
  • What happens when you require config.php
  • lib/moodlelib.php
  • lib/weblib.php for outputting stuff

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

  • Lesson Specification
  • Quiz module
  • SCORM module 1.5 schema

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:

  • Activity modules, see also NEWMODULE Documentation (work in progress)
    • and Sub-Plugins (2.0 Onwards)
  • Admin reports
  • Assignment types
  • Authentication plugins
  • Blocks
  • Content editors (2.0 onwards)
  • Course Formats
  • Course reports
  • Course importers (2.0 onwards)
  • Database fields
  • Database presets
  • Enrolment plugins
  • Filters
  • Gradebook report
  • Gradebook export
  • Gradebook import
  • Messaging providers/consumers (2.0 onwards)
  • Mnet services
  • Plagiarism detection plugins (2.0 onwards)
  • Portfolio plugins (2.0 onwards)
  • Question types
  • Question import/export formats
  • Quiz reports
  • Repository plugins (2.0 onwards)
  • Resource types
  • Search engine adapters
  • Themes which are different in Moodle 2.0, and earlier versions.
  • User profile fields
  • Web services (2.0 onwards)
  • Workshop allocators (2.0 onwards)
  • Workshop forms (2.0 onwards)
  • Workshop evaluators (2.0 onwards)

General information that applies to all types of plugins

  • Where to put language strings for your plugin
  • Defining the database tables for your plugin

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

  • Create Moodle themes
  • Translate Moodle into other languages
  • Help document Moodle
  • Join the testing effort, which involves participating in the bug tracker

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.

  • Roadmap
  • Developer notes
  • Student projects
  • Developer meetings

Resources

  • Developer FAQ - frequently asked questions, especially useful for newcomers to Moodle
  • Finding your way into the Moodle code - also aimed at newcomers
  • Moodle tracker - bug reports, feature requests and other tracked issues
    • Firefox tracker search - How to setup a firefox quicksearch to easily navigate to moodle bugs
    • Firefox Search Plugins - Find tracked issues even more easily
  • Unmerged files - changes on the stable branch in CVS that have not been merged to HEAD
  • Browse the code online:
    • the code with a complete change history from CVS
    • the code, with links generated by PHPXref
  • Moodle PHP doc reference - compiled nightly from the comment attached to each class and function in the code.
  • Database Schema - for recent releases
  • Development news and discussion section of Using Moodle course
    • especially the General developer forum
    • cool tricks you can use in the moodle.org forums

Tools

Some tools people use when working on Moodle code:

IDEs

  • Setting up NetBeans for Moodle development - NetBeans for PHP is a great out-of-the-box editor.
  • 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.
  • Setting up Vim for Moodle development
  • Aptana Studio 2
  • phpStorm - PHP Editor, XDEBUG, CSS-X-FIRE, GIT, File/Folder compare, Advanced Find & Replace, MySQL Integration...

Browser add-ons

  • Firebug, see Firebug for details.
  • Web developer extension
  • ViewSourceWith - The main goal is to view page source with external applications, but you can do a lot of other things as well.

Miscellaneous

  • Ctags - Using a tags file to navigate code
  • W3C HTML validator - Moodle has built in support to make using it easier.
  • Windows Installer - Windows Installer documentation for developer.

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

See also

  • Moodle Security Announcements
  • Moodle Partners - providers of custom Moodle development services
  • Migrating contrib code to 2.0
Retrieved from "docs.moodle.org/dev/Developer_documentation"
Views
  • Page
  • Discussion
  • Edit
  • View source
  • History
Personal tools
  • Log in
Navigation
  • Main page
  • Recent changes
Toolbox
  • What links here
  • Related changes
  • Special pages
  • Printable version
User docs (English)
  • Moodle Docs 2.3
  • Moodle Docs 2.2
  • Moodle Docs 2.1
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.