Moodle 3.x Developer's Guide
eBook - ePub

Moodle 3.x Developer's Guide

Ian Wild

Share book
  1. 368 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Moodle 3.x Developer's Guide

Ian Wild

Book details
Book preview
Table of contents
Citations

About This Book

Effortlessly ensure your application's code quality from day 1About This Book• 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.Who This Book Is ForThis 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 terminologyWhat 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 timeIn DetailThe 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.Style and approachThis book takes a step-by-step practical approach with every step explained in great detail using practical examples. You will create custom plugins from scratch with the examples shown and create new modules as well as extensions with the examples presented.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Moodle 3.x Developer's Guide an online PDF/ePUB?
Yes, you can access Moodle 3.x Developer's Guide by Ian Wild in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Ciencias computacionales general. We have over one million books available in our catalogue for you to explore.

Information

Creative Teaching - Developing Custom Resources and Activities

Having created plugins to enhance the structure and layout of courses in Chapter 4, Course Management, in this chapter we will be learning how to develop new teaching interactions. Recall that Moodle comes with a range of teaching interactions baked in. For example, there are interactions that allow teachers to add quizzes, self-directed lessons, glossaries, discussion forums, and much more, to courses. But there are many instances where you, or your instructional designers, will wish that Moodle included an interaction to support a particular aspect of teaching and/or learning. This is where the possibility to develop custom teaching interactions gives Moodle the edge. Not only does this provide greater opportunities for teaching but it also enhances the experience for our learners.
Moodle supports two types of teaching interactions: resources and activities. Both of these are types of course module plugins and we begin this chapter with a more thorough exploration of how we can map the requirements for a given teaching interaction onto a suitable type of plugin.
We then get to grips with the development of a novel three-dimensional model viewer. This uses the JavaScript library, three.js, to render a Wavefront 3D model--as well as allowing a user to interact with it. We continue our investigations into the most suitable methods to include JavaScript in our plugins now that YUI is no longer being developed by Yahoo!
This chapter will also help you gain a more thorough understanding of the File API (which we first encountered in Chapter 3, Internal Interfaces) and how file storage and retrieval works. This understanding is vital as any file a teacher or learner uploads to Moodle will be accessed through this API. We learn more about the scripts we need to prepare in order for our module to install cleanly, and we finish with a brief overview of the things to check before you make your final release.
At the end of this chapter, you will understand how Moodle course plugins work, which scripts need to be present in order for your plugin to behave correctly, and you will know how to modify course plugins to fit your needs.
This chapter will cover the following points:
  • Knowing if a user story requires a resource or an activity
  • How to manage files (including ZIP compressed files) using the File API
  • The scripts required for course plugin installation and an understanding of their structure
  • Knowing how to include JavaScript in your plugins--including passing parameters to JavaScript AMD modules
  • How to support course backup and restore
  • Introducing resources and activities
Let us start with learning the difference between resources and activities.

Teaching interactions

I am sure that by this stage you will have investigated the Add an activity or resource link on a course page (remember that you will need to turn editing on to see this link):
If not, then click on one of these links now to display the Add an activity or resource popup dialog:
Resources and activities are the building blocks of Moodle courses. Before continuing, look at the variety of resource and activity plugins a plain vanilla Moodle install supports. See that an activity provides teaching interactions--this is Moodle in transmit/receive mode. An activity (at least in the Moodle sense of the word) is something that demands some form of response from the learner (and, ideally, one that will make knowledge stick and/or develop competency in some way). A resource, on the other hand, is Moodle in transmit mode. Moodle resources provide access to information and do not necessarily require any further interaction back from the learner. It should be noted that, although resources and activities exhibit very different behaviors, they are built in very similar ways (their PHP scripts are similarly structured), as you will discover in this chapter.
The plugins we will be developing in this chapter are in response to two scenarios--called User Stories in Agile. The first describes how the online learning needs to contain 3D models with which a user can interact:
A user should be able to click on a model; zoom in and out, tilt, and rotate it.
The second user story describes what is essentially, a Moodle choice activity but with multimedia in the choice text:
We first encountered the development of an enhanced choice plugin in Chapter 3, Internal

Interfaces. If you haven't yet read Chapter 3, Internal Interfaces then it might be worth doing so before continuing with this chapter. What's great about studying this particular plugin is that, in a broader context, it will give you a good understanding of how multimedia files can be handled in any plugin. Likewise, the development of the three-dimensional model viewer plugin--also explained in this chapter--will give you a thorough understanding of how to include third-party (specifically JavaScript) libraries in your plugins.
Let us start with developing the three-dimensional model viewer. Before we start, you might want to download the latest version of this code from GitHib at: https://github.com/iandavidwild/moodle-mod_wavefront.

Developing a Resource plugin

As mentioned, although used in very different ways to support teaching, as far as plugin structure is concerned, there is little difference between a resource and an activity plugin. Each one has a similar folder and file structure--which by now I'm sure you are becoming more familiar with. We will explore the details later in this section. First, let us understand how we can actually render a three-dimensional model in the browser.

Rendering a three-dimensional model

Thanks mainly to the gaming community, tools to create and render three-dimensional models are both plentiful and free. For example, there is a whole community dedicated to creating new 3D Mobs models in Minecraft using the open source ...

Table of contents