Unit 5 Part A - Moodle's Directory Structure
Unit 5 Part A - Moodle's Directory Structure
http://dev.moodle.org/mod/resource/view.php?id=34
Jump to...
Moodle Dev Courses Moodle Programming Resources Unit 5 Part A - Moodle's Directory Structure
1 of 6
9/23/2009 6:12 PM
http://dev.moodle.org/mod/resource/view.php?id=34
functions, email functions or anything that needs to be run on a regular basis. For example, cron will trigger the system to create the backups of courses at the time specified in the administration settings. It also triggers any messaging module or forum email notifications, but not all functions are called each time the cron runs. Some functions, such as unenrolling students who have not logged in or deleting old copies of log files, are only run occasionally. The cron.php file has a section which will randomly call these core tasks approximately 1 in 5 times the cron runs. Note that the machine performing the cron does not need to be the same machine that is running Moodle. For example, if you have a limited web hosting service that does not have a cron service, then you might choose to run cron on another server or on your home computer. All that matters is that the cron.php file is called regularly. The load of this script is not very high, so 5 minutes is usually reasonable, but you can reduce the time period to 15 minutes or even 30 minutes. It's best not to make the time period too long, as delaying mail-outs can slow down activity within the course. Remember that mail-outs also wait for the editing time to expire before being queued for sending. As long as cron is run regularly and fairly frequently, the load is not very high. However, if it hasn't been run in a long time or the proceessing frequency is too far apart the loads can be considerable depending on site activity and any background batch processes such as enrolling or un-enrolling that may need to occur. top
2 of 6
9/23/2009 6:12 PM
http://dev.moodle.org/mod/resource/view.php?id=34
When a Moodle course is created it automatically generates several 'blocks' that allow you to control how you navigate or find information in Moodle (examples of these include the "Site Administration" block for administrator, the "Search Forums" block or the "Calendar" block for all users, etc.). In addition to the blocks that automatically appear, you will notice that you have several options for further blocks of tools (from the Blocks drop down menu when editing is turned on) to add to your course. Examples include the "Remote RSS Feeds" block, the "Blog" block, etc.). Similarly, you can delete any of the existing blocks if you feel they are unnecessary to your course and you can also move the blocks so that they appear on a single side rather than on both sides of the middle content (this can only be achieved using the move or delete buttons with editing turned on). In a typical Moodle 1.8 installation, you will see a set of standard blocks available for each course creator.
If you look into your local Moodle installation and navigate to /blocks directory, you will find a matching directory for each block.
3 of 6
9/23/2009 6:12 PM
http://dev.moodle.org/mod/resource/view.php?id=34
If you need to debug the "Blog Menu" block, for example, you go to the "blog_menu' directory. If you need to debug the "Search Forums" block, begin with the "search_forums" directory, etc. Later in this course we will introduce more about how to write a Moodle block from a programmer's perspective. Additional details about "Blocks administration" (usually from a system administrator's perspective).
Important Tip:
Localized strings should be in a separate language
4 of 6
9/23/2009 6:12 PM
http://dev.moodle.org/mod/resource/view.php?id=34
directory such as For a Moodle developer, this is probably one of the most important directories that you will use. The /lib directory contains many library files (275 directories and 2179 files, as of Moodle 1.8.3+) ranging from ajax and adodb libraries, to xmldb and yui (Yahoo User Interface) libraries. The most important three library files are probably moodlelib.php, weblib.php, and accesslib.php. These three library files will be discussed in more depth in Part B of this Unit. However, this is a brief summary of these three library files: moodlelib.php is the Moodle "main" library. This file contains of miscellaneous general-purpose Moodle functions (such as
set_user_preferences(), get_user_timezone(),
en_custom. The default is if a string is not found in one language it falls back to en_utf8. This way, your changes override the default, but you do not have to include every string or manage changing core language strings. You just have to manage your localized settings.
and so on).
weblib.php contains functions that help Moodle produce web output. For example, it has functions such as format_text_email(),
print_header(), print_group_menu(),
etc.
datalib.php contains functions that alllow moodle to access the database, it also has functions that deal with the role capabilities, such as load_defaultuser_role(),
get_guest_role(),
etc.
top
5 of 6
9/23/2009 6:12 PM
http://dev.moodle.org/mod/resource/view.php?id=34
You are logged in as Anguillo Gulianni from Moodle.org (Logout) Moodle Programming
6 of 6
9/23/2009 6:12 PM