Hi guys, This is in two parts. The first, is it possible, the second, should I.
I want to create a new context when I install a new plugin. This will be a class that extends the base class 'context' in accesslib.php (my class will be in my lib.php file for my plugin so no core code canges required upon installation). Ive been through the code VERY breifly and cant see what other changes I would need to make. Let me explain what I want and why:
So, I have a system that I am upgrading. I wrote and releasd this for Moodle 1.9. I am now upgrading it to Moodle 2.x. This system is a Grade Tracking system for BTECS, City and Guild, Cache, Alevel, Functional Skills etc. It lets teachers track and mark assignments based on Criteria such as P1, M2 and D3 etc. It does a whole list of other things (see http://moodlegrades.bedford.ac.uk for a bit more information and a basic outline of the project, preview coming soon).
This will mainly be a block but will have additional mods to add extended data and funcitionality.
When checking for capibilities in my old Moodle 1.9 version I was using the context of course, where the course was the front page. So if the user was a teacher on the front page, or a manager on the front page, check their capibilities using that. I was then assigning students, teachers, managers to VIEW the different Qualifications seperatly. (This meant there had to be two assignments), one to the qualificaion to view it, one to the front page roles to get the capibilities. This was the best way I came up with to get everything I needed at the time.
What I am thinking is that if I have the context of 'qualifiction' then this would do both. If I assign someone as a manger to a qual and a manager has certain capibilities in that qual/context. Then passing the qual_id into the context will get me those capibilities. This means I can have one assign_roles and ignore the front page roles.
So, can this be done? and Should I?
Thanks
Mark