Best practice forum (Archived)

Cette discussion de forum a été supprimée

 
Ce message du forum a été supprimé
Monday 21 November 2011, 23:54
Le contenu de ce message de forum a été supprimé et n'est plus accessible.
Simon Coggins
Re: Hiding Export feature from students
par Simon Coggins, Tuesday 22 November 2011, 00:15
Groupe 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

Ce message du forum a été supprimé
Tuesday 22 November 2011, 01:06
Le contenu de ce message de forum a été supprimé et n'est plus accessible.
Simon Coggins
Re: Hiding Export feature from students
par Simon Coggins, Tuesday 22 November 2011, 12:52
Groupe 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

Ce message du forum a été supprimé
Wednesday 23 November 2011, 00:36
Le contenu de ce message de forum a été supprimé et n'est plus accessible.
Craig Eves
Re: Hiding Export feature from students
par Craig Eves (Totara Support), Tuesday 22 November 2011, 12:52
Groupe 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

Ce message du forum a été supprimé
Wednesday 23 November 2011, 00:37
Le contenu de ce message de forum a été supprimé et n'est plus accessible.