GETTING STARTED



One of the challenges in Moodle development is finding a good starting point for creating a Moodle plug-in. I thought it would be cool to build a step-wise tutorial on the subject as I embark on a personal whim:

Building a Moodle Module that allows the Student to post their Moodle Forum posts to FaceBook, and elicits responses from their group of friends into a totally separate forum. Perhaps too ambitious for a first project, but it hits all of the major challenges.

I will start by coming up with a cool name for the plug-in. I am thinking of calling it InYourFace ?  This particular exercise will focus on building an activity module - a module that provides an activity that can be added to any Moodle course.

WHERE DO WE START?

NOTE: This tutorial assumes that you already have a working installation of Moodle 1.9.x available, and that you have at least one course installed in your Moodle instance.  It also assumes that you have some basic knowledge of PHP and MySQL.

Before we embark on writing our first Moodle module, let's download a template provided by the folks at Moodle.org. In our case, we will be writing our module for Moodle version 1.9.x:

Download Link for The Module Template for Moodle 1.9

We end up with a file called NEWMODULE.zip which we need to save to our local drive and unzip. In my case, I download to the Public folder, unzip the file and end up with .\Public\NEWMODULE.

NEXT ARTICLE IN SERIES

Thursday, May 13, 2010

07MOD: Moodle Module Development - Testing the module's form

TO START THE TUTORIAL FROM THE BEGINNING, CLICK HERE

We have just completed our changes to the module's form.  This form is called when the user adds our activity to a Moodle course.  Let's test the form, and make sure that it works correctly.
 
1. Let's navigate to a Moodle course

Click Image to Zoom

2. Add our activity to one of the course's topics or weeks.
 
In our case, I am adding it to the second week, where I also have a corresponding forum discussion that will use to feed our module.

Click Image to Zoom


3.  Fill out our form

WOW - Notice how much cleaner the form looks since we made some slight modifications.  And look - our custom block and dropdown list are both rendered!

Click Image to Zoom

4. Save and Display the Form


Click Image to Zoom

Now we have a working module form. Making a few changes to the module template and adding less than 10 lines of code has left us with a registered, functioning Moodle module.

If we look at the database, we notice that we have populated table mdl_inyourface with a row that ties our new entry to the course:


WAIT!  

We just introduced a new variable to our module - postlimit.  This is new data that was not part of our original installation.  When the user saves our activity to a course, our new data element gets lost.

It's time to look at how Moodle module updaetes work.  We will also need to take a detour and look at the Moodle XMLDB Editor.


Next Article in Series

No comments:

Post a Comment