mirror of
https://github.com/moodle/moodle.git
synced 2025-01-22 08:11:26 +01:00
308 lines
16 KiB
HTML
308 lines
16 KiB
HTML
<head>
|
|
<title>Moodle Docs: Developers Manual</title>
|
|
<link rel="stylesheet" href="../theme/standard/styles.php" type="TEXT/CSS">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<style type="text/css">
|
|
<!--
|
|
.sectionheading {
|
|
font-size: medium;
|
|
font-weight: bold;
|
|
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
|
|
border: 1px dotted;
|
|
padding: 10px;
|
|
background-color: #EEEEEE;
|
|
}
|
|
-->
|
|
</style>
|
|
</head>
|
|
|
|
<body bgcolor="#FFFFFF">
|
|
<h2>Developers Manual</h2>
|
|
<p>This document describes some of Moodle's design and how you can contribute.</p>
|
|
<p>It's a bit thin at the moment - better documentation will come eventually!</p>
|
|
<p>Sections in this document:</p>
|
|
<ol>
|
|
<li><a href="#architecture">Moodle architecture</a></li>
|
|
<li><a href="#contribute">How you can contribute</a>
|
|
<ul>
|
|
<li><a href="#activities">Learning activities</a></li>
|
|
<li><a href="#themes">Themes</a></li>
|
|
<li><a href="#languages">Languages</a></li>
|
|
<li><a href="#database">Database Schemas</a></li>
|
|
<li><a href="#courseformats">Course formats</a></li>
|
|
<li><a href="#doc">Documentation and articles</a></li>
|
|
<li><a href="#bugs">Participating in the bug tracker</a></li>
|
|
</ul>
|
|
</li>
|
|
</ol>
|
|
<p> </p>
|
|
<h3 class="sectionheading"><a name="architecture"></a>1. Moodle architecture</h3>
|
|
<blockquote>
|
|
<p>From a system administrator's perspective, Moodle has been designed according
|
|
to the following criteria:</p>
|
|
<ol>
|
|
<li><strong>Moodle should run on the widest variety of platforms</strong><br>
|
|
<br>
|
|
The web application platform that runs on most platforms is PHP combined
|
|
with MySQL, and this is the environment that Moodle has been developed in
|
|
(on Linux, Windows, and Mac OS X). Moodle also uses the ADOdb library for
|
|
database abstraction, which means Moodle can use <a href="http://php.weblogs.com/ADOdb_manual#drivers">more
|
|
than ten different brands of database</a> (unfortunately, though, it can
|
|
not yet <em><strong>set up tables</strong></em> in all these databases -
|
|
more on this later). <br>
|
|
<br>
|
|
</li>
|
|
<li><strong>Moodle should be easy to install, learn and modify</strong><br>
|
|
<br>
|
|
Early prototypes of Moodle (1999) were built using <a target=_top href="http://www.zope.org/">Zope</a>
|
|
- an advanced object-oriented web application server. Unfortunately I found
|
|
that although the technology was pretty cool, it had a very steep learning
|
|
curve and was not very flexible in terms of system administration. The PHP
|
|
scripting language, on the other hand, is very easy to get into (especially
|
|
if you've done any programming using any other scripting language). Early
|
|
on I made the decision to avoid using a class-oriented design - again, to
|
|
keep it simple to understand for novices. Code reuse is instead achieved
|
|
by libraries of clearly-named functions and consistent layout of script
|
|
files. PHP is also easy to install (binaries are available for every platform)
|
|
and is widely available to the point that most web hosting services provide
|
|
it as standard.<br>
|
|
<br>
|
|
</li>
|
|
<li><strong>It should be easy to upgrade from one version to the next</strong><br>
|
|
<br>
|
|
Moodle knows what version it is (as well as the versions of all plug-in
|
|
modules) and a mechanism has been built-in so that Moodle can properly upgrade
|
|
itself to new versions (for example it can rename database tables or add
|
|
new fields). If using CVS in Unix for example, one can just do a "cvs
|
|
update -d" and then visit the site home page to complete an upgrade.<br>
|
|
<br>
|
|
</li>
|
|
<li><strong>It should be modular to allow for growth</strong><br>
|
|
<br>
|
|
Moodle has a number of features that are modular, including themes, activities,
|
|
interface languages, database schemas and course formats. This allows anyone
|
|
to add features to the main codebase or to even distribute them separately.
|
|
More on this below in the next section.<br>
|
|
<br>
|
|
</li>
|
|
<li><strong>It should be able to be used in conjunction with other systems</strong><br>
|
|
<br>
|
|
One thing Moodle does is keep all files for one course within a single,
|
|
normal directory on the server. This would allow a system administrator
|
|
to provide seamless forms of file-level access for each teacher, such as
|
|
Appletalk, SMB, NFS, FTP, WebDAV and so on. The authentication modules allow
|
|
Moodle to use LDAP, IMAP, POP3, NNTP and other databases as sources for
|
|
user information. Otherwise, there is work yet to do. Features planned for
|
|
Moodle in future versions include: import and export of Moodle data using
|
|
XML-based formats (including IMS and SCORM); and increased use of style
|
|
sheets for interface formatting (so that it can be integrated visually into
|
|
other web sites).</li>
|
|
</ol>
|
|
</blockquote>
|
|
<p> </p>
|
|
<h3 class="sectionheading"><a name="contribute" id="contribute"></a>2. How you can contribute</h3>
|
|
<blockquote>
|
|
<p>As mentioned above, Moodle has a number of features that are modular. Even
|
|
if you are not a programmer there are things you can change or help with.</p>
|
|
<p><strong><a name="activities" id="activities"></a>Learning Activities</strong></p>
|
|
<blockquote>
|
|
<p>These are by far the most important modules, and reside in the 'mod' directory.
|
|
There are seven default modules: assignment, choice, forum, journal, quiz,
|
|
resource, and survey. Each module is in a separate subdirectory and consists
|
|
of the following mandatory elements (plus extra scripts unique to each module):</p>
|
|
<ul>
|
|
<li>mod.html: a form to set up or update an instance of this module</li>
|
|
<li>version.php: defines some meta-info and provides upgrading code</li>
|
|
<li>icon.gif: a 16x16 icon for the module</li>
|
|
<li>db/: SQL dumps of all the required db tables and data (for each database
|
|
type) </li>
|
|
<li>index.php: a page to list all instances in a course</li>
|
|
<li>view.php: a page to view a particular instance</li>
|
|
<li>lib.php: any/all functions defined by the module should be in here.
|
|
If the modulename if called widget, then the required functions include:
|
|
<ul>
|
|
<li>widget_add_instance() - code to add a new instance of widget</li>
|
|
<li>widget_update_instance() - code to update an existing instance</li>
|
|
<li>widget_delete_instance() - code to delete an instance</li>
|
|
<li>widget_user_outline() - given an instance, return a summary of a
|
|
user's contribution</li>
|
|
<li>widget_user_complete() - given an instance, print details of a user's
|
|
contribution<br>
|
|
</li>
|
|
<li>To avoid possible conflict, any module functions should be named
|
|
starting with widget_ and any constants you define should start with
|
|
WIDGET_ </li>
|
|
</ul>
|
|
</li>
|
|
<li>Lastly, each module will have some language files that contain strings
|
|
for that module. See below.</li>
|
|
</ul>
|
|
<p>The easiest way to start a new learning activity module is to use the template
|
|
in <strong><a href="http://moodle.org/mod/newmodule_template.zip">mod/newmodule_template.zip</a>.</strong>
|
|
Unzip it and follow the README inside. </p>
|
|
<p>You might also like to post first in the <a href="http://moodle.org/mod/forum/view.php?id=44" target="_top">Activities
|
|
modules forum on Using Moodle</a>.</p>
|
|
<p> </p>
|
|
</blockquote>
|
|
<p> <strong><a name="themes" id="themes"></a>Themes</strong></p>
|
|
<blockquote>
|
|
<p>Themes (or skins) define the look of a site. A number of simple themes
|
|
are provided in the main distribution, but you may want to create your own
|
|
theme with your own colours, logo, styles and graphics. </p>
|
|
<p>Each theme is in a subdirectory of the "theme" directory, and
|
|
contains at least the following files:</p>
|
|
<ul>
|
|
<li><strong>config.php</strong>: defines the theme colours used throughout
|
|
the site</li>
|
|
<li><strong>styles.php</strong>: the style sheet, containing CSS definitions
|
|
for standard HTML elements as well as many Moodle elements.</li>
|
|
<li><strong>header.html</strong>: Included at the top of each page. This
|
|
is what you need to edit to add a logo at the top of pages, for example.</li>
|
|
<li><strong>footer.html</strong>: Included at the bottom of each page.</li>
|
|
</ul>
|
|
<p>To create your own themes for current versions of Moodle:</p>
|
|
<ol>
|
|
<li>Copy one of the existing theme folders to one with a new name. I recommend
|
|
starting with one of the standard themes. </li>
|
|
<li>Edit config.php and insert your own colours. </li>
|
|
<li>Edit styles.php and change your CSS styles. </li>
|
|
<li>Edit header.html and footer.html to add new logos, or change the layout.
|
|
</li>
|
|
</ol>
|
|
<p>Note that all these steps are optional - you can make a radically different
|
|
look to your site simply by editing the colours in config.php</p>
|
|
<p>Note also that Moodle upgrades <em>may</em> break themes slightly, so check
|
|
the release notes carefully if you are using a custom theme.</p>
|
|
<p>In particular, Moodle 2.0 will have a completely new display system, probably
|
|
based on XSL transformations of XML output from Moodle. It is likely that
|
|
the themes for this will be a completely different format, but the advantage
|
|
will be a much higher possible degree of customisation (including moving
|
|
elements around the page).</p>
|
|
<p>More discussion about this in the <a target=_top href="http://moodle.org/mod/forum/view.php?id=46">Themes
|
|
forum on Using Moodle</a>. If you create a nice theme that you think others
|
|
might want to use, please post your zip file on the themes forum!<br>
|
|
</p>
|
|
</blockquote>
|
|
<p> </p>
|
|
<p><strong><a name="languages" id="languages"></a>Languages</strong></p>
|
|
<blockquote>
|
|
<p>Moodle has been designed for internationalisation. Each 'string' or 'page'
|
|
of text that is displayed as part of the interface is drawn from a set of
|
|
language files. Each language is a subdirectory of the directory 'lang'.
|
|
The structure of the lang directory is as follows:</p>
|
|
<p><strong>lang/en</strong> - directory containing all files for one language
|
|
(eg English)</p>
|
|
<ul>
|
|
<li>moodle.php - strings for main interface</li>
|
|
<li>assignment.php - strings for assignment module</li>
|
|
<li>choice.php - strings for choice module</li>
|
|
<li>forum.php - strings for forum module</li>
|
|
<li>journal.php - strings for journal module </li>
|
|
<li>quiz.php - strings for quiz module</li>
|
|
<li>resource.php - strings for resource module</li>
|
|
<li>survey.php - strings for survey module</li>
|
|
<li>.... plus other modules if any.<br>
|
|
<br>
|
|
A string is called from these files using the <strong><em>get_string()</em></strong><em>
|
|
</em>or<em> <strong>print_string()</strong> </em>functions. Each string
|
|
supports variable substitution, to support variable ordering in different
|
|
languages.<em><br>
|
|
<br>
|
|
</em>eg $strdueby = get_string("assignmentdueby", "assignment",
|
|
userdate($date)); <br>
|
|
<br>
|
|
If a string doesn't exist in a particular language, then the equivalent
|
|
in English will automatically be used instead.</li>
|
|
</ul>
|
|
<p><strong>lang/en/help</strong> - contains whole help pages (for popup context-sensitive
|
|
help)</p>
|
|
<blockquote>
|
|
<p>Main help pages are situated here, while help pages specific to each
|
|
module are located in subdirectories with the module's name.</p>
|
|
<p>You can insert a helpbutton in a page with the helpbutton function.</p>
|
|
<p>eg helpbutton("text", "Click here for help about text");</p>
|
|
<p>and for modules:</p>
|
|
<p>helpbutton("forumtypes", "Forum types", "forum");</p>
|
|
</blockquote>
|
|
<p>Note that you can edit languages online, using the administration web tools
|
|
under "Check this language". This makes it easy to not to only
|
|
create new languages but to refine existing ones. If you are starting a
|
|
new language, please contact me, <a target=_top href="http://dougiamas.com/">Martin
|
|
Dougiamas</a>. </p>
|
|
<p>You might also like to post in the <a target=_top href="http://moodle.org/mod/forum/view.php?id=43">Languages
|
|
forum on Using Moodle</a>. </p>
|
|
<p>If you are maintaining a language an ongoing basis, I can give you <a href="?file=cvs.html">CVS
|
|
write access to the Moodle source code</a> so that you can directly maintain
|
|
the files.</p>
|
|
</blockquote>
|
|
<p><br>
|
|
<strong><a name="database" id="database"></a>Database Schemas</strong></p>
|
|
<blockquote>
|
|
<p>Given a working database with defined tables, the intentionally simple
|
|
SQL used in Moodle should work fine with a wide variety of database brands.</p>
|
|
<p>A problem exists with <strong>automatically creating</strong> new tables
|
|
in a database, which is what Moodle tries to do upon initial installation.
|
|
Because every database is very different, there doesn't yet exist any way
|
|
to do this in a platform-independent way. To support this automation in
|
|
each database, schemas can be created that list the required SQL to create
|
|
Moodle tables in a particular database. These are files in <strong>lib/db</strong>
|
|
and inside the <strong>db</strong> subdirectory of each module.</p>
|
|
<p>Currently, only MySQL and PostgreSQL are fully supported in this way (no-one
|
|
wrote the schemas for other brands).</p>
|
|
<p>Moodle 1.2 will use a new method of database-independent XML schemas that
|
|
will make all this unnecessary.</p>
|
|
</blockquote>
|
|
<p> </p>
|
|
<p><strong><a name="courseformats" id="courseformats"></a>Course Formats</strong></p>
|
|
<blockquote>
|
|
<p>Moodle currently supports three different course formats: weekly, topics
|
|
and social. </p>
|
|
<p>These are a little more connected to the rest of the code (and hence, less
|
|
"pluggable") but it is still quite easy to add new ones.</p>
|
|
<p>If you have any ideas for different formats that you need or would like
|
|
to see, get in touch with me and I'll do my absolute best to have them available
|
|
in future releases.</p>
|
|
</blockquote>
|
|
<p> </p>
|
|
<p><strong><a name="doc" id="doc"></a>Documentation and articles</strong></p>
|
|
<blockquote>
|
|
<p>If you feel like writing a tutorial, an article, an academic paper or anything
|
|
else about Moodle, please do! </p>
|
|
<p>Put it on the web and make sure you include links to <a target=_top href="http://moodle.org/">http://moodle.org/</a></p>
|
|
</blockquote>
|
|
<p> </p>
|
|
<p><strong><a name="bugs" id="bugs"></a>Participating in the bug tracker</strong></p>
|
|
<blockquote>
|
|
<p>Finally, I would like to invite you to register on the "bug tracker"
|
|
at <a target=_top href="http://moodle.org/bugs/">http://moodle.org/bugs</a>
|
|
so you can file any bugs that you find and perhaps participate in discussing
|
|
and fixing them. </p>
|
|
<p>"Bugs" not only includes software bugs with current versions
|
|
of Moodle, but also new ideas, feature requests and even constructive criticism
|
|
of existing features. The beauty of open source is that anyone can participate
|
|
in some way and help to create a better product for all of us to enjoy.
|
|
In this project, your input is very welcome!</p>
|
|
</blockquote>
|
|
</blockquote>
|
|
<p> </p>
|
|
<blockquote>
|
|
<blockquote>
|
|
<blockquote>
|
|
<p align="center">Thanks for using Moodle!<br>
|
|
<br>
|
|
<a target=_top href="http://dougiamas.com/">Martin Dougiamas</a>, Lead
|
|
Developer </p>
|
|
</blockquote>
|
|
</blockquote>
|
|
</blockquote>
|
|
<p> </p>
|
|
<p> </p>
|
|
<blockquote>
|
|
<p> </p>
|
|
</blockquote>
|
|
<p align="CENTER"><font size="1"><a href="." target="_top">Moodle Documentation</a></font></p>
|
|
<p align="CENTER"><font size="1">Version: $Id: developer.html,v 1.2 2001/12/09
|
|
10:34:19 martin Exp $</font></p>
|
|
|
|
</body>
|
|
</html> |