Moodle Developer

Posted in Moodle on March 3rd, 2010 by admin

Moodle Developer Workshop

Inleiding

Moodle is voor veel van onze klanten aantrekkelijk omdat het de mogelijkheid biedt om functionaliteit toe te voegen met behulp van plugins.  Moodle is beschikbaar onder de GPL, een licentie die het mogelijk maakt uitbreidingen (plugins) en aanpassingen voor Moodle te ontwikkelen. Plugins zijn een verzameling van toevoegingen aan Moodle waarbij de originele Moodle code niet aangepast hoeft  te worden. Het voordeel van deze manier van werken is dat Moodle gemakkelijk is te updaten naar een nieuwe versie. De belangrijkste plugin types voor Moodle zijn:

  • Blocks
  • Activity modules
  • Authentication plugins
  • Enrolment plugins
  • Course reports

Bij Stoas wordt een onderscheid gemaakt tussen grote en kleine projecten. De grote projecten worden langzamerhand steeds gestructureerder. Er wordt bijvoorbeeld steeds meer met een ontwikkel, test, acceptatie, productie (OTAP) omgeving gewerkt. De test en productie omgevingen zijn daarbij beschikbaar voor de klant. We hebben goede ervaringen met communicatie tools zoals Basecamp en Google docs. Hiermee worden projecten bewaakt en kunnen alle betrokken informatie met betrekking tot een project uitwisselen.

Kleine projecten komen veel meer voor. Bij de opstart van Moodle projecten en gedurende het gebruik van Moodle wordt nieuwe functionaliteit voor Moodle gevraagd die met behulp van een eigen plugin kan worden gerealiseerd. Voorbeelden hiervan zijn een Google Maps weergave, een KML export voor Google Earth en rapportages van Scorm content. Stoas streeft ernaar om de aanpassingen voor klanten zo generiek mogelijk te houden, zo kan het werk dat is uitgevoerd en betaald  teruggegeven worden aan de Moodle community. In deze workshop ga ik in op een nieuw Block voor Moodle dat nu in ontwikkeling is bij Stoas.

Tot nu toe zijn de meeste aanpassing voor onze klanten erg specifiek maatwerk geweest dat moeilijk voor andere klanten inzetbaar is. Maar gaandeweg willen wij een steeds activere rol in de Moodle community gaan spelen. Ons klanten bestand geeft Stoas een belangrijke positie in het Moodle Partner netwerk. Maar wat ook belangrijk is, is de contributie aan Moodle zelf. Door onze lopende projecten gedegen uit te voeren en terug te geven aan de Moodle community worden Moodle, u en wij geholpen. Uiteindelijk is alles ten bate van het product Moodle.

In deze workshop wil ik niet ingaan op coding guidelines of andere richtlijnen vanuit de Moodle community. Het gaat erom een beeld te geven van de mogelijkheden om een eigen Moodle plugin te maken. Voordat het daadwerkelijke werk begint moet er minstens een globaal idee zijn over de wens van de klant.

Over het ontwikkelen van een Moodle plugin

Een van onze klanten heeft mij een paar weken geleden gevraagd iets te ontwikkelen waarmee cursisten kunnen zien binnen hoeveel  dagen de inschrijving voor een cursus is verlopen. Deze klant maakt gebruik van een Moodle omgeving waarbij cursisten een beperkte cursusduur hebben. Na een aantal dagen wordt de cursist uit de cursus uitgeschreven.  Omdat het om een kleine functionaliteit gaat willen we hier geen uitgebreide project management, OTAP,  communicatie tools en versie beheer gebruiken. In dit geval heb ik aangegeven maximaal 6 uur bezig te zijn met een dergelijke functionaliteit. Het ontwikkelen van een eenvoudige plugin is dus relatief goedkoop!

In dit voorbeeld gebruik ik het afteller block van Mat Cannings voor Moodle.  De basis voor deze code heb ik gevonden in de Moodle community.

countdownImage

zie: http://moodle.org/mod/data/view.php?d=13&rid=718

Een van de methoden om te bepalen of dit een geschikte block is,  is het lezen van de reacties van de gebruikers.
http://moodle.org/mod/forum/discuss.php?d=66217#298137

Ik kan in dit forum in ieder geval zien dat er nog activiteit bestaat. Ga ik wat verder lezen dan vind ik reacties als:

Outstanding block.. very nice….’
I installed the Countdown Block on Moodle 1.9.5+ and it works properly.’

De schrijver Mat Cannings is zeer actief in de Moodle community en reageert op verzoeken van gebruikers.  Dit is een goede indicatie dat ik bruikbaar bron materiaal heb.

Na dit onderzoek is het vervolgens tijd om zelf aan het werk te gaan. Als eerste ben ik gaan kijken in hoeverre deze module aan de wensen voldoet, en in hoeverre het aan te passen is.

Het is mogelijk dit soort plugins van de grond af aan op te bouwen met behulp van de Moodle developer documentatie. Op http://docs.moodle.org/en/Development:Blocks staat uitgebreide documentatie voor het ontwikkelen van een nieuw block.

Ik heb de plugin van Mat Cannings, het  counddown block,  geinstalleerd in mijn test omgeving en gekeken wat het ongeveer doet. Het voldoet nog lang niet aan de eisen maar is prima bruikbaar. Zie hiervoor ook de screenshots in onderstaande galerij.

Vervolgens maak ik een simpel ontwerp schema met behulp van Meindmeister.

moodle block10

Dit schema kan vervolgens worden omgezet in een plugin.  Voor elk van bovenstaande onderdelen is documentatie beschikbaar. Hiervoor maak ik gebruik van http://xref.moodle.org. Dit is geen ideaal systeem om in te zoeken, maar het bevat alle documentatie die in de Moodle code te vinden is.

De functies die ik in dit voorbeeld gebruik zijn:

  • is_siteadmin
  • groups_get_all_groups($COURSE->id)
  • groups_get_members($coursegroup->id)
  • $usersdate = get_record_sql($SQL);
  • $SQL = “SELECT mra.timemodified FROM {$CFG->prefix}role_assignments AS mra WHERE mra.contextid = $context->id AND mra.userid = $groupmember->id”;
  • $usersdate = get_record_sql($SQL);

Zie hieronder de stappen in dit ontwikkelings proces.

Presentatie materiaal voor deze workshop

Tags: , ,

Moodle projects

Posted in Moodle on March 31st, 2010 by admin

Display a user location map in Google earth

This can be pre-viewed here. I have created a map based on the geoip location of the ip address value in the ‘lastlogin’ field in the mdl_user database.
I have also created a KML file that can be used in Google Earth. This shows the location of the Moodle user that has performed some activity in Moodle. It gets its information from the mld_log table.

Search block for searching both wikis and databases all in one

I am creating a block for Moodle that can search within the Moodle activity Wiki and the Moodle database activity. Standard Moodle installations cannot search these at once. The activity’s (private) search functions have to be used to achieve that

Countdown timer for enrolment length in course

When a student is enrolled in a course a block is shown that shows the number of day untill the enrolment is ended. This block can be configured to re-enrol the student into the course with another role. By re-enrolling a student into a custom role the student can still access the forum but can no longer perform a test/quiz whatever.

Stalker block to show links to social networks like flickr, facebook etc.

A simple block that shows links to social networks. This makes you Moodle look very Web 2.0 like.

Special enrollement plugin.

This project will enable course administrators to enroll users using a schedule system using an advanced calendar system.

Ajax-Chat Single Sign on.

An Single Sign on system to the fabulous Ajax Chat system

Exam subscription activity

Yammer Single Sign on for Moodle

Yammer is the twitter system for close networks. It allows users to communicate very well. I would like to create a Single Sign On using Moodle user accounts. Yammer can also be installed as a desktop tool, iphone app etc.

Integrated ‘intranet’ page using Elgg, Mahara, Drupal, Wikimedia

A single intranet page that provides learning, social networks, content management, easy content generation.

Moodle PHPbb3 integration

I have created a SSO module for Moodle to phpBB3. I am still working on the permissions for Moodle v.s. phpBB3 users.

Moodle activity in Google Earth

Posted in Moodle on December 7th, 2009 by admin

Today I created a script that show where the most recent activity in Moodle originated. The results can be viewed using the Google Earth application

Click here to see a demo (user demo, pass demo)

It was a lot of fun developing this functionality. I started creating a google map which shows the geographical locations of all active users in Moodle. Moodle stores ip information on all users. This info can easily be used to create a map using the google maps api.

For example this map

geoip

Google map showing the Geoip location of Users in Moodle

After creating this map I created a php script that generates a kml file that shows recent activity in the Google Earth application. I will add an example soon.

How this thing is set up:

1. You can download a KML file from Moodle. This is a static file

2. Open the KML file in Moodle

3. The KML file holds a link to a php page in Moodle.

4. The php page generates a XML file with recent ip info from the moodle_logs table in your Moodle database

