Note:

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

Activity modules: Difference between revisions

From MoodleDocs
No edit summary
(→‎See also: link added, link edits)
Line 28: Line 28:
==See also==
==See also==


* http://download.moodle.org/download.php/modules/NEWMODULE.zip - new module template for starting module development. Please follow the README instructions inside the zip.
* Tracker issue [http://tracker.moodle.org/browse/CONTRIB-52 CONTRIB-52 Improvements to make NEWMODULE really useful] - including download link for new module template supporting roles, formslib etc. (unfinished)
* http://download.moodle.org/plugins16/mod/NEWMODULE.zip - new module template for versions of Moodle prior to 1.7. Please follow the README instructions inside the zip.
* Using Moodle [http://moodle.org/course/view.php?id=5 Activity modules] forum
* Using Moodle [http://moodle.org/course/view.php?id=5 Activity modules] forum
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=66165 A new resource type: where do I put the language strings?] forum discussion
* Using Moodle [http://moodle.org/mod/forum/discuss.php?d=66165 A new resource type: where do I put the language strings?] forum discussion

Revision as of 07:34, 21 June 2007

Activity modules reside in the 'mod' directory. Each module is in a separate subdirectory and consists of the following mandatory elements (plus extra scripts unique to each module):

  • mod.html - a form to set up or update an instance of this module
  • version.php - defines some meta-info and provides upgrading code
  • icon.gif - a 16x16 icon for the module
  • db/ - SQL dumps of all the required db tables and data (for each database type)
  • index.php - a page to list all instances in a course
  • view.php - a page to view a particular instance
  • lib.php - any/all functions defined by the module should be in here. If the modulename is called widget, then the required functions include:
  • widget_install() - will be called during the installation of the module
  • widget_add_instance() - code to add a new instance of widget
  • widget_update_instance() - code to update an existing instance
  • widget_delete_instance() - code to delete an instance
  • widget_user_outline() - given an instance, return a summary of a user's contribution
  • widget_user_complete() - given an instance, print details of a user's contribution
  • Other functions available but not required are:
  • To avoid possible conflict, any module functions should be named starting with widget_ and any constants you define should start with WIDGET_
  • config.html - (optional) a form to set up or update global settings of this module
  • Lastly, each module will have some language files that contain strings for that module.

IMPORTANT: When creating a new module, the new name of the module must not contain numbers or other special characters!

You should also make sure that your activity module provides appropriate support for groups and metacourses.

See also