Download - Introduction to Moodle Development
![Page 1: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/1.jpg)
Introduction to Moodle Development
Jonathan MooreFounder
![Page 2: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/2.jpg)
Oklahoma Moot 2010 Edition
![Page 3: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/3.jpg)
Background and context
● Managed thousands of Moodle sites● Managed millions of Moodle user accounts● Over 10 years experience with Moodle● Dozens of Moodle dev and reporting projects● Tuning, scalability, and performance expert● Author of Moodle Module Development
![Page 4: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/4.jpg)
Things you need
● Local Moodle installation
– https://download.moodle.org/macosx/– https://download.moodle.org/windows/
● Text editor● Thinking cap!
![Page 5: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/5.jpg)
Format / objectives
● Create a 'Hello World' block● Use language files for localization● Implement capabilities● Scheduled execution● Ask questions!● Share your tips
![Page 6: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/6.jpg)
Getting to know you
● How many new developers?● How technical are you?● Are you new to Moodle?● Does anyone know PHP already?
![Page 7: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/7.jpg)
Getting to know you
● What are you hoping to learn today?● What is your ultimate goal?
![Page 8: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/8.jpg)
What is a block?
![Page 9: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/9.jpg)
Moodle source folder
![Page 10: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/10.jpg)
Finding your source folder
![Page 11: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/11.jpg)
Hands-on
● Install local Moodle● Find source code folder
![Page 12: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/12.jpg)
Minimal block requirements
● Choose a block name (ex helloworld)● Block folder in /block (ex /block/helloworld)● block_name.php (ex block_helloworld.php)
– Extend block class
– Define init()
– Define get_content() function
● Create language file
![Page 13: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/13.jpg)
Language files
● Moodle supports unicode for localization / multi-language support
● Stored in /lang folder of module● Each language gets its own folder
ex/lang/en_utf8● Assigns to global $string hash
![Page 14: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/14.jpg)
Hands-on
● Download newblock template– https://github.com/danielneis/moodle-
block_newblock
● Rename references from newblock to helloworld● Install into Moodle
![Page 15: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/15.jpg)
Settings
● Stores individual block instance configuration● Requires
– Settings.php– edit_form.php
![Page 16: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/16.jpg)
Hands-on
● Create configuration option to set block text
![Page 17: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/17.jpg)
Hands-on
● Display user's firstname in block
![Page 18: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/18.jpg)
Capabilities
● Define access limits / powers for users● Modules can check for capabilities and limit access● Can use built-in and custom created capabilities
![Page 19: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/19.jpg)
Hands-on
● Add capability to view block
![Page 20: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/20.jpg)
Scheduling execution● Update init() function
– $this->cron = 5; //where 5 is minutes between runs● Define cron() function
![Page 21: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/21.jpg)
Hands-on
● Add a cron call for our block
![Page 22: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/22.jpg)
Developer tools
![Page 23: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/23.jpg)
PhpStorm IDE
![Page 24: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/24.jpg)
More tools
● Git – code management
– see github and bitbucket services● Xdebug – debugger● Code checker – style checker● PHP Unit – code level testing● Behat – browser automation
![Page 25: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/25.jpg)
And more dev tools
● Moodle Development KIT (MDK)● MOOSH● XHProf● GRUNT – Bootstrap tool● Shifter – Javascript compiling
![Page 26: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/26.jpg)
What we do
● Expert advice and eLearning program review● Evangelism and training● Instructional design● Custom development● Reporting● System tuning● Performance assessment
![Page 27: Introduction to Moodle Development](https://reader033.vdocument.in/reader033/viewer/2022051404/58ecacd11a28ab9e6c8b4583/html5/thumbnails/27.jpg)
Questions?
● http://elearningconsultancy.com● [email protected]● Twitter: @moorejon● Skype: moorejon07