Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Moodle 3.x Developer's Guide
Moodle 3.x Developer's Guide

Moodle 3.x Developer's Guide: Build custom plugins, extensions, modules and more

eBook
$39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Moodle 3.x Developer's Guide

Getting to Grips with the Moodle 3 Architecture

Have you ever experienced the frustration of being held back by technology? Perhaps you or your colleagues have wanted to teach something in a particular way and have found that your Virtual Learning Environment (VLE) doesn't support the feature you really needed. Maybe you are a learning manager, and you need to report on the numbers of learners from a particular postcode who have completed specific courses because this data is critical to ensuring continued funding. How many times have you held conversations about your VLE that began with "Wouldn't it be great if our learning platform could allow a learner/a manager to... ?".

The purpose of this book is to show you, through real-world examples, the details of plugin design and development. However, the key to plugin wisdom is understanding the Moodle architecture and, for that, you will need to understand Moodle itself. This chapter forms a general introduction to the Moodle philosophy, Moodle history, and the Moodle community.

In this chapter, we will also learn what a Moodle plugin is, what can be achieved with plugins, and cover not only how your plugins will actually plug in to Moodle but also what functionality Moodle can provide to your plugin (through dedicated application programming interfaces that your plugin can call upon).

This chapter will also help you set up your development environment ready to start developing. We will show you how to install and configure a local web server, the Eclipse IDE, and the Chrome Xdebug plugin for remote script debugging.

By the end of this chapter, you will be able to do the following:

  • Understand the importance of Application Programming Interfaces (APIs), both generally and in the context of Moodle plugin development
  • Be able to configure Moodle on a local development computer (for example, your personal laptop)
  • Be able to configure an integrated development environment, ready to start creating your first Moodle plugin

The final part of this chapter sees us walking through the process of creating our very first Moodle plugin--a language-switching plugin to support a UK/China joint venture. We won't go into the details of how plugins operate at this stage (that will be covered in the rest of the book), but you will get an appreciation of just a few of the decisions that must be made before and during the development process.

Let's begin our journey by exploring the background of the Moodle project a little.

Understanding Moodle

