Note:

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

Core APIs: Difference between revisions

From MoodleDocs
Line 95: Line 95:
===tag===
===tag===


The [[Tags API]] allows you to store tags (and a tag cloud) to items in your module.
The [[Tag API]] allows you to store tags (and a tag cloud) to items in your module.


===time===
===time===

Revision as of 03:39, 12 January 2012

Moodle has a number of core APIs that provide tools for Moodle scripts.

They are implemented in different ways, but they are essential when writing Moodle plugins.

Critical APIs

These APIs are the most-used and will be found in nearly every Moodle plugin.

access

The Access API gives you functions so you can determine what the current user is allow to do, and it allows modules to extend Moodle with new capabilities.

dml

The Data modification API allows you to read/write to databases in a consistent and safe way.

files

The File API controls the storage of files in connection to various plugins.

form

The Form API defines and handles user data via web forms.

log

The Logging API allows you to add new entries to the Moodle log and define how they get displayed in reports.

navigation

The Navigation API allows you to manipulate the navigation tree to add and remove items as you wish.

page

The Page API is used to set up the current page, add JavaScript, and configure how things will be displayed to the user.

output

The Output API is used to render the HTML for all parts of the page.

string

The String API is how you get language text strings to use in the user interface. It handles any language translations that might be available.

upgrade

The Upgrade API is how your module installs and upgrades itself, by keeping track of it's own version.

Other General APIs

backup

The Backup API defines exactly how to convert course data into XML for backup purposes, and the Restore API describes how to convert it back the other way.

calendar

The Calendar API allows you to add and modify events in the calendar for user, groups, courses, or the whole site.

comment

The Comment API allows you to save and retrieve user comments, so that you can easily add commenting to any of your code.

ddl

The Data definition API is what you use to create, change and delete tables and fields in the database during upgrades.

event

The Events API allows to define "events" with payload data to be fired whenever you like, and it also allows you to define handlers to react to these events when they happen. This is the recommended form of inter-plugin communication.

external

The External functions API allows you to create fully parametrised methods that can be accessed by external programs (such as Web services).

message

The Message API lets you post messages to users. They decide how they want to receive them.

preference

The Preference API is a simple way to store and retrieve preferences for individual users.

portfolio

The Portfolio API allows you to add portfolio interfaces on your pages and allows users to package up data to send to their portfolios.

rating

The Rating API lets you create AJAX rating interfaces so that users can rate items in your plugin. In an activity module, you may choose to aggregate these to form grades.

rss

The RSS API allows you to create secure RSS feeds of data in your module.

tag

The Tag API allows you to store tags (and a tag cloud) to items in your module.

time

The Time API takes care of translating and displaying times between users in the site.

webservice

The Web services API allows you to expose particular functions (usually external functions) as web services.


Plugin APIs

These APIs are used when writing plugins of various kinds.

mod

Activity modules are the most important plugin in Moodle. There are several core APIs that service only Activity modules.

activity_completion

The Activity completion API is to indicate to the system how activities are completed.

conditional

The Conditional activities API is so you can tell the system how to show or hide the activity automatically.

group

The Groups API allows you to check the current activity group mode and set the current group.

grade

The Gradebook API allows you to read and write from the gradebook. It also allows you to provide an interface for detailed grading information.

grading

The Advanced grading API allows you to add more advanced grading interfaces (such as rubrics) that can produce simple grades for the gradebook.


auth

enrol

message

block

filter

editor

format

profilefield

report

coursereport

gradeexport

gradeimport

gradereport

gradingform

mnetservice

repository

portfolio

qbehaviour

qformat

qtype

plagiarism

tool

theme