MoodleBites for Developers Level 2 is a technical course and direct follow-on from MoodleBites for Developers Level 1 (although this is not a prerequisite). This is a technical course using HTML, PHP, and Javascript. For course fees, start dates, and other information please see the course outline.

关于“Search courses”的帮助

The first assumption is that you have either taken the level 1 course or you have equivalent knowledge.  We noted that you should be familiar with the material in our free course MoodleBites for Developerts Technical Preparation. There are two optional sections included on using git and debugging from that course in case you haven't taken it.   

We will first clone the widget template from GitHub and then search and replace in files, rename some files and then create a new repository in GitHub to hold the code as we develop it.

Finally for this week we will give an overview of the template code.

Then we will be ready to start our plugin development.


This week we examine the collaborate activity we installed in week 1 and consider how Moodle display browser facing pages. We discuss Mustache templates and compare to the older methods still found in many parts of Moodle.  We cover the basic APIs needed to make an activity module work. 

This week covers the use of local classes and autoloading.  We develop a local class for adding Editor Areas to our mod_form.  In order to save that data we need to modify the database.  To do this we will also cover the use of the XMLDB editor and the upgrade.php script.

Last week we added the editors for instructions A and B.  This week we learn how to process the data from them so it gets stored correctly in the database and we learn the steps needed to extract and display the data on the page.

We review the admin settings pages and test our plugin with multiple instances and roles, also re-visiting the database API.  We take a look at reports and multi-page output.  We spend some time thinking about security.  A lighter week than last.


Now that we have the submissions class sorted and we can collect the submissions from the participants we want to be able to display them under the reports tab and grade them using a simple form.

Actually passing grades to the gradebook using the lib.php functions is not the easiest thing but you may need to do it so we cover it here.

This weeks content covers three new programming APIs in Moodle that are built around automatic class loading and namespaces. They are: Tasks, Events and Logging.

Each of those does not involve writing a lot of code. But you should be familiar with namespaces and class loading. Tasks are straightforward in code, but are really a bit tricky to debug. I suggest you stick pretty close to the code given, to avoid having to track down bugs. Logging and events are two sides of the same coin, and by now you have probably seen them in Moodle code.

Have we finished out plugin, is it ever finished?  Code checking and the plugins database. Some additions we might make to increase interactivity.

An extended task for you to attempt: Adding a comments section to the plugin.  This will involve researching the comments API, upgrading the database, adding new capabilities, updating mod_form, and admin settings. Haere rā (farewell) from the course.

This area is used to enable successful MoodleBites for Developers Level 2 participants to access a Certificate of Completion, and download a Badge.

We introduce the course, state some expectations, check on your development environment and then install our plugin from a template.

We also add some notes about git, a very useful tool for developers and pretty much an essential for Moodle Developers.

The example plugin uses renderers to separate the output from the plugin logic as is good practice in any kind of development.  We briefly re-visit the $PAGE and other output components and refactor our code to use simple permissions.  We set up a couple of features: styles.css and a local class.


This week covers Moodle forms to an advanced level.  We will briefly recap the material from the level 1 course before getting into the complexities associated with saving form data and upgrading a plugin by adding a new table.  Finally we save some data to the table using a form, including dealing with an editor type form element.

We have some tidying up to do this week.  We can now add one page but we need to be able to add more pages and navigate between them, edit pages and delete them.   We will introduce a page management "console" similar to those you already see in Moodle for managing courses.  All in all, another busy week.

We review the admin settings pages and test our plugin with multiple instances and roles, also re-visiting the database API.  We take a look at reports and multi-page output.  We spend some time thinking about security.  A lighter week than last.


This week we look at using JavaScript in Moodle. Like a lot of things at this end of the course, JavaScript in Moodle seems more complex than it needs to be. But once you get past all the terms, file structures and command line utilities you can use JavaScript quite nicely in Moodle. 

Pretty much all the JavaScript you need to know is written for you, or simply needs a copy and tweak. We will be adding a button and a sliding panel to our multipage pages this week. In order to do this we will also use the upgrade.php script to perform a proper upgrade of our database tables.


This weeks content covers three new programming APIs in Moodle that are built around automatic class loading and namespaces. They are: Tasks, Events and Logging.

Each of those does not involve writing a lot of code. But you should be familiar with namespaces and class loading. Tasks are straightforward in code, but are really a bit tricky to debug. I suggest you stick pretty close to the code given, to avoid having to track down bugs. Logging and events are two sides of the same coin, and by now you have probably seen them in Moodle code.

Have we finished out plugin, is it ever finished?  Code checking and the plugins database. Some additions we might make to increase interactivity.

An extended task for you to attempt: Adding a comments section to the plugin.  This will involve researching the comments API, upgrading the database, adding new capabilities, updating mod_form, and admin settings. Haere rā (farewell) from the course.