Professional Documents
Culture Documents
Contents
Introduction to Moodle system Introduction to modules Versions and database tables Capabilities Language files and help files Forms view.php
Introduction to modules
Activities Appear on front page of course Add using dropdown Update settings Link goes to modules own PHP files Whats in a module?
mod/name
db
install.xml access.php update.php
version.php lang
en_utf8
name.php help
mods.html
Database structure
prefix_course_modules
An instance of a module in a particular course
prefix_name
Your table. Must have id, name, course
And index on course
$cm->instance == $name->id
Variables
$cm, $name, $course
update.php
Used after code update on existing database Code in PHP
version.php
Module version e.g. 2007031600
Capabilities
Define capabilities for your module
Array in access.php
Specifies available capabilities and who has them by default
mod/name:edit, mod/name:view,
Check capabilities
Get context object for current module instance has_capability(mod/name:edit,$context)
Language files
All strings taken out into language files
Except system errors
But not except user errors!
Help files
In lang/en_utf8/help Basic XHTML content One standard file mods.html Add other files Link to them with standard help button
For example, in forms
Forms
In case youve forgotten
Forms
mod_form.php PHP QuickForm + Moodle extensions
$mform->addElement('text', 'name', get_string('name'));
Various types provided Easy to add help buttons Does formatting for you
And accessibility (hopefully)
view.php
Your own PHP code Can do anything
Should use Moodle standard functions where appropriate Header, footer, tabs, etc.
Conclusion
Standard platform features need to be used
Maintaining Administration (capabilities) Community sharing
Be careful!