Best practice forum (Archived)

该论坛讨论已删除

 
该论坛帖子已被删除
2011年11月21日 Monday 23:54
该论坛帖子的内容已被删除,无法再访问。
CogginsSimon
Re: Hiding Export feature from students
CogginsSimon 发表于 2011年11月22日 Tuesday 00:15
小组 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

该论坛帖子已被删除
2011年11月22日 Tuesday 01:06
该论坛帖子的内容已被删除,无法再访问。
CogginsSimon
Re: Hiding Export feature from students
CogginsSimon 发表于 2011年11月22日 Tuesday 12:52
小组 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

该论坛帖子已被删除
2011年11月23日 Wednesday 00:36
该论坛帖子的内容已被删除,无法再访问。
Craig Eves
Re: Hiding Export feature from students
Eves (Totara Support)Craig 发表于 2011年11月22日 Tuesday 12:52
小组 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

该论坛帖子已被删除
2011年11月23日 Wednesday 00:37
该论坛帖子的内容已被删除,无法再访问。