Best practice forum (Archived)

This forum discussion has been removed

 
This forum post has been removed
Monday, 21 November 2011, 11:54 PM
The content of this forum post has been removed and can no longer be accessed.
Simon Coggins
Re: Hiding Export feature from students
by Simon Coggins - Tuesday, 22 November 2011, 12:15 AM
Group Totara

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

This forum post has been removed
Tuesday, 22 November 2011, 1:06 AM
The content of this forum post has been removed and can no longer be accessed.
Simon Coggins
Re: Hiding Export feature from students
by Simon Coggins - Tuesday, 22 November 2011, 12:52 PM
Group Totara

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

This forum post has been removed
Wednesday, 23 November 2011, 12:36 AM
The content of this forum post has been removed and can no longer be accessed.
Craig Eves
Re: Hiding Export feature from students
by Craig Eves (Totara Support) - Tuesday, 22 November 2011, 12:52 PM
Group Totara

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

This forum post has been removed
Wednesday, 23 November 2011, 12:37 AM
The content of this forum post has been removed and can no longer be accessed.