O'Reilly logo

Moodle 3.x Developer's Guide by Ian Wild

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Extracting the data

The code to determine the number of times a user has interacted with a resource or activity, we will take from the Heatmap block plugin by Michael de Raadt (visit https://moodle.org/plugins/pluginversions.php?plugin=block_heatmap for details). We will create a new script called /locallib.php and add a new function to return the number of interactions with each resource or activity.

This code can be taken from the Heatmap block code:

Let's work through this function step by step to see how it operates. The function is passed the ID number of the course for which we need user interaction data:

 function course_report_get_views($courseid) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required