18

Click here to load reader

Big Bad Moodle Guide

Embed Size (px)

Citation preview

Page 1: Big Bad Moodle Guide

Big Bad Moodle Guide By Mike Tupker

[email protected] Version 1

Introduction. I’m a Desktop Technician/Network Administrator at Mount Mercy College in Cedar Rapids Iowa. This document is a how to for the popular open source course management system Moodle. Since most of my experience with moodle has been from a MS Windows perspective, that’s what I’ll focus on in this document. (Once Moodle is running there is almost no difference in configuring it when its running on Windows, Linux, or a Mac.) Moodle is a very widely used CMS system. It contains most of the features of any other closed source CMS which usually cost big $$$. For a more detailed overview please consult the Moodle.org web site. This document is free for distribution. Feel free to do what you would like with it. I would also like to thank the Moodle team and everyone who posts to the Moodle forums who has helped to make Moodle such a great piece of software. Requirements. OS: Linux, windows, OS X Servers: MySQL (preferred), PHP, Apache, IIS (if you can get php working in IIS) Not sure about it? Try it out the easy way. There is a wonderful package at http://goohio.com/moodle/ that will install everything you need to get a test system up and running in no time. This Moodle package comes with the Moodle CMS and easyPHP. For those of you who don’t know what easyPHP is, it is a package that installs preconfigured versions of Apache, MySQL, and PHP. Unfortunately, the status page in easyPHP is written in French. It shouldn’t affect anything though. Personally, I prefere WAMP avalible at http://www.wampserver.com/en/index.php. Setup.

Page 2: Big Bad Moodle Guide

WAMPserver does not come with an installer that also installs Moodle. To install Moodle, download Moodle from Moodle.org, uncompress it, and drop it in c:\wamp\www.

You should now be able to browse to the URL http://localhost. On the lower part of the page click on the link for the directory you just created with the Moodle distribution inside.

You will then be brought to the moodle setup page.

Click next.

Page 3: Big Bad Moodle Guide

Check to see if there are any PHP setting that didn’t pass. If some didn’t pass edit you php.ini file looking for this section. ;Windows Extensions ;Note that ODBC support is built in, so no dll is needed for it. ; ;extension=php_bz2.dll ;extension=php_cpdf.dll ;extension=php_curl.dll ;extension=php_dba.dll ;extension=php_dbase.dll ;extension=php_dbx.dll ;extension=php_exif.dll ;extension=php_fdf.dll ;extension=php_filepro.dll extension=php_gd2.dll extension=php_gettext.dll ;extension=php_iconv.dll ;extension=php_ifx.dll ;extension=php_iisfunc.dll extension=php_imap.dll ;extension=php_interbase.dll extension=php_ldap.dll extension=php_mbstring.dll

Page 4: Big Bad Moodle Guide

;extension=php_mcrypt.dll ;extension=php_mhash.dll extension=php_mime_magic.dll ;extension=php_ming.dll ;extension=php_mssql.dll ;extension=php_msql.dll extension=php_mysql.dll extension=php_mysqli.dll ;extension=php_oci8.dll extension=php_openssl.dll ;extension=php_oracle.dll ;extension=php_pdf.dll ;extension=php_pgsql.dll ;extension=php_shmop.dll ;extension=php_snmp.dll ;extension=php_sockets.dll ;extension=php_sybase_ct.dll ;extension=php_tidy.dll ;extension=php_w32api.dll ;extension=php_xmlrpc.dll ;extension=php_xsl.dll ;extension=php_yaz.dll ;extension=php_zip.dll Notice the line that says “extension=php_gd2.dll”. To active this extension simply remove the preceding semicolon and restart Apache. Do this for any extensions you will need. (NOTE: If you are planning to use LDAP or Microsoft Active Directory for authentication or enrolment you must active the ldap extension.) (ADDISSIONAL NOTE: You may have to copy libeay32.dll and ssleay32.dll to your windows\system32 directory.) The check on the page called “memory limit,” should be changed for production servers. To change the limit go to this section in the php.ini file: ;;;;;;;;;;;;;;;;;;; ; Resource Limits ; ;;;;;;;;;;;;;;;;;;; ….. memory_limit = 8M ; Maximum amount of memory a script may consume (8MB) …. Change the memory limit to something large enough to meet your school or corporation’s needs. 256 seems to work well of us. Make sure not to set this to a value larger that the amount of physical memory you have on your machine.

Page 5: Big Bad Moodle Guide

Click next when all the check are ok.

The only thing that you should worry about here is the “web address.” By default it is set to http://localhost/moodle. The localhost portion should be changed to the DNS name of the server that moodle resides on. Otherwise anyone who try’s to connect to the moodle server will get the address localhost in any urls they click on within the site. Click next. Before you proceed, the database must be created. Left click on the WAMP icon in the system tray and select phpmyadmin

Page 6: Big Bad Moodle Guide

In the create new database field type in “moodle” and click the create button. Then close the window.

Page 7: Big Bad Moodle Guide

This page is where your database settings are entered. For simplicity, we will use the defaults that WAMP uses. These should be changed if you are setting up production server. Type: mysql Host Server: localhost Database: moodle User: root Password: (leave blank) Table Prefix: mdl_ Click next.

Page 8: Big Bad Moodle Guide

If you see this click continue.

Click yes to the license agreement. Click Continue until you get to the screen titled “Variables.” Change any settings you need to. These are going to be different for everyone so I’m not going to go into them here. Each setting has a very good description next to it explaining what the setting does. When you are finished, go to the bottom of the page and click save. (NOTE: The Variables can be changed later) Click continue a few more times until you get to the page titled “Site Settings.”

Page 9: Big Bad Moodle Guide

Enter in what you would like here. This can also be changed later. Click save changes. The next page is VERY important.

Page 10: Big Bad Moodle Guide

Write the login and password down and don’t loose it, otherwise you could be locked out of your site. When you are done click update profile. There your Moodle system is now setup.

Page 11: Big Bad Moodle Guide

LDAP. Once you get an understanding of LDAP, this shouldn’t be too hard to setup. Our system authenticates to MS Active Directory, which is what I will show you how to setup here. From the main moodle page, click on the users link to the left.

Page 12: Big Bad Moodle Guide

Click on Authentication. Next select ldap from the pull down menu at the top of the screen.

Here are the settings we have used.

LDAP server settings

ldap_host_url: ldap://10.1.1.111 ldap_version: 3

Bind settings

ldap_preventpassindb: yes ldap_bind_dn: CN=ldapuser,OU=users,DC=mtmercy,DC=edu ldap_bind_pw: ldappassword (NOTE: the ldap_bind variables should be for an account that no one uses in active directory. Active Directory does not allow anonymous lookups so this account is needed.)

User lookup settings

