Moodle
Views:
Introductory Babble
Latest version: 1.8.2+ (rolled up to 13/08/2007)
Moodle is used as the College Virtual Learning Environment. It's FLOSS available from moodle.org with a six monthly official "roll-up" release cycle. Occasionally an alert will be sent about a security bug, you can either make the fix manually or upgrade to the latest nightly release of the stable branch.
Playing with Beta versions is not recommended with this particular piece of opensource software, often it seems the software is only good enough when you hit a x.x.2 release.
Useful Offsite Links
- Admin FAQ
- Developer Documentation
- Administrator Documentation
- Blocks HowTo
- Themes
- Teacher Documentation
- Filter Administration
- Moodle Themes and Theme Customisation Guides
Hosting
Moodle is installed on phobos. It runs under an Apache2 vhost, with PHP and MySQL, http://learn.varndean.ac.uk/.
Database
The data is stored in a MySQL 5.0 database running on phobos.
- host: phobos.varndean.ac.uk
- user: moodleuser
- pass: *************
- dbname: moodle
- table prefix: mdl_
Authentication
Authentication is against the LDAP server running on the web server, user details are cached in the database so if eDirecotory or LDAP go off for any reason moodle should keep running. If the LDAP server is up authentication will only happen via LDAP, unless you log in as the admin user.
There's a secure apache vhost setup to allow secure logins to take place at https://learn.varndean.ac.uk/login/
Just incase, apache is set to redirect any one accessing the wrong part of either vhost.
There is a hack in the moodle authentication routines to allow moodle to access the user's password in clear text. Initially this has been added to allow a block to display a count of unread emails.
/srv/www/moodle/public/lib/moodlelib.php:
...
if (auth_user_login($username, $password)) { // Successful authentication
if ($user->id) { // User already exists in database
if (empty($user->auth)) { // For some reason auth isn't set yet
set_field('user', 'auth', $auth, 'username', $username);
}
update_internal_user_password($user, $password);
if (!is_internal_auth()) { // update user record from external DB
$user = update_user_record($username);
$user->clearPassword = $password; // KJW: Varndean Hack - keep a copy of the clear text password.
// We need this to hook in to other college systems.
}
} else {
$user = create_user_record($username, $password, $auth);
$user->clearPassword = $password; // KJW: Varndean Hack - keep a copy of the clear text password.
// We need this to hook in to other college systems.
}
...
Directory Structure
- /srv/www/learn/data/ = uploaded files (eg word documents, etc)
- /srv/www/learn/public/ = the moodle logic and presentation files
- /srv/www/learn/nln = the NLN materials, which moodle can access through the "object" module. The symlink is to allow moodle to href files directly eg: http://learn.varndean.ac.uk/nln/maths/blah/something.html with out making users authenticate to the online.varndean.ac.uk vhost)
- /srv/www/moodle/custom-scripts - override default moodle scripts by copying them to this folder and editing them, creating directories to match the ../public folder as neccessary
- /var/lib/mysql-backup/ = nightly backups of the moodle database, kept for one week (mysql-backup-script)
- /etc/apache2/vhosts.d/learn.ssl.conf = secure vhost config
- /etc/apache2/vhosts.d/learn.clear.conf = standard clear text vhost config
- /usr/bin/du = helps to speed up displaying folder contents
- /usr/bin/zip = moodle uses the server's binaries rather than any sllooowww php stuff
- /usr/bin/unzip
- /usr/bin/aspell = Spell checking available in the HTMLArea editor (using en_GB_ise_wo_accents)
- /usr/bin/convert = ImageMagick image manipulation binary
Special config.php Settings
- $CFG->admineditalways = true;
- $CFG->customscripts = '/srv/www/moodle-test/custom-scripts';
Plugins (Modules/Blocks/Filters)
Installing Plugins
These typically come as a zip file which contain everything you need, once unziped:
- Modules are installed in /srv/www/moodle/public/mod/
- Resources go in /srv/www/moodle/public/mod/resource/type
- Quiz Questions go in /srv/www/moodle/public/question/type
- Blocks are installed in /srv/www/moodle/public/blocks/
- Filters are installed in /srv/www/moodle/public/filter/
Language Files
Each plugin should come with some language files which need to be copied to a central location.
/srv/www/moodle/public/lang/en_utf8 holds the main language file for each module/block/whatever. There are also two sub directories called help and docs - no prizes for guessing what they're for ;-)
Installed Plugins
Several third-party modules are in use. These are available from the moodle website. Copies are saved in /srv/www/moodle/3mods/ just incase they disappear off of moodle.org for any reason
- Object = allows navigation of NLN materials (but no tracking) (The built in IMS CP resource doesn't scale for use with the amount of NLN materials we have)
- filter_jmol = allows more convenient use of jmol content (something to display moleculs which needs a browser plugin) - --note:-- This one has an accompanying reference_jmol
- Learning Resources Block - Centrally controlled list of links, teachers can choose whether or not to add the block (although this could be overridden) and also can choose which of the links are displayed in their course.
- Search Glossaries Block
- Search Docs Block = quick and easy way for teachers to search docs.moodle.org from our site (hacked: $this->config->teacheronly set to true before it gets tested, thereby forcing every instance of this module to only be seen by teachers)
- Teacher Plan Module = Used to create teaching plans, a list of objectives which can be marked off. (source code hosted on sf.net)
- Syntax Highlighting Filter - Uses Geshi to syntax highlight loads of languages, need to add a custom style sheet to templates (tip: load ./filter/geshi/styles.php in browser)
- JME (Java Molecule Editor) quiz question type - plus custom help file using the plugin's description from moodle.org
- Resource JMOL - display 3d jmol molecule animations in moodle (requires some hacks to moodle after updating (search jmol in mod/resource/lib.php and lang/en_utf8/resource.php)
- Teacherplan - Block and Module allow teachers to create lesson plans, had to hack objectives.php to stop some javascript fixing popup window size, and edited lang file :%s/Benchmark/Objective/g and :%s/\ benchmark/\ objective/g in vi
- HSU's course menu block
- Unread Emails - Inhouse custom block to show the number of unread emails a user has.
- Printing Credit - Inhouse custom block to show the remaining print credit a student has.
Dirty Hammer Hack
The hammer info (news, files, etc) on the moodle home page is there by way of a dirty hack. The Student Intranet and Hammer are going, as they die off this will slowly need to be more fully integrated in to moodle. Making use of the moodle data base add using moodle to add content would be the way forward, but displaying the content on the home page will always require a dirty hack.
Add the code between the '// KJW HACK' and '// END KJW HACK' comments to the index.php page in the moodle site root:
if ($editing) {
print_section_add_menus($SITE, $section->section, $modnames);
}
print_simple_box_end();
}
// KJW HACK: Hammer news, events and files for moodle
$hammer = mysql_connect('localhost', 'staffhammer', '***************');
if ($hammer) {
mysql_select_db('hammer', $hammer);
$newsitems = mysql_query("SELECT DATE_FORMAT(postdate, '%d/%m/%Y') AS date, newsid, title FROM student_news ORDER BY postdate DESC LIMIT 5", $hammer);
$events = mysql_query("SELECT DATE_FORMAT(eventdate, '%d/%m/%Y) AS date, title, eventid FROM student_events WHERE eventdate >= NOW() ORDER BY eventdate ASC LIMIT 5", $hammer);
$clubs = mysql_query("SELECT DATE_FORMAT(eventdate, '%d/%m/%Y') AS date, title, eventid FORM club_events WHERE eventdate >= NOW() ORDER BY eventdate ASC LIMIT 5", $hammer);
$files = mysql_query("SELECT date AS datesort, DATE_FORMAT(date, '%d/%m/%Y') AS date, filename, file_list.title, directory, url FROM file_list, file_cat WHERE file_list.catid = file_cat.catid AND file_cat.student = 1 ORDER BY datesort DESC LIMIT 5", $hammer);
if ($newsitems || $events || $clubs || $files) {
print_simple_box_start('center', '100%', '', 5, 'sitetopic');
echo '<div class="hammer"><h2>Student News</h2>';
if ($newsitems && $newsitem = mysql_fetch_assoc($newsitems)) {
echo '<ul>';
do {
echo '<li><a href="https://online.varndean.ac.uk/students/information/news/viewnews.php?newsid='.htmlentities($newsitem['newsid']).'" title="'.htmlentities($newsitem['title']).' ('.htmlentities($newsitem['date']).')">'.htmlentities($newsitem['title']).'</a> '.htmlentities($newsitem['date']).'</li>';
}
while ($newsitem = mysql_fetch_assoc($newsitems));
echo '</ul><p><a href="https://online.varndean.ac.uk/students/information/news/">View full news listing</a></p>';
}
else {
echo '<p>There are no News Items available</p>';
}
echo '</div>';
echo '<div class="hammer"><h2>Student Events</h2>';
if ($events && $event = mysql_fetch_assoc($events)) {
echo '<ul>';
do {
echo '<li><a href="https://online.varndean.ac.uk/students/information/events/viewgeneral.php?eventid='.htmlentities($event['eventid']).'" title="'.htmlentities($event['title']).' ('.htmlentities($event['date']).')">'.htmlentities($event['title']).'</a> '.htmlentities($event['date']).'</li>';
}
while ($event = mysql_fetch_assoc($events));
echo '</ul>';
}
else {
echo '<p>There are no upcoming Events</p>';
}
echo '<h2>Student Clubs and Societies</h2>';
if ($clubs && $club = mysql_fetch_assoc($clubs)) {
echo '<ul>';
do {
echo '<li><a href="https://online.varndean.ac.uk/students/information/events/viewsociety.php?eventid='.htmlentities($club['clubid']).'" title="'.htmlentities($club['title']).' ('.htmlentities($club['date']).')">'.htmlentities($club['title']).'</a> '.htmlentities($club['date']).'</li>';
}
while ($club = mysql_fetch_assoc($clubs));
echo '</ul>';
}
else {
echo '<p>There are no upcoming Club or Society Events</p>';
}
echo '<p><a href="https://online.varndean.ac.uk/students/information/events/">View full events and clubs listings</a></p></div>';
echo '<div class="hammer"><h2>News Letters</h2>';
if ($files && $file = mysql_fetch_assoc($files)) {
echo '<ul>';
do {
echo '<li><a href="https://online.varndean.ac.uk'.htmlentities($file['url']).htmlentities($file['filename']).'" title="'.htmlentities($file['title']).' ('.htmlentities($file['date']).')">'.htmlentities($file['title']).'</a> '.htmlentities($file['date']).'</li>';
}
while ($file = mysql_fetch_assoc($files));
echo '</ul><p><a href="https://online.varndean.ac.uk/students/information/files/">View full News Letter listings</a></p>';
}
else {
}
echo '</div>';
print_simple_box_end();
}
else {
error_log('Moodle Hammer Hack: Unable to retreive any records from the database!', 0);
}
}
else {
error_log('Moodle Hammer Hack: Unable to connect to the hammer database', 0);
}
// END KJW HACK: Hammer news, events and files for moodle
}
if (isloggedin() and !isguest() and isset($CFG->frontpageloggedin)) {
$frontpagelayout = $CFG->frontpageloggedin;
} else {
$frontpagelayout = $CFG->frontpage;
}
I would provide a line number for the insert, but as the moodle dev's up date the page it will change. It shouldn't take too long to figure out where in the page to make the insertion, and some of the stock code is included as a guide.
Some style information is needed. Create a hammer.css in the theme folder (currently /theme/formal_white/):
div.hammer {float:left;clear:none;display:block;width:33%;margin:1px}
div.hammer ul {margin:0 !important;margin:0 0 0 1.2em}
Then add 'hammer' to the styles sheets array in theme's config.php file (currently /theme/formal_white/config.php)
Cron
Moodle needs a hit on http://learn.varndean.ac.uk/admin/cron.php in order to fire off summary emails, do house keeping, etc. Append the following line to /etc/crontab:
*/5 * * * * nobody wget -q -O /dev/null http://learn.varndean.ac.uk/admin/cron.php
Administration Settings
Some stuff should be pretty obvious, eg time zones, or is covered in other sections of this doc, eg, authentication and file locations. Some stuff is just left with the default settings, although these have been listed if they might have a profound effect on the way the site works.
Configuration
Filters
- Algebra Notation: Shown
- TeX Notation: Shown
- Multimedia Plugins: Shown
- Glossary Auto-linking: Shown
- Geshi: Shown
- Database Auto-linking: Hidden
- Resource Names Auto-linking: Hidden
- Wiki Page Auto-linking show: Hidden
- Activity Names Auto-linking: Hidden
- Word Censorship: Hidden
- Email Protection: Hidden
- Jmol: Hidden
- Multi-Language Content: Hidden
- Tidy: Hidden
- Cache: 1 Minute
- Uploaded Uploaded Files: All Files
- Filter Match One Per Page: No
- Filter match once per text: No
- Filter All Text: No
Modules
- assignment: Shown
- assignment_maxbytes default: 1MB
- Chat: Shown
- chat_method: Normal
- chat_refresh_userlist: 15
- chat_old_ping: 45
- chat_refresh_room: 7
- chat_normal_updatemode: KeepAlive
- Choice: Shown
- Database: Shown
- Feedback: Shown
- Forum: Shown
- Glossary: Shown
- Hot Potatoes Quiz: Shown
- Journal: Shown
- LAMS: Hidden
- Label: Shown
- Lesson: Shown
- Object: Shown
- object_dirroot: ../../nln
- object_webroot: /nln/
- Quiz: Shown
- Show quiz in a "secure" window: Advanced
- Require password: Advanced
- Require network address: Advanced
- Resource: Shown
- SCORM/AICC: Shown
- Scheduler: Shown
- Survey: Shown
- Teacher Plan: Hidden
- Wiki: Shown
- Workshop: Shown
Blocks
- Activities: Shown
- Administration: Shown
- Blog Menu: Hidden
- Blog Tags: Hidden
- Calendar: Shown
- Course/Site Description: Shown
- Courses: Shown
- Feedback: Shown
- HTML: Shown
- Latest News: Shown
- Learning Resources: Shown
- Loan calculator: Shown
- Login: Shown
- Main Menu: Shown
- Messages: Shown
- Online Users: Hidden
- People: Shown
- Quiz Results: Shown
- Random Glossary Entry: Shown
- Recent Activity: Shown
- Remote RSS Feeds: Shown
- Search Documentation: Shown
- Search Forums: Shown
- Search Glossaries: Shown
- Section Links: Hidden
- Social Activities: Shown
- Teacher Plan Search: Hidden
- Upcoming Events: Shown
Variables
Interface
- doctonewwindow: Yes
- allowuserthemes: No
- allowcoursethemes: No
Security
- loginhttps: Yes
- runclamonupload: Yes
- clamfailureonupload: Treat files like Viruses
Operating System
- gdversion: Version 2 is installed
- dbsessions: No
- sessiontimeout: 60 mins
- slasharguments: file.php/1/...
Maintenance
- longtimenosee: 365 days
- loglifetime: 365 days
- smtphosts: mail.varndean.ac.uk
- smtpuser: (blank)
Permissions
- teacherassignteachers: Yes
- allowunenroll: No
- allusersaresitestudents: Yes
- showsiteparticipantslist: Teachers
- forcelogin: No
- forceloginforprofiles: No
- opentogoogle: No
- maxbytes: 5MB
- messaging: Yes
- allowobjectembed: No
- restrictmodulesfor: No Courses
Course requests
- enablecourserequests: No
Miscellaneous
- maxeditingtime: 30mins
- mymoodleredirect: No
Statistics
- enablestats: Yes
Miscillaneous
Sticky Blocks
- My pages
- Course pages
- Course Menu
- Search Documentation
Uploading large zipped courses to Moodle
- Sign on to Phobos using WinSCP and Phobos root
- locate srv/www/learn/data/251. This is a course called Uploads and Conversions which can be used as a temporary place to store zipped courses before moving them to their correct location
- ftp zipped file to this location on Phobos server
- Through Moodle use restore icon for course and locate zipped file
- Follow on screen instructions
