Creating Moodle modules - PowerPoint PPT Presentation

1 / 22
About This Presentation
Title:

Creating Moodle modules

Description:

Library of simplifying' database access functions. Every table has auto-increment id field ... Basic XHTML content. One standard file mods.html. Add other files ... – PowerPoint PPT presentation

Number of Views:71
Avg rating:3.0/5.0
Slides: 23
Provided by: sm15
Category:

less

Transcript and Presenter's Notes

Title: Creating Moodle modules


1
Creating Moodle modules
  • sam marshall

2
Contents
  • Introduction to Moodle system
  • Introduction to modules
  • Versions and database tables
  • Capabilities
  • Language files and help files
  • Forms
  • view.php

3
Introduction to Moodle system
  • PHP ?
  • Database-driven
  • Library of simplifying database access
    functions
  • Every table has auto-increment id field
  • Little persistent state
  • Session data exists, not heavily used
  • Mainly functions, not object-oriented
  • Independent PHP scripts

4
Introduction to modules
  • Activities
  • Appear on front page of course
  • Add using dropdown
  • Update settings
  • Link goes to modules own PHP files
  • Whats in a module?

5
(No Transcript)
6
(No Transcript)
7
(No Transcript)
8
mod/name
  • db
  • install.xml
  • access.php
  • update.php
  • version.php
  • lang
  • en_utf8
  • name.php
  • help
  • mods.html
  • lib.php
  • mod_form.php
  • styles.php
  • view.php

9
Database structure
  • prefix_course_modules
  • An instance of a module in a particular course
  • prefix_name
  • Your table. Must have id, name, course
  • And index on course
  • cm-gtinstance name-gtid
  • Variables
  • cm, name, course

10
Versions and database tables
  • install.xml
  • Used when installing for first time
  • Create with horrible editor (not by hand!)
  • update.php
  • Used after code update on existing database
  • Code in PHP
  • version.php
  • Module version e.g. 2007031600

11
(No Transcript)
12
Capabilities
  • Define capabilities for your module
  • Array in access.php
  • Specifies available capabilities and who has them
    by default
  • mod/nameedit, mod/nameview,
  • Check capabilities
  • Get context object for current module instance
  • has_capability(mod/nameedit,context)

13
Language files
  • All strings taken out into language files
  • Except system errors
  • But not except user errors!
  • Why? Now or future contribution to community
  • Language file goes in lang/en_utf8/name.php
  • stringfrogscanjumpFrogs can jump
  • stringhowhighHow high? a metres!
  • A couple standard strings (module name)

14
Help files
  • In lang/en_utf8/help
  • Basic XHTML content
  • One standard file mods.html
  • Add other files
  • Link to them with standard help button
  • For example, in forms

15
Forms
  • In case youve forgotten

16
(No Transcript)
17
Forms
  • mod_form.php
  • PHP QuickForm Moodle extensions
  • mform-gtaddElement('text', 'name',
    get_string('name'))
  • Various types provided
  • Easy to add help buttons
  • Does formatting for you
  • And accessibility (hopefully)

18
view.php
  • Your own PHP code
  • Can do anything
  • Should use Moodle standard functions where
    appropriate
  • Header, footer, tabs, etc.
  • Other PHP scripts too (as needed)
  • view.php is just where the link goes

19
(No Transcript)
20
Conclusion
  • Standard platform features need to be used
  • Maintaining
  • Administration (capabilities)
  • Community sharing
  • Initial design is important
  • Skills needed
  • Database
  • PHP
  • And

21
Bonus scare slide
  • Security!!!!1!!1!!eleventy-one
  • Public Web application
  • Easy to make mistakes
  • Check permission on action as well as when
    showing link
  • Avoid SQL injection
  • Be careful!

22
To end on a positive note
  • ?
Write a Comment
User Comments (0)
About PowerShow.com