5. Google earth refreshes the php page from Moodle every 30 seconds or so. If a new ip is found Google earth zooms out and then focuses on the new location on our planet.

google earth

Screenshot from Google earth showing the last Geoip info for a user. You can also see my great skills as a designer trying to protect our clients privacy

Of course my Idea is open source. If you would like more info let me know. I’ll be nice to get some feedback on this.

Tags: ,

Presentation Mdl Dev 2

Posted in Moodle, Uncategorized on May 27th, 2010 by admin

Whatimpact does Moodle 2 have on system admins, developer and designers? In this presentation I show my learning process for Moodle 2.
I have researched how to update from Moodle 1.9 to 2.0. I have ivestigated what knowledge is needed to upgrade your themes and plugins.

Moodle consultant session for Moodle Partner

Posted in Moodle on April 21st, 2010 by admin
Stoas & CV&A are organizing a Partners meeting at consultant level (tech and learning) in Barcelona next 7th of may.

What started as an idea for a Moodle trainee ship has grown into one day Moodle consultant session . For this day we have created a program that is all about exchanging knowledge on our Moodle related services. We would like this to be an open session and all Moodle partners are invited to participate. We want to take the Moodle partner communication and collaboration one step further than the excellent partner forum.

This session is focussed on collaboration and knowledge exchange on a consultancy level. It targets practical solutions for customer related issues and help us improve our knowledge of Moodle. Another interesting topic is exchaning ideas on best practices on communicating with customers, marketing, sales, management and the Moodle community.

Agenda for Moodle Partners Consultant Meeting:
9:00-10:00 Presentation of Partners. Each Partner will present his company, his services/projects and how they work.

Topics: How projects are managed, Who is involved, Customer visits, How Moodle development for plugins is planned, iterative/agile v.s. Waterfall, Plugin / course maintenance, How It-Learning departments work together, failures & success stories

11:00 -13:00 IT Workshop.

Topics: Moodle hosting techniques, How to develop plugins / Development of large and small projects, Moodle performance and stresstesting, exchange techniques, Backup and security techniques, Update strategy, How to make sure our customers stay involved, Guidelines of working together with MKT-Sales & Consultants, Moodle marketing tactics

11:00 -13:00 Learning Workshop.

Topics: Focus on Moodle functionality, How do we help people to understand how Moodle works, Strategic implementations issues, How to switch from other platforms to Moodle, SCORM v.s. Moodle content, Usable courses, How to make sure our customers stay involved, Guidelines of working together with MKT-Sales & Consultants, Moodle marketing tactics

15:30 -17:00 Moodle 2.0 Strategy Ideas (IT & Learning).

Topics: How do we migrate our clients, Wat’s new/ What’s hot, how is this related with MKT, the value of the new features., Collaboration among MP

Moodle activity in Google Earth

Posted in Moodle on April 1st, 2010 by admin

Today I created a nice script that shows on Google Earth where the last user activity was. It was very simple to create and a lot of fun developing.  Before I created this little add on I was working on a tool to show all moodle users on a google map using the moodle api and php-geoip.

The clien

With this little tool you can visualize the user activity in Moodle.

Moodle Security Patch

Posted in Moodle on December 7th, 2009 by admin

After the discussion on password security I have created a little patch that adds extra encryption to the Moodle passwords.

This patch requires for php-mcrypt being installed and the addition of the
$CFG->passwordsaltmain variable in the moodle config file. This variable already adds extra encryption to passwords for new users but does not secure passwords of users that already exists in your database.
If you do not want to force password changes to secure your Moodle and keep all backup functionality this patch might be usefull for you.

The patch adds extra encryption using the rijndael 128 algorithm with the variable $CFG->passwordsaltmain as a key. Warning: When you apply this patch you will not be able to restore user accounts from one moodle to another unless you use the same $CFG->passwordsaltmain in your config.php!

Usage:

Add $CFG->passwordsaltmain to your config.php file, add a long random value to this variable. Use something like:
$CFG->passwordsaltmain = ‘eBajyMadega6u5yLuBy5yza9yGezeg’;

Copy the patches to the /backup directory

Create a backup of your backuplib.php and restorelib.php

Test the patches first:

patch –dry-run -p1 -i backuplib.patch backuplib.php
patch –dry-run -p1 -i restorelib.patch restorelib.php

If you do not get any errors patch the files:

patch -p1 -i backuplib.patch backuplib.php
patch -p1 -i restorelib.patch restorelib.php

Now test if you can still break the passwords in your backup!

Download for Moodle < 1.9.5