There are three reasons Moodle has become so important and much talked about in the world of online learning (refer to The Campus Computing Project at http://www.campuscomputing.net / new.html): one technical, one philosophical, and the third educational.

From a technical standpoint, Moodle--an acronym for Modular Object-Oriented Dynamic Learning Environment (Moodle)--is highly customizable. As a Moodle developer, always remember that the "M" in Moodle stands for modular. If you are faced with a client feature request that demands a feature Moodle doesn't support, don't panic. The answer is simple--we create a new custom plugin to implement it. Check out the Moodle plugins directory (https://moodle.org/plugins/) for a comprehensive library of supported third-party plugins that Moodle developers have created and given back to the community. This leads to the philosophical reason why Moodle dominates.

Moodle is, from a philosophical perspective, grounded firmly in a community-based, open source ethos (check out https://en.wikipedia.org/wiki/Open-source_model). However, what does this mean for us as developers? Fundamentally, it means that we have complete access to the source code, and within reason, unfettered access to the people who develop it. Access to the application itself is free--you don't need to pay to download it, and you don't need to pay to run it. However, be aware of what free means. Hosting and administration, for example, take time and resources are very unlikely to be free.

You will very often hear beer talked about in the context of free software (and I have purposefully stressed the word free): free software means free as in freedom, not free as in beer. Possibly, a better way of stating the case is to say that the Moodle developers in general--and Martin Dougiamas, the creator of Moodle, in particular--have given us freedom to do what we must. What we have not been granted is license to do what we want. Note that, again and like the beer example, this isn't quite the same as gratis (free of price) and libre (free of restriction--refer to https://en.wikipedia.org/wiki/Gratis_versus_libre). As Moodle developers, we are bound by the duties specified in the free Software Foundation's GPLv3 license (check out http://www.gnu.org/licenses/gpl-3.0.txt), and it is worth having an appreciation of these duties before you start developing.

Finally, as an educational tool, Moodle was developed to support social constructionism (refer to https://docs.moodle.org/31/en/Pedagogy); if you are not familiar with this concept, it is essentially suggesting that building an understanding of a concept or idea can be best achieved by interacting with a broad community. The impact on us as Moodle plugin developers is that there is a highly active group of users and developers. Before you begin developing any Moodle plugins, come and join us at https://moodle.org/mod/forum/?id=5.

More on Moodle plugins

As briefly described earlier, if we are faced with a need to enhance or alter the functionality of Moodle in some way, then the prescribed approach is to create a plugin. Refer to https://docs.moodle.org/dev/Moodle_architecture#Moodle_as_a_modular_system for a further description of Moodle's modular architecture. The https://docs.moodle.org/dev/Moodle_architecture page is also a good reference for learning about the basic plugin types and where these plugin types are to be found in the application folder structure.

In the following sections, we will set ourselves up ready to start developing our own plugins. First, we need to learn how to run a Moodle on our development computers.

Running a local Moodle

Moodle is a web application; so, you will need a web server in order to run it. In this section, we will be configuring a local development server that can run on your local machine.

Moodle architecture - the LAMP/WAMP stack

Moodle is a web application running typically (but not exclusively) in a web browser. A Moodle user interacts with a user interface on a client computer. The client requests resources from the application server (generally known as middleware) that provides the requested resources. It can do so by calling on another server, known as the data server. The data server provides the application server with the data it requires:

Check out https://en.wikipedia.org/wiki/LAMP_(software_bundle) for more information on the stack.

Generally, this architecture is referred to either as a WAMP stack or LAMP stack, the W or L referring to Windows or Linux, depending on the operating system you are running. A is for the web server Apache, M for the database server MySQL, and P for PHP, the scripting language Moodle is authored in. It should be noted that other web servers and databases are available and Moodle will run quite happily on them; refer to the online Moodle documentation.

Setting up an Internet ready Moodle server is beyond the scope of this book--see Moodle 3.0 Administration, also from Packt, for details. Instead, we will install a local web server running on Windows, using WampServer.

Installing WampServer

The WampServer development stack can be downloaded from http://www.wampserver.com/en/. Ensure that you download either the 32-bit or 64-bit version to suit your computer. Also, ensure that you run the install with Administrator privileges as both Apache and MySQL run as Windows services and the installer will require elevated privileges to install these. Once installed and running, the WampServer icon will be visible in the taskbar--green means everything is operating as it should and your local web server is up and running:

WampServer and Skype

Do you use Skype on your development machine? If so, you will likely experience a configuration conflict between the Apache instance in WampServer and Skype as Apache attempts to use ports 80 (for HTTP) and 443 (for HTTPS) to display web pages. By default, Skype is configured to use both these ports as alternatives for data transfer, so you will need to reconfigure Skype accordingly:

  1. Open Skype and click on the Tools menu option and slide down to Options....
  2. Select Advanced and then click on Connection.
  3. Uncheck the Use port 80 and 443 as alternatives for incoming connections option and press Save.
  4. Restart Skype.

Setting up an Integrated Development Environment (IDE)

As discussed earlier, the Moodle application consists of a great number of text scripts that can, in practice as well as theory, be edited with any simple text editor. However, you will be far better off using an integrated development environment for your development. An IDE will contain tools for code completion and code insight; for example, if you have forgotten the name of a class method, or if you need quick access to a function declaration, or the instances where a variable is used.

Perhaps more importantly, IDEs contain integrated debugging tools that allow you to step through the code as it runs (more on this later). The examples in this book use a special PHP version of the Eclipse IDE called Eclipse PDT, which can be downloaded from http://www.eclipse.org/pdt/.

Configuring the Eclipse IDE

Configuring remote debugging

We will use the Chrome browser for development using the integrated JavaScript, CSS, and HTML debugging tools. To debug PHP scripts, we will need to install and configure a PHP remote debugger. The debugger we will use is called Xdebug--https://xdebug.org/index.php. Xdebug needs to be installed and configured in three places:

  • The web server (Apache running our local development server)
  • The development environment (Eclipse)
  • The browser (Chrome)

The first step is to configure Xdebug in Apache. In order to determine which version of Xdebug is required, you will need to obtain a copy of the full output from phpinfo()--refer to http://php.net/manual/en/function.phpinfo.php--and paste that into https://xdebug.org/wizard.php, as follows:

Press the Analyse my phpinfo() output button at the bottom of the page for instructions on how to download and configure Xdebug.

Next, we need to configure Xdebug in the IDE. Instructions are available in the Eclipse documentation at https://wiki.eclipse.org/Debugging_using_XDebug.

Finally, we need to install an Xdebug plugin into the browser. For Chrome, we will be using Xdebug helper. Check out https://github.com/mac-cain13/xdebug-helper-for-chrome for details, but the helper itself is easily installed through the Chrome Web Store (you can find relevant links on the GitHub page).

Installing and configuring Moodle

Where should we install our development Moodle? It is always easier to debug an application that is running on the same (local) machine as your integrated development environment, although the PHP debugging tools described in this book also support remote debugging. If it's a separate development server (and not your local machine) you are working with, be sure to check out the guidance on how to configure remote debugging online as this can be tricky to set up. Each remote setup is different, so there is no definitive guide. The Eclipse forums are a great place to look for help, for example, http://www.eclipse.org/forums/index.php/mv/msg/365474/890896/#msg_890896.

The latest version of Moodle can be downloaded from https://download.moodle.org/. Download the latest version and unpack in the www directory created by WampServer. Before running the installation, you will need to follow the setting up instructions at https://docs.moodle.org/31/en/Windows_installation_using_XAMPP. Note that these instructions are for XAMPP, an alternative web server based on LAMP (https://www.apachefriends.org/download.html), but the principles of configuring Moodle running on WampServer are exactly the same. Before you install Moodle, ensure that the required PHP modules are installed and enabled (refer to https://docs.moodle.org/31/en/PHP for details) as failure to do so can result in you experiencing almost impossible to debug blank pages during the installation process.

Introducing the project

Now is the time to introduce the project we will be developing as we work through this book. The project brief is to develop a learning platform to promote research into societal and economic resilience. The Moodle instance we will be working on forms part of a much larger product landscape; so, it is vital that the Moodle we will be helping to develop integrates seamlessly into this landscape. Not only that, but there are features required of the e-learning platform itself that a vanilla Moodle doesn't support. For that, we will need to develop features to support learner management (one requirement is that authentication is via WordPress), course management (for example, access to materials based on your location), and novel teaching interactions (specifically, a three-dimensional model viewer). However, rather than presenting the details of the entire project at this early stage, we will be introducing features as they are required.

As a developer, don't be concerned purely with creating code. All the world's best designers, architects, builders, and planners have an appreciation and understanding of where they are coming from and where they are going; the art is knowing where to start and the science is in the planning and execution. In the rest of this section, we discuss the importance of planning.

Planning is everything

Creating a new Moodle installation doesn't just involve configuring servers and installing software. That's just a very small part of the process. The most important part of the process is planning. Before you can plan, you have to understand the environment (that is, the people and the organization) that you are planning for. It is best to design your new server architecture in baby steps:

  1. Audit the current environment, that is, your whole organization: How is your network configured? How will the new Moodle be accessed? How will the new Moodle interface with legacy systems? Will Moodle work at all?
  2. Produce an options analysis: Designing a new architecture is a problem, not a puzzle (puzzles only have certain solutions whereas problems can have many solutions, some more effective than others). Each potential solution will have benefits and risks; these need to be understood.
  3. Recommend a solution: The preceding two steps will make it clear why you have reached your particular recommendation.

Only when you reach an informed decision on which architecture you will implement, should you go ahead and implement it.

Obviously, how rigorous you need to be during the planning stage will depend on the organization you are planning for, still preparation is everything.

Agile software development

In this book, we will follow an Agile software development methodology. There is plenty of information available on the internet on Agile and the principles themselves are fairly straightforward to follow. The only aspect of Agile that you really need to be aware of is that client requirements will be described in terms of user stories, which are very different to the typical use cases you may be familiar with. At the requirements stage, we can treat Moodle plugins like little black boxes.

Essentially, the difference between use cases and user stories is this:

  • A use case explains what a black box is meant to do
  • A user story explains what a black box is meant to achieve

You will be encountering far more user stories as you read this book as our focus is on what can be achieved with new Moodle plugins rather than what they do and, of course, with what goes on inside the little black box--the software development.

Version control

Maintaining source code is impossible without some measure of version control. There are many version control systems available, but one of the most popular--and the one used by the Moodle community--is Git. Git is a Distributed Version Control System (DVCS), and it makes sense that the Moodle source code should be managed using some form of distributed system as Moodle's development community is scattered worldwide. The Moodle community uses GitHub--https://github.com. Delving into the details of how you use Git and GitHub are beyond the scope of this book. You are encouraged to read https://docs.moodle.org/dev/Git_for_developers before you start developing plugins properly. For more information on GitHub, check out GitHub Essentials, also from Packt (https://www.packtpub.com/application-development/github-essentials).

Moodle Internals - Application Programming Interfaces (APIs)

Essential to the creation of any new feature in Moodle is an understanding of Moodle's internal application programming interfaces. The oo in Moodle stands for object-oriented and at the outset, it is worth unpacking what this means to us as plugin developers.

An object-oriented philosophy

Object orientation is all about treating features of a system as little interconnecting black boxes. We have no idea what goes on inside a black box, but each black box can be described in three ways:

  • Each box behaves in a particular way and by making a box act out predefined, built-in behaviors, you can make it do different things
  • At any moment, a box is in a particular state
  • Every box has its own identity

Also, in fact, our little black boxes are objects and each object has a state, exhibits certain behaviors, and every object is uniquely identifiable as each has its own identity.

Objects themselves are of a particular type, called a class. Your pet cat shares some of the features of a mountain lion because they are both feline, and felines are types of mammals, so all mammals share similar characteristics, and so on. It is the same way with objects in Moodle:

If there is a specific programming task you need to perform in Moodle, you need to look for the correct API with which to carry out that task. Visit https://docs.moodle.org/dev/Core_APIs for a list of all of Moodle's internal APIs. For example, do you need to display a string on the screen? If so, use the String API. Why? It is because the String API automatically handles issues such as formatting and internationalization.

Each one of these APIs is accessed via an object. For example, use the global $DB object to access Moodle's database. This is an instance of the Data Manipulation Language (DML) API. Again and as with using the String API to display text on the screen, don't try to access the database other than through the interface Moodle provides. Why? It is because issues such as SQL injection hacks and verifying data integrity are already handled in the $DB object interface, so you don't have to worry about it.

However, what if there is a behavior that a particular interface doesn't support? This is solved by the notion of inheritance--see https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming). If, for example, the String API is missing a behavior our project requires, or we need to modify a behavior in order for it to fit our needs, we can declare a new class and base it on the String API. The new class is called a child class and the class upon which we have based the child is called the parent class. Certainly, in the case of the String API, we can reconfigure Moodle to use our new API. We will be learning how to modify an API (using the String API specifically) later in this chapter.

This section is merely a brief overview of the object-oriented philosophy, intended to be just enough of an explanation before you start Moodle plugin development. For more details on the object-oriented philosophy in general, check out the Wikipedia page on object-oriented Programming at https://en.wikipedia.org/wiki/Object-oriented_programming.

Types of APIs

For a complete list of Moodle's core internal APIs, take a look at https://docs.moodle.org/dev/Core_APIs. The first set of APIs are listed as General APIs. They are the interfaces upon which most plugins are built, for example, the Data Manipulation API for reading and writing to the Moodle database or the Form API that displays web forms and handles their form data. In the next section, we will create a simple plugin that overrides (in the object-oriented sense) and calls on the String API to change the way language strings are displayed in Moodle's user interface.

The "Other General APIs", listed next, are the ones that are still fundamental and likely to be used in any type of plugin but, that said, are much less likely to be called upon, for example, the Calendar API or the Competency API.

Then, there are the APIs that are specific to certain plugin types, such as the Activity Completion and Plagiarism APIs, which will only be employed by a Moodle activity module.

Our first plugin - a custom string manager

As described earlier, we will be working together to develop plugins for a new global Moodle-based learning management system in this book. For the rest of this chapter, we will be working through the development of a simple plugin, one that modifies the way language strings are displayed on the user interface. Note that the intention isn't to demonstrate the finer details of how to write a Moodle plugin; that is the purpose of the rest of the book. The rest of this chapter is written to outline the kind of thought processes that one would engage in when being tasked with developing a new feature in Moodle. So, let's begin with finding out what the task that we have been set is.

The user story

In true agile fashion, the following user story has been assigned to us:

The client requires two languages to be displayed on the screen at the same time: English and Mandarin Chinese. Moodle supports language switching (refer to https://docs.moodle.org/31/en/Language_settings for details) but doesn't show two languages at the same time. Also, on the face of it, this seems a fairly straightforward problem. However, let's always ensure that we take a methodical approach to any request and avoid the temptation to simply start developing. By being disciplined, we can ensure that the plugin we develop is not only the most effective fit for this immediate requirement, but also that:

  • It is future proof
  • It is reusable
  • It is ready, potentially, to be offered back to the development community (IPR issues not withstanding)

The development process

Let's spend the rest of this section learning about the development process. There are many well-defined development processes, and these will be explored in the rest of the book. The art, however, is knowing where to start, and we should always start by attempting to thoroughly understand the problem in every way.

Step 1: Understanding the problem

It is, perhaps, a statement of the obvious, but before you start developing, ensure that you fully understand the problem you have been asked to solve. The standard journalist's questions are a good framework to aid your understanding. Consider the following:

  • Who: Will the two languages be displayed to all users or only to certain users? In our case, all users.
  • What: Are we talking about US English or UK English? Does the client want "Mandarin", which means mainland Chinese displayed using the simplified character set? Our client has specified UK English and simplified Chinese Mandarin.
  • Why: Is this because our users are bilingual, or is this being included as a teaching aid? The client is wanting two languages on the screen simultaneously as they are expecting the platform to be used in group teaching.
  • Where: Moodle language switching toggles the language on the platform only; it doesn't toggle languages in any teaching materials. This client wants both the platform and the courses to be bilingual.
  • When: Are two languages to be displayed everywhere or only in particular contexts? Dual languages are to be displayed throughout the platform.

Also, having gained an understanding of the problem, it's time to consider the how.

Step 2: Researching potential solutions

Moodle already supports a range of languages through installable language packs, and for version 3.1, these are listed at https://download.moodle.org/langpack/3.1/. The language pack we need is zn_ch.zip, which is simplified Chinese Mandarin. Follow the instructions at https://docs.moodle.org/31/en/Language_packs to install this pack into your local development Moodle:

Having installed the relevant language pack, we can now experiment with creating a test Moodle user whose native language is simplified Chinese:

Having satisfied ourselves that we can switch to the Chinese language, we now need to assess options for displaying two languages on the screen at the same time. For that--and in the spirit of social constructivist learning in general--we need to go out into the world... Let's start with the main Moodle website at https://www.moodle.org.

Moodle plugin directory

Take a look at https://moodle.org/plugins and search for language:

Unfortunately, nothing is available to support dual language display in the plugins directory.

Moodle community forums

Martin Dougiamas created Moodle as a platform not only to support social constructivist teaching, but he also wanted to have development of the platform supported along social constructivist lines. So, the main Moodle website hosts a variety of forums where users and developers can openly discuss issues and address support-related and frequently asked questions. Visit https://moodle.org/course/ for a full list of forums (you will need to create a user account if you want to post any messages). The language forum itself is at https://moodle.org/mod/forum/view.php?id=43.

If you don't find anything relevant in the user forums, we can take a look at the Moodle Tracker next.

Moodle Tracker

String API

For a detailed explanation of the String API, visit https://docs.moodle.org/dev/String_API. The String API documentation reveals that the most effective method of having Moodle display two language strings on the screen at the same time is to author our own string manager, within which we have implemented a custom get_string() function. Luckily, the reporter of ticket MDL-49361 has already created an example, Moodle plugin moodle-local_stringman, and made it available through GitHub (refer to the preceding section, Source control discipline):

You will see that the README notes for the moodle-local_stringman plugin stress that the code provided should be used for illustration purposes only. So, we will need to download a copy of the source and create our own GitHub repository to work on:

That done, it's time to work on our solution.

Step 3: Implementing the solution

We will create a new local plugin. Essentially, local plugins are the place to put enhancements to core Moodle that don't fit into any other obvious place (that is, an enhancement that isn't a new course activity or a new user authentication method). We will learn much more about local plugins in Chapter 2, Moodle Plugins - What Can I plug In? I have called this new plugin duallang. This is publicly available on GitHub at https://github.com/iandavidwild/moodle-local_duallang.

Standard plugin features

Download the plugin from GitHib. Now, let's take a look at the structure of the duallang plugin together. There are three files worth mentioning:

  • version.php: This contains not only the version information of the plugin itself but also the minimum version of Moodle required to run it. It also, optionally, contains a list of dependencies. The following is a copy of the relevant code from our new plugin:
      $plugin->component = 'local_duallang'; 
$plugin->release = 'alpha1';
$plugin->version = 2016112300;
$plugin->requires = 2015030900;
$plugin->maturity = MATURITY_ALPHA;
$plugin->dependencies = array();
  • lang/en/local_duallang.php: This contains the plugin's language strings. There is only one language string required for this basic plugin and that is the name of the plugin itself:
      $string['pluginname'] = 'Dual language string manager'; 
  • classes/duallang_string_manager.php: This script contains the overridden implementation of the core_string_manager class, specifically, the get_string() function, which has been modified to construct a language string from both the UK English and the simplified Chinese Mandarin language packs:
      class duallang_string_manager extends 
\core_string_manager_standard {

/**
* Implementation of the get_string() method to display both
simplified
* Chinese and UK English simultaneously.
*
* @param string $identifier the identifier of the string to
search for
* @param string $component the component the string is
provided by
* @paramstring|object|array $a optional data placeholder
* @param string $langmoodle translation language, null means
use
* current
* @return string
*/
public function get_string($identifier, $component = '', $a =
null,
$lang = null) {

$string = parent::get_string($identifier, $component, $a,
'en');

$zh_cn = parent::get_string($identifier, $component, $a,
'zh_cn');

if(strlen($zh_cn) > 0) {
$string .= ' | ' . $zh_cn;
}

return $string;
}
}

Note that in order to specifically load UK English and simplified Chinese, we simply call the method in the parent class (refer to the An objected-oriented philosophy section for some elaboration on the parent/child class relationship).

At the top of each PHP script, you will find a general comment header, important copyright, and optional version control information. You will also see the following line of code:

defined('MOODLE_INTERNAL') || die(); 

This prevents someone from outside of Moodle from accessing the PHP script. To install the plugin, we can either copy the files to Moodle's local folder or use Moodle's built-in plugin installer (for details, visit https://docs.moodle.org/31/en/Installing_plugins#Installing_via_uploaded_ZIP_file):

Once installed, we will also need to add a line to Moodle's config.php file (located in Moodle's root directory):

Return to Moodle's home page and you will now see the UK English and simplified Chinese Mandarin language strings displayed side by side:

Summary

In this chapter, we began our Moodle plugin development journey. We started with an investigation of the history of Moodle and the philosophy that underpins it. Having gained an understanding of Moodle, we then learned how to set ourselves up for plugin development. We set up a local development web server based on WampServer and then configured the Eclipse IDE and the Chrome Xdebug plugin for remote debugging.

We spent the second half of this chapter developing a simple dual-language plugin. We followed the plugin development process from user story to deployment in order to understand just a few of the thought processes and decisions that need to be made before plugin development begins.

In the next chapter, we will be delving deeper into the types of plugins that are available and learn how to change the layout of a Moodle course through the development of a custom course format plugin.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Customize your Moodle 3.x app.
  • Leverage the new features of Moodle 3.x by diving deep into the Moodle development eco-system.
  • Cater to heavy user traffic, customize learning requirements and create custom third party plugins.

Description

The new and revamped Moodle is the top choice for developers to create cutting edge e-learning apps that cater to different user’s segments and are visually appealing as well. This book explains how the Moodle 3.x platform provides a framework that allows developers to create a customized e-learning solution. It begins with an exploration of the different types of plugin.. We then continue with an investigation of creating new courses. You will create a custom plugin that pulls in resources from a third-party repository. Then you’ll learn how users can be assigned to courses and granted the necessary permissions. Furthermore, you will develop a custom user home. At the end of the book, we’ll discuss the Web Services API to fully automate Moodle 3.x in real time.

Who is this book for?

This book is for Moodle developers who are familiar with the basic Moodle functionality and have an understanding of the types of scenarios in which the Moodle platform can be usefully employed. You must have medium-level PHP programming knowledge. You should be familiar with HTML and XML protocols. You do not need to have prior knowledge of Moodle-specific terminology

What you will learn

  • • Work with the different types of custom modules that can be written for Moodle 3.x
  • • Understand how to author custom modules so they conform to the agreed Moodle 3.x development guidelines
  • • Get familiar with the Moodle 3.x architecture—its internal and external APIs
  • • Customize Moodle 3.x so it can integrate seamlessly with third-party applications of any kind
  • • Build a new course format to specify the layout of a course
  • • Implement third-party graphics libraries in your plugins
  • • Build plugins that can be themed easily
  • • Provide custom APIs that will provide the means to automate Moodle 3 in real time
Estimated delivery fee Deliver to Russia

Economy delivery 10 - 13 business days

$6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 29, 2017
Length: 368 pages
Edition : 1st
Language : English
ISBN-13 : 9781786467119
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Estimated delivery fee Deliver to Russia

Economy delivery 10 - 13 business days

$6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Jun 29, 2017
Length: 368 pages
Edition : 1st
Language : English
ISBN-13 : 9781786467119
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 152.97
Moodle Theme Development
$48.99
Moodle 3 Administration, Third Edition
$54.99
Moodle 3.x Developer's Guide
$48.99
Total $ 152.97 Stars icon

Table of Contents

9 Chapters
Getting to Grips with the Moodle 3 Architecture Chevron down icon Chevron up icon
Moodle Plugins - What Can I Plug In? Chevron down icon Chevron up icon
Internal Interfaces Chevron down icon Chevron up icon
Course Management Chevron down icon Chevron up icon
Creative Teaching - Developing Custom Resources and Activities Chevron down icon Chevron up icon
Managing Users - Letting in the Crowds Chevron down icon Chevron up icon
Creating a Dashboard - Developing a Learner Homepage Chevron down icon Chevron up icon
Creating a New Skin Chevron down icon Chevron up icon
Moodle Analytics Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(2 Ratings)
5 star 50%
4 star 50%
3 star 0%
2 star 0%
1 star 0%
Michael Ford Aug 23, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A guide to Moodle development is long overdue but the author has nailed it! I found the book well-written, thorough and very practical. The author's technical and educational expertise shine through and he's generous with insights not easily found on Moodle docs. In fact, the book has many parallels to Moodle as a learning platform, offering collaborative learning experiences while pulling together useful resources where required.The first chapter is about setting up. We're given a brief explanation of how to set up the development environment, an introduction to agile software methodology, to object orientated programming and to Moodle itself. Once prepared, we’re given our first client requirements and we’re then guided through the research, development and implementation of a working solution.Going through the book, the requirements get increasingly more complex and the explanations more detailed. In each case, we end up with a working solution as well as suggestions on how this might be further developed. I found the customised authentication plugin and the learning analytics particularly relevant. However, as the author also uses these projects to give us a thorough tour of Moodle functionality, there'll be something here for almost everybody.On the resources side, links to further reading are offered throughout the book, and the appendix is particularly worth checking - Behat, unit testing, coding standards, XML-RPC, encryption, compression, and GIT among other topics.Finally, the author's enthusiasm is infectious. I haven't coded for a while but I've been inspired. This is a book worth making space for.
Amazon Verified review Amazon
Client d'Amazon Apr 26, 2018
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Dès le premier chapitre, le livre est intéressant et vous permet de mieux comprendre l'outil et sa structure.Et d'être productif. Après une journée on est capable de réaliser des plug-ins... je dis chapeaux l'auteur.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela