Events 2 support in Moodle 2.6

Events 2 support in Moodle 2.6

by Zoran Jeremic -
Number of replies: 5

Hi,

I'm developing an application that should support learning analytics, recommendation and personalization in Moodle. It is based on external Java application that collects data from Moodle in a real time. I implemented it using Moodle events, which are collected and sent to external application. This works fine. However, the problem is that Moodle 2.6, that I have to use, doesn't have all required events. For example, "course_module_viewed" is implemented only for page, workshop, feedback, choice and book, while all other modules are added in Moodle 2.7.

My first question is if there are any plans for adding these missing events in Moodle 2.6 in the future.

If not, do you have any proposal what could I do in order to get these information without changing Moodle code?  Is it possible to somehow implement these missing events that I need in plugin that I implemented and then trigger it when for example user clicks on URL?

The first thing that came to my mind was to use AOP to get information when some event happened and then to create missing events, but I'm not sure if this is the best approach, and I guess somebody would give me some better idea.


Thanks,

Zoran

Average of ratings: -
In reply to Zoran Jeremic

Re: Events 2 support in Moodle 2.6

by Darko Miletić -

Moodle 2.6 is basically in security bug-fix mode. So no new features will go in there at all. If you need to work with 2.6 and add new events to existing core modules you will have to hack the core.




Average of ratings: Useful (1)
In reply to Darko Miletić

Re: Events 2 support in Moodle 2.6

by Zoran Jeremic -

Hi Darko,

Thank you for quick response and explanation. That's what I was afraid of, but I'll have to deal with it somehow. Unfortunately, my employer decided to migrate current Moodle version to Moodle 2.6. I'm afraid I can't do anything about it. I'm also concerned that if I hack the core code, system administrators will not be very happy about it, and might dissagree with it, so I wanted to avoid that if possible.

I thought that I might use Aspect-oriented programming to intercept call to system function that is responsible for writing log. I noticed that this method is called everywhere I need event to be triggered, so I thought approach proposed here could work, but didn't try this before. Are you aware of any dissadvantages of this approach?


Thanks,

Zoran

In reply to Zoran Jeremic

Re: Events 2 support in Moodle 2.6

by Darko Miletić -

You can also try the road of using database triggers. For example you know that course is created when new record is created in mdl_course table. So you add the trigger for after insert on that table and do something that helps you in your intent.

For MySQL

http://dev.mysql.com/doc/refman/5.6/en/trigger-syntax.html


For PostgreSQL

http://www.postgresql.org/docs/9.1/static/sql-createtrigger.html

Average of ratings: Useful (1)
In reply to Darko Miletić

Re: Events 2 support in Moodle 2.6

by Zoran Jeremic -

Hi Darko,


The idea with database triggers sound very interesting and worth of trying. For me, it's definitelly better than hacking the core Moodle code. I'll try with both approaches and see what happens.


Thanks,

Zoran