Adding custom report to roles

Adding custom report to roles

by Perry Way -
Number of replies: 1

I've been programming a few custom reports and have them installed in Moodle and working correctly.

They show up in the Site Administrator menu under Reports which is okay for most reports as they are more oriented to system administrators. However there's one report I made which I want to make available to other roles. Like Managers. I want Managers to see all the reports that I see in the Site Administrator -> Reports menu. So I've been trying to get my mind wrapped around the concept of capabilities and contexts. Not really sure what I'm doing. I followed the breadcrumbs left by Hansel and Gretle (many thanks for leaving them instead of eating everything) but now I am stuck. I can't figure out how to get the reports to show up on the menu for other roles. I know how to adjust role capabilities and access in Moodle but the problem is my reports don't show up on that list so I can't set the values.

Any help would be great! Thanks!

Average of ratings: -
In reply to Perry Way

Re: Adding custom report to roles

by Perry Way -

I am now able to get the report to show up in the roles settings adjustment page, however the settings do not work, in that if I allow Manager and Teacher access to the report, they still do not see it on their menu. I've followed everything suggested on this page (http://docs.moodle.org/dev/Reports) but something is preventing it from showing on the menu. Has anyone got a clue where I should look?

Here is a snippet of the contents of my access.php file. I believe this is all correct.

// People who can view the reports 
$capabilities = array(
'report/attendancespan:view' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'manager' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW)
)
);