Getting Modular with Moodle

Exclusive offer: get 50% off this eBook here
Moodle 1.9 Top Extensions Cookbook

Moodle 1.9 Top Extensions Cookbook — Save 50%

Over 60 simple and incredibly effective recipes for harnessing the power of the best Moodle modules to create effective online learning sites

$26.99    $13.50
by Michael de Raadt | November 2010 | Cookbooks Moodle Open Source

In the previous article, Introduction to Moodle Modules, we saw how to add and install modules.

In this article by Michael de Raadt, author of Moodle 1.9 Top Extensions Cookbook, we will cover:

  • Changing site-wide settings
  • Getting modules to speak your language
  • Reporting bugs and suggesting improvements
  • Removing modules

 

Moodle 1.9 Top Extensions Cookbook

Moodle 1.9 Top Extensions Cookbook

Over 60 simple and incredibly effective recipes for harnessing the power of the best Moodle modules to create effective online learning sites

  • Packed with recipes to help you get the most out of Moodle modules
  • Improve education outcomes by situating learning in a real-world context using Moodle
  • Organize your content and customize your courses
  • Reviews of the best Moodle modules—out of the available 600 modules
  • Installation and configuration guides
  • Written in a conversational and easy-to-follow manner
        Read more about this book      

(For more resources on Moodle, see here.)

Changing site-wide settings

Activity modules and blocks can have site-wide settings that you can adjust. These settings allow consistent changes in the use of the module across an entire site, but even during testing you might want to change such settings. It may be that you just want to see what settings can be changed globally for a module.

Getting ready

To achieve this you must have your web server running with Moodle installed. You need to be able to log in as the administrator, or get the help of someone who can. You should have installed the modules that you want to change settings for.

The following steps assume you have installed the Progress Bar block, which has global settings that can be changed.

How to do it...

Log in as the site administrator and visit the root page of the site. To get to the global settings of a module, on the Site Administration menu, select Modules, then Activities or Blocks, whichever is appropriate. The Progress Bar block is a block, so select Blocks to reach its global settings.

The next step is to select the name of the module. For our test, the module name is Progress Bar. The settings for the module should appear in a form.

Moodle 1.9 Top Extensions Cookbook

Not all activity modules or blocks have global settings. For many modules, this is not necessary. Changes to the global settings affect the configuration of the module, including any instances that may already exist, and any that are added in future, across the site.

There's more...

Be a little careful when changing global settings on a live site. If the module is currently in use, changing global settings can affect the experience of students and teachers. Accidentally using invalid global settings can detrimentally affect the running of the module on the site.

See also

  • Adding modules to Moodle
  • Getting rid of modules

Getting modules to speak your language

Another feature of Moodle is its capacity for internationalization. This means that the same software can be used by people speaking different languages. While translations for over 80 languages are available for the core functionality of Moodle, most modules only offer translations for a smaller number of languages, and the language you are teaching in may not be one of them.

Adding a translation for a module is simple to do. If you give your translation to the author of the module, your efforts could also benefit others who speak your language.

Getting ready

It is assumed that you have set the default language for your site. If not, there is more information about adding a language pack and setting the language for your site later.

In order to create a translation for a module, you don't need any real programming experience; it's actually quite simple. Some understanding of HTML tags can be an advantage.

You will need a text editor that can create and edit Unicode files. Word processors are not appropriate for this task, and a simple editor, such as Windows Notepad, is not up to the job. There are many free editors available that will allow you to create and edit Unicode files. One example available for Windows is Notepad++, which is a free editor and is also available as a portable application.

The steps that follow provide an example that assumes the Progress Bar block has been installed.

How to do it...

Where the module was installed, there will usually be a /lang folder. For the Progress Bar block this is located at moodle/blocks/progress/lang. Within this folder, there are folders for different languages, most of them contributed by users around the world.

Moodle 1.9 Top Extensions Cookbook

If you are reading this, it is assumed you have an understanding of English, so have a look inside the en_utf8/ folder. You will see a file called block_progress.php and another directory called help/. The block_progress.php file contains strings of text used in the module, each with a code and the string displayed on screen. Open this file in your editor to see the contents.

Moodle 1.9 Top Extensions Cookbook

Inside the lang/help/progress/ directory there are a number of HTML files, each relating to a help topic. These appear when a help icon (usually appearing as a question mark) is clicked. Opening these files in your web browser will show you the rendered version of these files and opening them in your editor will show you the HTML source of the documents.

Moodle 1.9 Top Extensions Cookbook

To add a new language, you first need to find out the two letter code for your language. To see the list of supported languages visit the following site. You will also see the code letters for each language, and you need to follow the same code. Refer to http://download.moodle.org/lang16/.

Return to the lang/ folder. For the Progress Bar block this is at moodle/blocks/progress/lang/. Assuming that you know English as a second language, copy the en_utf8/ folder and all of its content. Rename the folder with the two letter code for your language, for example, the folder for Afrikaans would be af_utf8/. Be sure to preserve the filenames and folder names within (they do not need translation, only the contents).

