Newbie hooking on activities

Newbie hooking on activities

by ariyan ariyan -
Number of replies: 6
Hi
I'm going to create plugin for moodle to auto rank users based on each activity for each course.
I'm newbie in Moodle plugins.
What kind of plugin should I write? Where should I start to hook on activities?

Thanks
Average of ratings: -
In reply to ariyan ariyan

Re: Newbie hooking on activities

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

The docs page http://docs.moodle.org/dev/Plugins provides a list of available plugin types in Moodle. To help with the best type for your case, we would probably need more detailed description of what you are actually trying to achieve.

In reply to David Mudrák

Re: Newbie hooking on activities

by ariyan ariyan -
Hi & thanks for reply

I saw that page and as I understood from that I think Local Plugins are the best fit but I have no idea how listen for activities to happen!

I Want to create a mechanism to whenever someone registers on a course, system give him a rank (for that course only) based on his activities

for example I want each time he views the course system give him 1 point then when he added a comment system give him another 1 point and ...

At the end each user in that course hould have a number as Rank or Reputation for that user in that course

In reply to ariyan ariyan

Re: Newbie hooking on activities

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

Beware, local plugins are very tempting to be (ab)used. What you describe sounds more like an Activity module (mod) as it is something that participants in one given course interact with during learning. So I would suggest to give the mod type a try and looked closely at the new Events API that should allow your activity modele become an observer of other events triggered within the course.

Average of ratings:Useful (1)
In reply to David Mudrák

Re: Newbie hooking on activities

by ariyan ariyan -

Thanks

So you say I should create an activity plugin that listens to course events.

In this case can I store different ranks for different students for this course only?

Should I add a table for my ranks to database or moodle has a mechanism to keep my ranks for each enrolled student?