ldap_user_type: MS ActiveDirecory ldap_contexts: OU=it_staff,DC=mtmercy,DC=edu;OU=faculty,DC=mtmercy,DC=edu;OU=nursing,DC=mtmercy,DC=edu;OU=Student Accounts,DC=mtmercy,DC=edu;OU=library,DC=mtmercy,DC=edu;OU=administrative Software,DC=mtmercy,DC=edu (NOTE: These are the organizational unit locations where the user accounts are located that you would like to be able to login to your moodle system. ldap_search_sub: yes ldap_opt_deref: no ldap_user_attribute: sAMAccountName (NOTE: This is the username attribute in Active Directory. For example, the user Joe Smith has the username jsmith. Jsmith is the sAMAccountName.) ldap_memberattribute: memberOf (NOTE: This field contains group memberships.) ldap_objectclass: (leave blank)

Force change password

Force change password: No

Page 13: Big Bad Moodle Guide

Use standard Change Password Page: No

LDAP password expiration settings.

ldap_expiration: No ldap_expiration_warning: 10 ldap_exprireattr: (leave blank) ldap_gracelogins: No ldap_graceattr: (leave blank)

Enable user creation

ldap_create_context: (leave blank) Course creators ldap_creators: (NOTE: This field works the same as the “ldap_contexts” field and allows for multiple contexts.)

Data mapping (NOTE: I will go over this more in the section on importing users into Active Directory, but for now, these are the fields that I use.) First name: givenname Surname: sn Email address: mail ID number: EmployeeID Each of the Data Mapping fields has options to: Update local Update external Lock value Update local will affect the value stored in the local MySQL database. Update external will update the external database where the data is being pulled from. (I have not been able to get this to work with Active Direcory. If you get it to work please let me know.) You can also use lock value to keep people from changing the data in the fields. This is very useful for the ID Number field, as it is used for enrollment using an external source. Instructions: (This is a window that appears next to the login information. If can contain anything you want.) Change password URL: (If you selected no for the option to use the standard password change screen. Then this field is used. I have mine set to redirect to the iisadmpwd password change web page. Do a google search if you don’t know what this is.)

Page 14: Big Bad Moodle Guide

Guest login button: Hide Enable user creation: No Alternate Login URL: (leave blank) Click save changes. Creating a lot of users in Active Directory. I’m not going to go into much detail on this. None of our students had user accounts in active directory, so we had to create them. There are many ways to do this but here is a command that will parse a CSV file containing login information for users. The file contains information formatted like this: Firstname,lastname,studentnumebr,studentID For us the student number controls enrolment. StudentID is the number on the student’s id card. StudentID will be the students starting password. Now for the command. for /F "eol=; tokens=1,2,3,4 delims=," %a in (ldapusers.csv) do dsadd user "cn=%b %a,ou=Testing,dc=mtmercy,dc=edu" -samid %a%b -fn %a -ln %b -display "%b, %a" -pwd %d -email %a%[email protected] -disabled no -empid %c A few notes: Dsadd = AD attirbute Fn = firstname Ln = sn Email = mail Samid = sAMAccountName Empid = EmployeeID Display = DisplayName The file that contains the users and id numbers is ldapusers.csv.

If you are familiar with DOS commands this might look familiar. Type dsadd in the command prompt for information on what this command can do.

The dsadd tool comes with the Microsoft Windows Server 2003 Resource Kit which can be downloaded from Microsoft. Enrolment using a flat file.

Page 15: Big Bad Moodle Guide

Flat files are by far the easiest way to do enrolment in moodle. We are pulling our enrolment data out of a MSSQL database using an MS Access connector and creating a table which gets exported to a CSV file. That CSV file is then imported every 5 minutes into moodle using Moodlecron. Moodlecron is a necessity. GET MOODLECRON HERE! -> http://download.moodle.org/modules/integrations.php Moodle Cron for Windows Comma separated file assumed to have four or six fields per line: operation, role, idnumber(user), idnumber(course) [, starttime, endtime] where: operation = add | del role = student | teacher | teacheredit idnumber(user) = idnumber in the user table NB not id idnumber(course) = idnumber in the course table NB not id starttime = start time (in seconds since epoch) - optional endtime = end time (in seconds since epoch) - optional In this case add is the operation (can be del). Student is the type of enrolment (can be teacheredit or teacher). 5 is the studentID. And CF101 is the course number.

Page 16: Big Bad Moodle Guide

enrol_flatfilelocation: d:\CoursesEnrollment.csv enrol_mailstudents: will mail students when they are added to a course enrol_mailteachers: will mail teachers when they are added to a course enrol_mailadmins: I think it will mail admins when enrolments happen. enrol_allowinternal: Checking this box will allow students to enroll themselves in classes. Should leave this blank if your registrar has a process for this already. Moodle Cron. If you have used Linux then you probably know what this is. It runs a php script at regular intervals much like Windows scheduled tasks. I set it to run every 5 minutes. There are several moodle php scripts that can run using moodlecron, but the one you should worry about is http://localhost/admin/cron.php. It does a bunch of things including sending out notification emails and processing the enrolment file. You can go to the above address to see yours in action or there is a picture below.

Page 17: Big Bad Moodle Guide

This page actually goes on for a while. Moodle Hacks. Change the course settings page so teachers can’t change the course ID number. Open the course\edit.html file and change: <tr valign="top"> <td align="right"><?php print_string("idnumber") ?>:</td> <td><input type="text" name="idnumber" maxlength="100" size="10" value="<?php p($form->idnumber) ?>" alt="><?php print_string("idnumber") ?>" />

Page 18: Big Bad Moodle Guide

<?php helpbutton("courseidnumber", get_string("idnumber")) ?> <?php if (isset($err["idnumber"])) formerr($err["idnumber"]); ?> </td> </tr> To: <tr valign="top"> <td align="right"><?php print_string("idnumber") ?>:</td> <?php if( isadmin()){ echo "<td><input type=\"text\" name=\"idnumber\" maxlength=\"100\" size=\"10\" value=\"".$form->idnumber."\" alt=\"".print_string("idnumber")."\" />"; } else { echo "<td><input type=\"hidden\" name=\"idnumber\" value=\"".$form->idnumber."\">".$form->idnumber; } ?> <?php helpbutton("courseidnumber", get_string("idnumber")) ?> <?php if (isset($err["idnumber"])) formerr($err["idnumber"]); ?> </td> </tr> Modules on http://linuxbox.com. The gradebook and mail enhancements are very nice. To install the gradebook uncompress the download and drop the files into the \grade directory. You might want to backup the directory first in case you don’t like the changes. To install the mail module uncompress the download, create a directory in \blocks for the email enhancement, and place the downloaded files there. Next log into moodle as an administrator and go to the admin menu. You should get a message saying the module has been installed. It should now be available on the add block pull down in edit mode. There are some other good addons at http://download.moodle.org/modules/.