Open the block_progress.php file in your Unicode editor. You need to translate the string on the right of the = symbol, within the quotes. Do not translate the code value for the string on the left. You may need to see the string in use to get a sense of what the string is intended for, in order to make an accurate translation. If you include any apostrophes within the string, escape the quote with a slash, as shown in the following example, otherwise the string will be seen as coming to an end earlier than it should.

$string['owners'] = 'Owner\'s';

If there is code within the strings, or HTML tags, that you are unsure about, leave these and just translate any text around them.

You can also translate the HTML files in moodle/blocks/progress/lang/help/progress/ to produce help files in your language. Open these in your editor and translate the text within the files. Again, avoid changing any HTML or code you don't understand. Some help files also include PHP code segments within <?php and ?> tags, avoid changing this content.

Be sure to test your translated files. If, after changing a translation file, nothing appears on the course page, it may be that you have inadvertently created an error. Typically this comes from mismatched quotes around strings. Be sure each starting quote is matched with a closing quote, and any enclosed quotes are escaped. Test that your translated text items are appearing correctly and have an appropriate meaning in your language. Once created, you can use this translation throughout your site.

The final step is to send your translation to the author of the module. You should be able to find their contact details on the Moodle Modules and plugins database entry page for the module. If you have translated the language strings but not translated the help files, this is still a helpful contribution that can be shared. Zip up the files you have translated and e-mail them to the author who will usually be more than happy to include your contribution within the module for future downloaders.

How it works...

Each time the module is loaded, its code is interpreted by the web server and HTML is produced to form the part of the page where the module will appear. Within the code, instead of writing text strings in the author's language, there are calls to functions that check the language and draw the appropriate strings from the language files. This way, all that is needed to change from one language to another is a different language file.

There's more...

If you want to use another language throughout your Moodle site, the following sections are a basic guide for installing and selecting the language.

Adding a language pack

Visit the following site to find if a language pack is available for your language: http://download.moodle.org/lang16/.

If your language is available, download the appropriate zip file and extract its contents to the directory moodle/lang/. If your language is Afrikaans, for example, the language files should be contained in moodle/lang/af_utf8/. Ensure you do not introduce additional unnecessary directory levels.

Selecting a language for your site and courses

A language can be set as a default for courses on the site. This can be overridden at the course level if desired, or by students individually.

To set the default language, log in as administrator and go to the site root page. On the Site Administration menu, select Language, then Language Settings. The default language can be set on the page that appears.

Moodle 1.9 Top Extensions Cookbook

Individual users can set a preferred language in their profile settings.

Moodle 1.9 Top Extensions Cookbook

For individual courses a language can be set. This will "force" students to use that particular language rather than their preferred language.

Moodle 1.9 Top Extensions Cookbook

See also

  • If it's not quite what you want...
Moodle 1.9 Top Extensions Cookbook Over 60 simple and incredibly effective recipes for harnessing the power of the best Moodle modules to create effective online learning sites
Published: November 2010
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:
        Read more about this book      

(For more resources on Moodle, see here.)

If it's not quite what you want...

You may have found a module that is helpful, but not exactly what you want. There are a number of ways that you can contribute to changes in modules.

Getting ready

It is assumed that you have installed and tested the module you are interested in.

How to do it...

You can contribute in different ways. You might want to do the following:

  • Thank the author and let them know you are interested in their module
  • Request a new feature
  • Report a bug

The best place to thank the author is on the Modules and plugins database entry for the module. That way others will see that the module is worth testing. You can also give a rating for the module there.

To request a new feature, the best way is to e-mail the author of the module. Authors are not notified of postings on their Modules and plugins entry page, they only see these postings if they check manually. If there is a forum thread for the module, that can also be a good place to contribute ideas for changes. The authors will usually be subscribed to such forums, particularly if they have posted to the forum themselves.

If you find a bug in a module, try to find a method to reproduce the bug. Consider if the bug is something that might only happen on your server for some reason. If you're confident that you have found a bug that needs fixing, create a "new issue" on the Moodle Tracker at this URL: http://tracker.moodle.org/secure/Dashboard.jspa . You will need to create an account. The tracker supports bug resolution and communication between you and the author.

How it works...

Moodle is all about learning and sharing. The people who create contributed modules are often teachers themselves, or people interested in open source software. Please allow time for bugs to be fixed and don't be surprised if the author rejects your feature suggestion. It's really 'their baby'.

Module authors have 'opened up' their source. Within reason, you are free to make changes to the modules so that they suit your needs and possibly the needs of others at your institution. If this is what you want to do, read on.

There's more...

Because the source of modules is made available, you are able to make changes yourself, or to ask other, possibly more technically minded people, to do so for you.

If you do make changes, you need to be willing to share the source code you write with others, and stick to the GNU license conditions. More information is available on the following two pages:
http://docs.moodle.org/en/About_Moodle
http://docs.moodle.org/en/License

