Geolocating students

Name

Online Users Google Map

Module type

Block

Author

Alex Little

Released

2007

Maintained

Actively

Languages

English, French, German, Hungarian, Portugese, Spanish

Compliance

Good

Documentation

Readme.txt file

Errors

None displayed

Using a learning management system for teaching means that students can access material and participate in activities at all hours of the day. The Online Users block is a standard block in Moodle, and shows users who are online (or have been online very recently). It is often amazing to log on to a course website late at night and find that there are still a number of users working away in a course.

The Online Users Google Map block shows participants who are online, not by name, but by location. Now students can see that they are not alone in their studies, and that the students in the course come from all over the map.

Getting ready

Unzip and copy the online_users_map block directory into the /moodle/blocks/ directory then visit the Notifications page.

Note

This module requires access to information from outside your site. The cURL library needs to be enabled in your PHP settings. See Chapter 1, Getting Modular with Moodle for information on enabling cURL.

How to do it...

After the block is installed, you will be taken to the global settings page for the block:

How to do it...

There is one particular setting that needs attention, and that is the Google Maps API key. If you already have an API key for the Map module (reviewed in Chapter 2, Effective Use of Space), then you can reuse that key. If you don't already have one, you can obtain a key from the link provided below the Google Maps API key setting. Clicking this link launches a new window and takes you to the Google Maps API site.

Enter the URL of your site. If you are running a test server, it is OK to enter http://localhost. You will need to agree to Google's terms and conditions then press the button labeled Generate API Key.

When a key is generated it is presented in a number of formats. The value you need is the first string of letters and numbers.

How to do it...

Paste this value back into the global settings page for the Online Users Google Map and save these settings.

Another setting you might consider changing is the initial zoom value. If all your students come from one country or a smaller area, you might consider increasing the zoom level to a value greater than zero, to focus on where students are located. Users can zoom in and out manually once the block is loaded. Users are differentiated by what town they are located in, so there is no distinction between users located in a single town.

Once installed, you can add an Online Users Map block by selecting this option from the Blocks menu. There are no instance settings for this block.

How it works...

The Online Users Google Map block shows the location of users in the current course, centered around the user's own location. Users who are online (or have been in the last five minutes) are shown with green markers.

How it works...

It is possible to zoom in and out on the map, right down to the local level. The map can also be dragged to re-centre it. Moving the mouse over a marker reveals the name of the user it represents.

There's more...

In Moodle, the location of each user is identified by a town and a country. Before these locations can be displayed on a map, the longitude and latitude values for these locations need to be discovered. It takes a second or so to translate the map location for each town, so it would be very inefficient to undertake this each time the block loads. Instead, the block creates a Cron job to translate and cache locations of users in the background. If you add the block to a course page before such a search takes place, you will see an empty map. If you are running a test server, you might not have a Cron program running at all. To force the Cron script to run, direct your browser to the following URL http://localhost/moodle/admin/cron.php. If you are running Moodle on a real server, replace localhost with the hostname of your server.

Note

Cron is the name of a program that runs on a server and performs tasks in the background on a regular basis. A number of Moodle modules make use of the Cron process to update settings. An example is the Forum module, which on a regular basis, needs to send e-mails about new posts to users. For more information about the use of Cron in Moodle, visit http://docs.moodle.org/en/Cron.

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset