Moodle JavaScript Cookbook
()
About this ebook
Related to Moodle JavaScript Cookbook
Related ebooks
PhpStorm Cookbook Rating: 0 out of 5 stars0 ratingsHTML5 Graphing and Data Visualization Cookbook Rating: 0 out of 5 stars0 ratingsMagento 2 Development Cookbook Rating: 0 out of 5 stars0 ratingsiOS Development with Xamarin Cookbook Rating: 0 out of 5 stars0 ratingsCocos2d-x Cookbook Rating: 0 out of 5 stars0 ratingsjQuery UI 1.7: The User Interface Library for jQuery Rating: 0 out of 5 stars0 ratingsLiveCode Mobile Development Cookbook Rating: 0 out of 5 stars0 ratingsGetting Started with OpenCart Module Development Rating: 0 out of 5 stars0 ratingsSelenium Testing Tools Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsInstant Hands-on Testing with PHPUnit How-to Rating: 0 out of 5 stars0 ratingsOracle Data Integrator 11g Cookbook Rating: 0 out of 5 stars0 ratingsMoodle Gradebook Rating: 0 out of 5 stars0 ratingsResponsive Web Design A Complete Guide - 2020 Edition Rating: 0 out of 5 stars0 ratingsPHP and MySQL Web Development All-in-One Desk Reference For Dummies Rating: 0 out of 5 stars0 ratingsLearning Magento Theme Development Rating: 0 out of 5 stars0 ratingsAdvanced Express Web Application Development Rating: 0 out of 5 stars0 ratingsCSS Hacks and Filters: Making Cascading Stylesheets Work Rating: 3 out of 5 stars3/5Moodle Gradebook - Second Edition Rating: 0 out of 5 stars0 ratingsLearn PHP 8: Using MySQL, JavaScript, CSS3, and HTML5 Rating: 0 out of 5 stars0 ratingsRefactor Legacy Applications A Clear and Concise Reference Rating: 0 out of 5 stars0 ratingsJava Deep Learning Essentials Rating: 0 out of 5 stars0 ratingsData Structures and Algorithms with Go: Create efficient solutions and optimize your Go coding skills (English Edition) Rating: 0 out of 5 stars0 ratingsLearning Apache Mahout Rating: 0 out of 5 stars0 ratings<html>The Unstoppable Creative<b> </b></html> Rating: 0 out of 5 stars0 ratingsMoodle 3 Administration - Third Edition Rating: 0 out of 5 stars0 ratingsMastering Magento Theme Design Rating: 0 out of 5 stars0 ratingsResponsive Design High Performance Rating: 0 out of 5 stars0 ratingsMastering Sass Rating: 0 out of 5 stars0 ratingsMagento Extensions Development Rating: 0 out of 5 stars0 ratingsLearning Drupal 6 Module Development Rating: 3 out of 5 stars3/5
Information Technology For You
How To Use Chatgpt: Using Chatgpt To Make Money Online Has Never Been This Simple Rating: 0 out of 5 stars0 ratingsHow to Write Effective Emails at Work Rating: 4 out of 5 stars4/5CompTIA A+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Core 1 Exam 220-1101 Rating: 0 out of 5 stars0 ratingsCreating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5Summary of Super-Intelligence From Nick Bostrom Rating: 5 out of 5 stars5/5CompTIA Network+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam N10-008 Rating: 0 out of 5 stars0 ratingsThe Basics of Hacking and Penetration Testing: Ethical Hacking and Penetration Testing Made Easy Rating: 4 out of 5 stars4/5ChatGPT: The Future of Intelligent Conversation Rating: 4 out of 5 stars4/5Supercommunicator: Explaining the Complicated So Anyone Can Understand Rating: 3 out of 5 stars3/5An Ultimate Guide to Kali Linux for Beginners Rating: 3 out of 5 stars3/5Linux Command Line and Shell Scripting Bible Rating: 3 out of 5 stars3/5Inkscape Beginner’s Guide Rating: 5 out of 5 stars5/5Computer Science: A Concise Introduction Rating: 4 out of 5 stars4/5Handbook of Digital Forensics and Investigation Rating: 4 out of 5 stars4/5Practical Ethical Hacking from Scratch Rating: 5 out of 5 stars5/5Data Governance For Dummies Rating: 0 out of 5 stars0 ratingsComputer Organization and Design: The Hardware / Software Interface Rating: 4 out of 5 stars4/5Health Informatics: Practical Guide Rating: 0 out of 5 stars0 ratingsCybersecurity for Beginners : Learn the Fundamentals of Cybersecurity in an Easy, Step-by-Step Guide: 1 Rating: 0 out of 5 stars0 ratingsWindows Registry Forensics: Advanced Digital Forensic Analysis of the Windows Registry Rating: 4 out of 5 stars4/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5SharePoint Designer Tutorial: Working with SharePoint Websites Rating: 1 out of 5 stars1/5CompTIA ITF+ CertMike: Prepare. Practice. Pass the Test! Get Certified!: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsPanda3d 1.7 Game Developer's Cookbook Rating: 0 out of 5 stars0 ratingsBeginner's Guide to Information Security Rating: 0 out of 5 stars0 ratingsHacking Essentials - The Beginner's Guide To Ethical Hacking And Penetration Testing Rating: 3 out of 5 stars3/5ARDUINO PROGRAMMING FOR BEGINNERS: Tips and Tricks for the Efficient Use of Arduino Programming Rating: 0 out of 5 stars0 ratings
Reviews for Moodle JavaScript Cookbook
0 ratings0 reviews
Book preview
Moodle JavaScript Cookbook - Alastair Hole
Table of Contents
Moodle JavaScript Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Combining Moodle and JavaScript
Introduction
Creating a new Moodle PHP page
Getting ready
How to do it...
How it works...
Loading a JavaScript file
Getting ready
How to do it...
How it works...
Loading a JavaScript file in
Getting ready
How to do it...
How it works...
Generating a JavaScript function call from PHP
Getting ready
How to do it...
How it works…
Passing variables from PHP to JavaScript
Getting ready
How to do it...
How it works…
Ensuring compliance with XHTML Strict
Getting ready
How to do it...
How it works…
Retrieving language strings from Moodle
Getting ready
How to do it...
How it works…
2. Moodle and Yahoo! User Interface Library (YUI)
Introduction
Initializing the YUI 3 library
Getting ready
How to do it...
How it works...
Loading additional YUI modules
How to do it...
Loading YUI 2 modules from YUI 3
Getting ready
How to do it...
How it works...
Attaching basic event handlers
Getting ready
How to do it...
How it works...
Attaching advanced DOM event handlers
Getting ready
How to do it...
How it works...
Implementing event delegation
Getting ready
How to do it...
How it works...
Debugging with the YUI console
Getting ready
How to do it...
How it works...
3. Moodle Forms Validation
Introduction
Adding a required field
Getting ready
How to do it...
How it works...
Adding a field with a maximum length
Getting ready
How to do it...
How it works...
Adding a field with a minimum length
Getting ready
How to do it...
How it works...
Adding a field length within in a specified range
Getting ready
How to do it...
How it works...
Adding a valid e-mail address field
Getting ready
How to do it...
How it works...
Adding custom validation with a Regular Expression
Getting ready
How to do it...
How it works...
Adding a field that accepts only alphabetic characters
Getting ready
How to do it...
How it works...
Adding a field that accepts only alphanumeric characters
Getting ready
How to do it...
How it works...
Adding a field that accepts only numeric characters
Getting ready
How to do it...
How it works...
Rejecting punctuation characters
Getting ready
How to do it...
How it works...
Rejecting input without a leading zero
Getting ready
How to do it...
How it works...
Comparing with another field
Getting ready
How to do it...
How it works...
Adding a custom JavaScript validation function callback
Getting ready
How to do it...
How it works...
4. Manipulating Data with YUI 3
Introduction
Using IO to request a URI
How to do it...
How it works...
Using IO's alternative transport method for requesting external URIs
Getting ready
How to do it...
How it works...
Using PHP as a proxy to load data from an external domain
How to do it...
How it works...
Parsing XML with DataSource
How to do it...
How it works...
Parsing JSON with DataSource
Getting ready
How to do it...
How it works...
Parsing CSV data with DataSource
Getting ready
How to do it...
How it works...
Retrieving data from a Moodle 2.0 web service
Getting ready
How to do it...
How it works…
5. Working with Data Tables
Introduction
Initializing a YUI DataSource
How to do it...
How it works...
Displaying data
How to do it...
How it works...
Basic column sorting
Getting ready
How to do it...
How it works...
Adding paging
Getting ready
How to do it...
How it works...
Enabling scrolling
Getting ready
How to do it...
How it works...
Enabling editing
Getting ready
How to do it...
How it works...
6. Enhancing Page Elements
Introduction
Adding a text box with auto-complete
How to do it...
How it works...
Adding a combo box with auto-complete
How to do it...
How it works...
Displaying auto-updating data
How to do it...
How it works...
Enabling resizable elements
How to do it...
How it works...
Adding custom tooltips
How to do it...
How it works...
Adding custom button controls
How to do it...
How it works...
7. Advanced Layout Techniques
Introduction
Adding a fly-out navigation menu
How to do it...
How it works...
Adding a drop-down navigation menu
Getting ready
How to do it...
How it works...
Displaying a tree-view navigation menu
How to do it...
How it works...
Adding a tabbed content control
How to do it...
How it works...
Displaying content in a modal window
How to do it...
How it works...
8. Animating Components
Introduction
Fading in an element
How to do it...
How it works...
Fading out an element
How to do it...
How it works...
Scrolling an element
How to do it...
How it works...
Resizing an element
How to do it...
How it works...
Animating with easing
How to do it...
How it works...
Moving an element along a straight path
How to do it...
How it works...
Moving an element along a curved path
How to do it...
How it works...
Changing an element's color
How to do it...
How it works...
Sequencing multiple animations
How to do it...
How it works...
9. Integrating External Libraries
Introduction
Adding the jQuery framework
Getting ready
How to do it...
How it works...
Adding the MooTools framework
Getting ready
How to do it...
How it works...
Adding the Dojo framework
Getting ready
How to do it...
How it works...
Adding the Prototype framework
Getting ready
How to do it...
How it works...
Adding the script.aculo.us add-on to Prototype
Getting ready
How to do it...
How it works...
There's more…
Adding image enlargement with Lightbox 2
Getting ready
How to do it...
How it works...
There's more…
Index
Moodle JavaScript Cookbook
Moodle JavaScript Cookbook
Copyright © 2011 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2011
Production Reference: 1180411
Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK.
ISBN 978-1-849511-90-2
www.packtpub.com
Cover Image by Rakesh Shejwal (<shejwal.rakesh@gmail.com>)
Credits
Author
Alastair Hole
Reviewers
Anthony Borrow
Mauno Korpelainen
Susan Smith Nash
Acquisition Editor
Chaitanya Apte
Development Editor
Roger D'souza
Technical Editor
Azharuddin Sheikh
Copy Editor
Neha Shetty
Indexer
Hemangini Bari
Editorial Team Leader
Akshara Aware
Project Team Leader
Priya Mukherji
Project Coordinator
Srimoyee Ghoshal
Proofreader
Joel T. Johnson
Production Coordinator
Kruthika Bangera
Cover Work
Kruthika Bangera
About the Author
Alastair Hole is a web software developer, who is currently specializing in educational software, particularly that which pertains to Further and Higher Education in the UK. His web development experience began in the post dot-com boom era, working on business-to-business e-commerce web applications in the publishing industry with a focus on back-office integration. He has since transferred his talents to the educational sector and has created projects which have gone on to receive awards from organizations such as The Times Educational Supplement and the IMS Global Learning Consortium.
Alastair is the author of the award-winning Moodle IMS Content Package repository plug-in MrCUTE—Moodle Repository: Create, Upload, Tag, & Embed
, which is an Open Source project commissioned by the Joint Information Systems Committee (JISC) that has seen significant use in Moodle sites worldwide, from Scotland to Australia.
Thank you to everyone who has contributed to this book's completion, be it patience with missed deadlines or encouragement when all seemed overwhelming. Thank you, Ma and Pa Hole for their foresight in recognizing that one day I would teach myself how to reassemble everything that I have ever unscrewed, detached, disassembled, or otherwise fiddled with. Thank you to The Internet for being an ever expanding well of autodidactic opportunity. And remember, It's just a ride. And we can change it any time we want.
About the Reviewers
Anthony Borrow, S.J. is a Jesuit of the New Orleans Province who has been active in the Moodle community for five years. Anthony has an M.A. in Counseling from Saint Louis University, and a Masters of Divinity from the Jesuit School of Theology of Santa Clara University. Anthony has worked on the design and implementation of various database systems since 1992.
Anthony serves the Moodle community as its CONTRIB Coordinator. In that role, Anthony has presented at various MoodleMoots (conferences) across the United States and provided in-house training opportunities for institutions learning how to implement Moodle. Anthony is currently the Campus Minister at Cristo Rey Jesuit College Preparatory (http://cristoreyjesuit.org/) and provides technical advice to the Jesuit Secondary Education Association (http://jsea.org) and the Jesuit Virtual Learning Academy (http://jvla.org/).
Anthony is the co-author of the Honduras chapter of Teen Gangs: A Global View, and also has been a technical reviewer of various Packt books.
I am grateful to the Moodle community for continually inspiring me to learn more about educational technologies and fostering an environment where every voice contributes to building that community.
Mauno Korpelainen teaches Mathematics for high school and adult students in Hyvinkää, Finland, has been a PHM (Particularly Helpful Moodler) for several years, and is one of the moderators of the moodle.org forums.
Susan Smith Nash is currently the Director of Education and Professional Development for the American Association of Petroleum Geologists (AAPG) in Tulsa, Oklahoma, and an adjunct professor at The University of Oklahoma. She was the Associate Dean for graduate programs at Excelsior College (Albany, NY). Previous to that, she was the Online Courses Manager at the Institute for Exploration and Development Geosciences and Director of Curriculum Development for the College of Liberal Studies, University of Oklahoma, Norman, OK, where she developed an online degree program curriculum for online courses at The University of Oklahoma. She also developed an interface for courses, as well as administrative and procedural support, support programmers, protocol and training manuals, and marketing approaches. She obtained her Ph.D. and M.A. in English and a B.S. in Geology from the University of Oklahoma. Nash blogs at E-Learning Queen (http://www.elearningqueen.com) and E-Learners, and has written articles and chapters on mobile learning, poetics, contemporary culture, and e-learning for numerous