How to begin module development

How to begin module development

by Daniel F -
Number of replies: 8
Hi all,

I am part of a team working towards developing a new plugin for moodle of the quiz variety, this is part of our senior project. I have wandered through the documentation a bit and while it will definitely be useful, I was wondering if there are any resources that discuss the basics of starting to develop a plugin? and also is there a location that lists the entire moodle API?

Help is much appreciated, thanks!
- Daniel
Average of ratings: -
In reply to Daniel F

Re: How to begin module development

by Álex González -
I'm reading this document: http://docs.moodle.org/en/Blocks_Howto to do blocks.

Bye!
In reply to Álex González

Re: How to begin module development

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
I did a Powerpoint presentation that introduces module development for staff here. It's from a little while ago but should still be pretty current; it was written for Moodle 1.8.

This is an overview, not a how-to tutorial, but if you aren't familiar with Moodle architecture then it's probably important to get an idea of all the 'bits' that go into a module before you start.

(Or most of them! I may have forgotten some.)

Obviously it made more sense when I did the talk as well as the slides. But you might be able to get the vague idea.

http://lyceum.open.ac.uk/temp/creating_moodle_modules.ppt

--sam

PS I've posted this before but once again: apologies if anyone is offended by the bits where I slag off Moodle features. For example, sorry eloy, your database editor is lovely really... :>
Average of ratings: Useful (1)
In reply to sam marshall

Re: How to begin module development

by M Adil Mazhar -

I was very interested to see  your presentation but unluckily the link is not opening. Kindly check and provide the fresh link if possible

In reply to Daniel F

Re: How to begin module development

by Andreas Söllei -
Hi Daniel!

I looked at simple modules in the mod-folder (E.g. "label" is very simple) and tried to go through the source code.

coding guidlines see for example: http://docs.moodle.org/en/Coding

API: I personally used phpxref to get information shortly of functions I saw in other modules I looked at. You can setup phpxref on your own computer or simply type "moodle phpxref" in google. Take care that you use phpxref websites with the moodle version you use.

At first most important files to define a new instance of a module are mod_form.php and lib.php.
mod_form.php is used in newer moodle versions, in older versions this file is called mod.html
In this file you define the instructions to add and update an instance of your module.
To define the database in newer moodle versions there are xml-files which you can modify with a graphical user interface in the moodle administration.

In lib.php you administrate the functions you use in your module (object oriented and also not object oriented)
At first add_instance, update_instance and delete_instance is important.

Also important is the file "yourmodule".php in the lang-folder. All kind of strings which have to be translated in other languages are there, with get_string you can read strings from this file you currently need.

As I am informed the assignment module is at quite new code standard.

In the administration of moodle you are able to configure to see debug messages, for me this was useful to get information when I used deprecated functions for example.

I hope that this information is a bit helpful for you. I am not developing moodle code for a long time, maybe a senior developer of moodle can add more hints in this thread.

Have fun wink
Andi Söllei
In reply to Daniel F

Re: How to begin module development

by Jason Hardin -
There is also a module called newmodule http://moodle.org/mod/data/view.php?d=13&rid=715 that is all the basic code you need to get started developing a module. I believe there is also a block like that in modules and plugins.

We are working on a facilitated Introduction to Moodle development Moodle course at Humboldt State University that will be released to the community later next month as part of the Mellon grant we were awarded.
In reply to Jason Hardin

Re: How to begin module development

by Jeffrey Fisher -
Did you ever create that introduction to Moodle development course? Is it available to the public?

Thanks.