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
No edit summary
No edit summary
Line 1: Line 1:
Moodle has a number of core APIs that provide tools for Moodle scripts.
Moodle has a number of core APIs that provide tools for Moodle scripts.


==APIs used by all Moodle scripts==
==Critical APIs==


=== access ===
=== access ===
Line 27: Line 27:
The [[Language strings API]] is how you get text strings to use in the user interface.  It handles any language translations that might be available.
The [[Language strings API]] is how you get text strings to use in the user interface.  It handles any language translations that might be available.


=== navigation ===


==Other APIs==
The [[Navigation API]] allows you to manipulate the navigation tree to add and remove items as you wish.


=== activity_completion ===
The [[Activity completion API]] is only used by activity modules, to indicate to the system how activities are completed.


==Other General APIs==


=== backup / restore ===
=== backup / restore ===
Line 47: Line 46:
The [[Comment API]] allows you to save and retrieve user comments, so that you can easily add commenting to any of your code.
The [[Comment API]] allows you to save and retrieve user comments, so that you can easily add commenting to any of your code.


=== conditional ===
=== event ===
 
The [[Conditional activities API]] is for


===Events API - "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 functions API - "external"===
=== external ===


===Groups API - "group"===
The [[External functions API]] allows you to create methods that can be accessed by external programs (such as [[Web services]]).


===Gradebook API - "grade"===
=== message===


===Message API - "message"===
The [[Message API]] lets you post messages to users.  They decide how they want to receive them.


=== preferences ===
=== preferences ===
Line 65: Line 62:
The [[User preferences API]] is a simple way to store and retrieve preferences for any user.
The [[User preferences API]] is a simple way to store and retrieve preferences for any user.


===Portfolio API - "portfolio"===
=== portfolio===
 
The [[Portfolio API]] allows you to use portfolio interfaces in your code and package up data to send to them.
 
=== rss ===
 
The [[RSS API]] allows you to create secure RSS feeds of data in your module.
 
=== role===
 
[[Role API]]
 
===tag===
 
[[Tags API]]
 
===time===
 
[[Time API]]
 
===webservice===
 
[[Web services API]]


=== - "restore"===


===RSS API - "rss"===


===Role API - "role"===
==For Activity modules only==
 
=== 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 ===


===Tags API - "tag"===
The [[Groups API]] allows you to check the current activity group mode and set the current group.


===Time API - "time"===
=== grade ===


===Web services API - "webservice" ===
The [[Gradebook API]] allows you to read and write from the gradebook.

Revision as of 08:43, 3 January 2012

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

Critical APIs

access

The Access control 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.

database

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

file

The File management API controls file storage.

page

The Page definition API is how you contruct web pages from data.

renderer

The Page rendering API is what you use to turn the current page into HTML and send it to the user.

string

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

navigation

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


Other General APIs

backup / restore

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.

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 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.

preferences

The User preferences API is a simple way to store and retrieve preferences for any user.

portfolio

The Portfolio API allows you to use portfolio interfaces in your code and package up data to send to them.

rss

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

role

Role API

tag

Tags API

time

Time API

webservice

Web services API


For Activity modules only

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.