garemoko / moodle-report_tincan

2 stars 2 forks source link

Extending #2

Open stephenlane opened 9 years ago

stephenlane commented 9 years ago

Hi Andrew,

I have been trying to extend this plugin to utilize some more events within moodle. Is there anything that I need to do, I have been adding to the events.php file and then the lib.php file but to no avail. Its as if moodle doesnt recognize the event name. The event names I have been following are from here https://docs.moodle.org/dev/Event_2#Event_dispatching

Any ideas ?

Thanks in advance.

Stephen

garemoko commented 9 years ago

Hi Stephen,

To your question, two possibilities spring to mind:

  1. The events.php files is only run when the plugin is installed to register the events in the database. If you don't uninstall and reinstall the plugin any changes here will not take effect. I can't remember the exact table in the database, but you can probably find it by searching.
  2. Some events don't get triggered by the admin user, you need to be a learner. This one cost me hours of time.

As you're looking at taking this forward, you should also take a look at https://github.com/leo-platforms/moodle-quiz-tincan which was based on this plugin. That code was designed to work with a customised Moodle so will fail looking for some database fields that aren't there, but if you debug it, it'll be much further on for tracking the quiz. Note that this version uses the old Events 1 API for Moodle 2.5, so you'll need to update that too.

You should also be aware of https://moodle.org/plugins/view.php?plugin=local_smart_klass which uses the cron instead of the events API.

I'd also recommend taking a look at TinCanPHP and use that to send statements. This code doesn't use TinCanPHP because of a need at the time to support PHP 5.3, however there is now a branch of TinCanPHP that provides PHP 5.2 support. If you can use PHP 5.4 you can stick with the master branch which would be better though.

stephenlane commented 9 years ago

Hi Andrew,

Thanks for the info I will have a look around and see which approach is the easiest to implement. In relation to klassdatas plugin I have implemented it to test and see what they are doing but they dont seem to have any dashboard built yet to view whats being extracted with the cron job.

garemoko commented 9 years ago

Might be worth contacting them. I couldn't get the dashboard to work either, but I think its supposed to.

stephenlane commented 9 years ago

Thanks Andrew, I thought it was just me.