CATEGORY: Moodle Developers

How to create a plugin for Moodle using PHP

Course Access: Lifetime
Course Overview

This course is for you if you have at least basic PHP, HTML, JavaScript and CSS experience before attempting to create a ‘plugin’ in Moodle but it is not essential that you have worked in Moodle before.

A ‘plugin’ is a special type of component that can be added to pages, dashboards and other display areas in Moodle. A ‘plugin’ has a unique set of requirements when developing in Moodle that will be covered in this course. 

I am assuming that you have been asked to create a plugin for Moodle or that you have a great idea for a plugin and want to learn to create it for yourself. This course is perfect as it assumes you have no knowledge of the Moodle coding framework and will take you step by step through the process to help you make your first plugin.

Why was this course created?

The complexity of Moodle and how it has been created can be extremely daunting for someone looking at the Moodle codebase for the first time. This course was created to explain how everything fits together. 

After spending 12 months looking through all the relevant forums and online help, I realised that I didn’t want others to go through the same trauma by having to test and scrape pieces of code together. I wanted to bring it all together in one place for you so that you can efficiently and effectively learn the basics of the framework without getting confused by old code and trying to mix and match code from different plugin examples. 

Why will this work for you?

Most courses don’t focus on full, working plugins, but instead on small functions or sections of a plugin. In this course you go from start to finish in creating a full working plugin. 

Along with this, it is all in one course rather than scattered around the internet in forums. 

Course contents

Getting started

  • Introduction (3:09)
  • Setting up your Moodle platform for development (2:15)
  • What is a plugin? (1:55)
  • Download the plugin

Get stuck into the code

  • Create the version.php file (4:38)
  • Create the language file (2:47)
  • Create the index file (4:42)
  • Installing the plugin (1:28)
  • Creating templates (6:41)
  • Adding JavaScript (7:59)

Adding functionality

  • Sending data to a template (5:03)
  • Getting access to the database (10:38)

New database table and data entry forms

  • Creating a new database table (9:51)
  • Creating a form to view, add, edit data (26:04)

Adding to the plugin

  • A new grader details page – part 1 (11:45)
  • A new grader details page – part 2 (8:27)
  • Grade results summary (8:17)
  • Export data to CSV and PDF (11:31)
  • Securing pages (5:46)

Complete

  • Thank you (1:11)