I've created a new report plugin to show details of a number of courses which has the same manager. The report works fine if I hardcode the role id to use. I want to have a settings page where the admin can choose the roleid I've set up a settings.php page as below.
defined('MOODLE_INTERNAL') || die;
// Add a link to the reports admin settings menu.
$ADMIN->add('reports', new admin_externalpage('reportdepartments', get_string('pluginname', 'report_departments'), "$CFG->wwwroot/report/departments/index.php"));
if($ADMIN->fulltree) {
global $DB;
$roles= $DB->get_records_sql('SELECT id, name FROM mdl_role);
foreach($roles as $r) {
$roletypes[$r->id] = $r->name;
}
$settings->add(new admin_setting_configselect('departmentreport/managerroleid',
get_string('chooseroleid', 'report_departments'),
get_string('descchooseroleid', 'report_departments'), 'defaultroleid', $roletypes));
}
The problem is now that i have this page - which does let me choose the role in plugins->reports->departmental report settings - is that the report page gives me an error at the line number which calls the
admin_externalpage_setup();
function. I have it as
admin_externalpage_setup('reportdepartments', '', null, '', array('pagelayout'=>'report'));
I must be doing something wrong but I can't find it. Anyone have any ideas that can give me on how to fix it?
Thanks
Kieran Briggs