Skip to content

Commit

Permalink
Fix-201: Added filtering of report filename in case using {mlang}.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-milette committed Nov 14, 2023
1 parent 35006b2 commit aa80d62
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions editcomp.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@
$managereporturl = new \moodle_url('/blocks/configurable_reports/managereport.php', ['courseid' => $courseid]);
$PAGE->navbar->add(get_string('managereports', 'block_configurable_reports'), $managereporturl);

$PAGE->navbar->add($report->name);

$title = format_string($report->name);
$PAGE->navbar->add($title);

$PAGE->set_title($title);
$PAGE->set_heading($title);
$PAGE->set_cacheable(true);
Expand Down Expand Up @@ -221,4 +221,4 @@
echo '</div>';
}

echo $OUTPUT->footer();
echo $OUTPUT->footer();
2 changes: 1 addition & 1 deletion export/csv/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function export_report($report) {

$table = $report->table;
$matrix = array();
$filename = 'report';
$filename = format_string($report->name) ?? 'report';

if (!empty($table->head)) {
$countcols = count($table->head);
Expand Down
5 changes: 3 additions & 2 deletions export/json/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
*/
function export_report($report){
$table = $report->table;
$filename = 'report_' . (time()) . '.json';
$report_name = format_string($report->name) ?? 'report';
$filename = $report_name.'_'.(time()).'.json';
$json = [];
$headers = $table->head;
foreach ($table->data as $data) {
Expand All @@ -40,4 +41,4 @@ function export_report($report){
header('Content-type: application/json');
echo json_encode($json);
exit;
}
}
3 changes: 2 additions & 1 deletion export/ods/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ function export_report($report) {

$table = $report->table;
$matrix = array();
$filename = 'report_'.(time()).'.ods';
$report_name = format_string($report->name) ?? 'report';
$filename = $report_name.'_'.(time()).'.ods';

if (!empty($table->head)) {
$countcols = count($table->head);
Expand Down
3 changes: 2 additions & 1 deletion export/xls/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ function export_report($report) {

$table = $report->table;
$matrix = array();
$filename = 'report_'.(time()).'.xls';
$report_name = format_string($report->name) ?? 'report';
$filename = $report_name.'_'.(time()).'.xlsx';

if (!empty($table->head)) {
$countcols = count($table->head);
Expand Down

0 comments on commit aa80d62

Please sign in to comment.