O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Moodle 3.x Developer's Guide

Book Description

Effortlessly ensure your application's code quality from day 1

About 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 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

  • In Detail

    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.

    Style and approach

    This 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.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    2. Getting to Grips with the Moodle 3 Architecture
      1. Understanding Moodle
      2. More on Moodle plugins
      3. Running a local Moodle
        1. Moodle architecture - the LAMP/WAMP stack
          1. Installing WampServer
            1. WampServer and Skype
        2. Setting up an Integrated Development Environment (IDE)
          1. Configuring the Eclipse IDE
          2. Configuring remote debugging
      4. Installing and configuring Moodle
      5. Introducing the project
        1. Planning is everything
      6. Agile software development
      7. Version control
      8. Moodle Internals - Application Programming Interfaces (APIs)
        1. An object-oriented philosophy
        2. Types of APIs
      9. Our first plugin - a custom string manager
        1. The user story
        2. The development process
          1. Step 1: Understanding the problem
          2. Step 2: Researching potential solutions
            1. Moodle plugin directory
            2. Moodle community forums
            3. Moodle Tracker
            4. String API
          3. Step 3: Implementing the solution
            1. Standard plugin features
      10. Summary
    3. Moodle Plugins - What Can I Plug In?
      1. Managing users
        1. Authentication
        2. Enrolment
        3. Learner competencies
      2. Managing courses
        1. Course layout
      3. Course content
        1. Resources
        2. Activities
          1. Quiz plugins
          2. Assignment plugins
        3. Where to find course interaction plugins
        4. Other important course plugin types
          1. Blocks
          2. Editor plugins
          3. Text filters
      4. Reporting and analytics
      5. Look and feel
      6. Other major plugin types
      7. What cannot be done with plugins?
      8. Summary
    4. Internal Interfaces
      1. Adding configuration settings
        1. Wireframing
        2. Moodle application layers
        3. Storing configuration data
        4. Creating an admin settings page
        5. Updating the get_string() function
        6. Plugin language strings
      2. System APIs
        1. Events API
        2. Plugin data and services
        3. Form API
        4. File Storage API
        5. Cache API
        6. Output renderers
      3. Summary
    5. Course Management
      1. Course formats
        1. GPS location - background to the project
        2. Obtaining device location
          1. Device location - security issues
          2. Configuring SSL on WampServer
        3. Understanding renderers
        4. Finding a user's location with the Geolocation API
          1. Including JavaScript
        5. Specifying location settings
        6. Displaying sections based on location
        7. Try it yourself
      2. Course blocks
        1. Configuring the QR Code block
        2. Including the QR Code library
        3. Manipulating files with the File API
        4. Serving files from the file store
        5. Try it yourself
      3. Text filters
        1. Subscribing to a text changed event
        2. Try it yourself
      4. Summary
    6. Creative Teaching - Developing Custom Resources and Activities
      1. Teaching interactions
      2. Developing a Resource plugin
        1. Rendering a three-dimensional model
        2. Module configuration
        3. More on file handling
        4. Plugin library callbacks
        5. Rendering the Model
        6. More on JavaScript
          1. Asynchronous Module Definition (AMD) API
        7. Reporting events
        8. Other files
        9. Installation scripts
        10. XMLDB editor
        11. Allowing user comments
        12. More on file handling
        13. Styling
        14. Backup and Restore API
          1. Backup API
          2. Restore API
        15. Roles and permissions
      3. Preparing for release
        1. Minimising JavaScript
        2. Taking things further
      4. Activities
        1. Enhanced choice
          1. Editing choices
      5. Summary
    7. Managing Users - Letting in the Crowds
      1. Authentication
        1. Authentication - general principles
        2. Getting logged in
        3. Single sign on
        4. WordPress to Moodle - SSO options
          1. Calling WordPress code directly
          2. Cookie authentication
          3. Links from WordPress to Moodle
          4. External Web Services APIs
          5. OAuth overview
        5. Installing the WordPress OAuth 1.0a server
        6. Creating a new Moodle auth plugin
          1. Configuration
          2. Handling OAuth calls
          3. Handling the Moodle login event
          4. Taking things further
        7. Course Enrolment
          1. A WordPress course enrolment plugin
          2. Taking things further
        8. Management of Competencies
          1. Creating a new admin tool plugin
            1. Synchronisation settings
            2. Connecting to external databases
            3. Taking things further - Moodle CLI scripts
      2. Summary
    8. Creating a Dashboard - Developing a Learner Homepage
      1. The client's requirement
        1. Addicted to learning
        2. Course progress block
          1. Including graphics libraries
          2. JavaScript Object Notation (JSON)
          3. Converting progress data to JSON
          4. Constructing a progress chart
          5. Creating a chart
          6. Making the chart clickable
          7. Taking things further
          8. Dashboard progress overview
          9. Taking things further
      2. Encouraging learners to start a course
        1. Implementing a new course availability block
        2. Determining progress
          1. Creating the Description page
          2. Taking things further
      3. Summary
    9. Creating a New Skin
      1. Theme plugin structure
        1. Page layout
        2. Theme library functions
        3. Taking things further - updating the theme screen grab
      2. Renderers
        1. Creating a plugin renderer
        2. Overriding a component renderer
        3. Custom styling
          1. Including images in CSS
        4. Taking things further - styling button icons
        5. Page layouts
          1. Taking things further - doing more with page layouts
      3. Templates
        1. Mustache
        2. Overriding templates in a theme
      4. Theme responsiveness
      5. Summary
    10. Moodle Analytics
      1. Reporting
        1. Report plugin structure
        2. Grabbing data
        3. Reporting learner success
        4. Determining certificates issued
          1. EXPLAIN a query
        5. Saving data
          1. Creating spreadsheets
          2. Taking things further
        6. Displaying activity data - a bubble chart example
          1. Accessing the report
          2. Building the block
          3. Extracting the data
          4. Including D3.js libraries
          5. Rendering a bubble chart
          6. Further improvements
      2. Web Services
        1. Developing a new external API
          1. A hello world API
        2. Building a new API
        3. Encrypting data
          1. Decrypting data in PHP
          2. Decrypting data in C#
      3. Summary
    11. Appendix
      1. Testing
      2. PHPUnit
      3. Behat
        1. Describing a scenario
        2. Step definitions
      4. Moodle guidelines
      5. General guidelines
        1. Describing functions and methods
        2. Whitespaces and indentation
          1. Configuring Eclipse indentation
        3. SQL query coding style
      6. The code checking tool
      7. C# client
      8. Installing Visual Studio
      9. Creating a new project
      10. Creating a test harness
      11. Connecting to an XML-RPC API
      12. Decrypting data
      13. Decompressing data
      14. Final testing
      15. Source control with GitHub
      16. Installing Git
        1. Configuring SSH
      17. Committing changes
        1. Atomised commits