Best practice forum (Archived)
La discussione è stata rimossa.
Hi Shameer,
When you say you have created the report, what do you mean? Did you use report builder or is it another report? If it's report builder, did you customise it to report on enrollments?
Report builder doesn't currently have an option to hide the export button although if you've built an embedded report it shouldn't be too hard to modify the page to conceal the export button from students.
Simon
Okay, to hide the export button there are two sections of code you will need to change. First the bit that actually does the export when the form is submitted:
if ($format!='') { $report->export_data($format); die; }
You will need to add a check to ensure the user is allowed to export the report. You might do that by adding a new capability:
if ($format!='') { if (has_capability('yourcapabilityhere', get_system_context())) { $report->export_data($format); die; } else { print_error('nopermission'); } }
The other place is where the button is printed:
$report->export_select();
you'll need to do something similar:
if (has_capability('yourcapabilityhere', get_system_context())) { $report->export_select(); }
If you apply this change to the file local/reportbuilder/report.php it will affect all user generated reports. Therefore you might be better to create an embedded report and only make the change on that page. See my/teammembers.php for an example of an embedded report.
Hope that helps,
Simon
Hi Shameer
The report builder does have the ability to hide the export options for everyone.
Site admin > Reports > Report builder > Global settings and unselect the export formats you don't want to appear on reports created with the report builder.
As Simon says this setting isn't available for certain roles but it may be useful in other circumstances.
Craig