Creating your own modules

If you can't find a module to suit your needs in the Modules and plugins database, you can always create your own. Writing and sharing Moodle modules is a rich and rewarding experience. The best part about sharing modules you have written is knowing that your code will be used around the world. The idea you have may also help many others.

There are conventions, libraries, interfaces, and processes that need to be learned. To get started, visit this URL: http://docs.moodle.org/en/Development.

Sometimes, the best way to see how it's done is to look at other authors' code.

Getting rid of modules

So you gave that module a go and it wasn't what you wanted. How can you get rid of it?

Getting ready

It is assumed you have your web server running, you have installed a module and now you want to say goodbye to it.

How to do it...

Activity modules (and usually integrations) and blocks can be deleted in two steps.

  1. For activity modules, visit the Activities management page (Site Administration | Modules | Activities | Manage Activities). Click on Delete to remove all instances of the module in courses and any tables set up for the module.
  2. For blocks, visit the Blocks management page (Site Administration | Modules | Blocks | Manage Blocks). Click on Delete to remove all instances of the block and any tables set up for the block module.

After deleting activity modules and blocks using the Site Administration interface, you still need to delete the code for these modules. If you don't remove the code, the module will be re-installed the next time you visit the Notifications page.

How it works...

As Moodle is modular and relies on many contributed modules to allow flexibility, the means of removing modules needs to be just as simple as adding them. With activity modules and blocks, that is the case. This covers most modules you will want to add. For other types of modules, removal is not so simple. To fi nd out more, read on.

There's more...

Filters, course formats, assignment types, and question types need to be removed in special ways.

Removing filters

To remove a filter, first visit the Filters page (Site Administration | Modules | Filters | Manage Filters) and disable the filter (click on the eye icon). You are then free to remove the files for the filter from moodle/filter/ directory.

Removing course formats

To remove a course format, simply remove its directory from moodle/course/format/. If the format was in use and is no longer available, the format will revert back to a default. It might be wise to check which courses are using the format and set the format for those courses to an acceptable alternative before removing the course format.

Removing assignment types and question types

Unfortunately there is no clean way to remove an assignment type. It's an activity, but it's not an activity module that appears in the list of activities in the Site Administration section. Question types are also somewhat problematic to remove.

If the assignment type or question type is no longer needed, follow these steps.

  1. If you have a live site that services teachers and students, put the site in Maintenance mode (Site Administration | Server | Maintenance mode).
  2. Remove all instances of the assignment type or question type from courses.
  3. Manually remove the tables related to the module from the database. Take care not to remove other tables such as the 'assignment submissions table' which is used generally. If you are not sure about which tables to remove, don't remove any.
  4. Remove the source code.
  5. Take the site out of Maintenance mode.

Allowing modules to access outside information

Some modules require access to information outside your server. To achieve this, some modules use the cURL PHP library. If PHP is installed, the cURL library is likely to be available with your web server, but it may be disabled. The XAMPP server has cURL disabled by default.

Getting ready

To enable cURL in PHP 5 on XAMPP, you need to edit the php.ini file. This file is located in the php\ directory under your web server's root directory.

How to do it...

Within the file, locate the following line:

;extension=php_curl.dll

Remove the semi-colon to uncomment this line. This will enable the cURL library. Save the file after making this change. Restart the Apache server for this to take effect.

Moodle 1.9 Top Extensions Cookbook

If you visit the phpinfo page, cURL support should be enabled.

Even with cURL enabled, you may still have problems if your site is hosted behind a firewall. If this is the case, contact your network administrator.

Summary

In this article we saw how to change site-wide settings, report bugs, and remove modules.


Further resources on this subject:


Moodle 1.9 Top Extensions Cookbook Over 60 simple and incredibly effective recipes for harnessing the power of the best Moodle modules to create effective online learning sites
Published: November 2010
eBook Price: $26.99
Book Price: $44.99
See more
Select your format and quantity:

About the Author :


Michael de Raadt

Michael de Raadt is a lecturer at the University of Southern Queensland and a keen Moodler. Driven by his teaching experience, Michael is responsible for developing a number of widely used Moodle modules. Michael’s research delves into technologies that are changing the face of education.

Books From Packt


Moodle 2.0 First Look
Moodle 2.0 First Look

Moodle 1.9 Extension Development
Moodle 1.9 Extension Development

Moodle 1.9 for Design and Technology
Moodle 1.9 for Design and Technology

Moodle 1.9 Theme Design: Beginner's Guide
Moodle 1.9 Theme Design: Beginner's Guide

Moodle 1.9 Testing and Assessment
Moodle 1.9 Testing and Assessment

Moodle 1.9 Teaching Techniques
Moodle 1.9 Teaching Techniques

PostgreSQL 9.0 High Performance
PostgreSQL 9.0 High Performance

Learning jQuery 1.3
Learning jQuery 1.3


Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software