mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-77150 reportbuilder: Fix report attributes classes are ignored
Fix report attributes with key 'class' being ingored when adding them to report classes.
This commit is contained in:
parent
86311f5a40
commit
292925d4c0
@ -100,6 +100,7 @@ class custom_report_exporter extends persistent_exporter {
|
||||
],
|
||||
'multiple' => true,
|
||||
],
|
||||
'classes' => ['type' => PARAM_TEXT],
|
||||
'editmode' => ['type' => PARAM_BOOL],
|
||||
'sidebarmenucards' => [
|
||||
'type' => custom_report_column_cards_exporter::read_properties_definition(),
|
||||
@ -155,10 +156,16 @@ class custom_report_exporter extends persistent_exporter {
|
||||
if ($filterspresent) {
|
||||
$filtersform = $this->generate_filters_form()->render();
|
||||
}
|
||||
// Get the report attributes.
|
||||
|
||||
// Get the report classes and attributes.
|
||||
$reportattributes = $report->get_attributes();
|
||||
if (isset($reportattributes['class'])) {
|
||||
$classes = $reportattributes['class'];
|
||||
unset($reportattributes['class']);
|
||||
}
|
||||
$attributes = array_map(static function($key, $value): array {
|
||||
return ['name' => $key, 'value' => $value];
|
||||
}, array_keys($report->get_attributes()), $report->get_attributes());
|
||||
}, array_keys($reportattributes), $reportattributes);
|
||||
}
|
||||
|
||||
// If we are editing we need all this information for the template.
|
||||
@ -186,6 +193,7 @@ class custom_report_exporter extends persistent_exporter {
|
||||
'filterspresent' => $filterspresent,
|
||||
'filtersform' => $filtersform,
|
||||
'attributes' => $attributes,
|
||||
'classes' => $classes ?? '',
|
||||
'editmode' => $this->editmode,
|
||||
'javascript' => '',
|
||||
] + $editordata;
|
||||
|
@ -77,6 +77,7 @@ class system_report_exporter extends persistent_exporter {
|
||||
],
|
||||
'multiple' => true,
|
||||
],
|
||||
'classes' => ['type' => PARAM_TEXT],
|
||||
];
|
||||
}
|
||||
|
||||
@ -116,10 +117,15 @@ class system_report_exporter extends persistent_exporter {
|
||||
$filtersform->set_data_for_dynamic_submission();
|
||||
}
|
||||
|
||||
// Get the report attributes.
|
||||
// Get the report classes and attributes.
|
||||
$sourceattributes = $source->get_attributes();
|
||||
if (isset($sourceattributes['class'])) {
|
||||
$classes = $sourceattributes['class'];
|
||||
unset($sourceattributes['class']);
|
||||
}
|
||||
$attributes = array_map(static function($key, $value): array {
|
||||
return ['name' => $key, 'value' => $value];
|
||||
}, array_keys($source->get_attributes()), $source->get_attributes());
|
||||
}, array_keys($sourceattributes), $sourceattributes);
|
||||
|
||||
return [
|
||||
'table' => $output->render($table),
|
||||
@ -128,6 +134,7 @@ class system_report_exporter extends persistent_exporter {
|
||||
'filtersapplied' => $source->get_applied_filter_count(),
|
||||
'filtersform' => $filterspresent ? $filtersform->render() : '',
|
||||
'attributes' => $attributes,
|
||||
'classes' => $classes ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
"filtersform": "form"
|
||||
}
|
||||
}}
|
||||
<div class="reportbuilder-report"
|
||||
<div class="reportbuilder-report {{classes}}"
|
||||
data-region="core_reportbuilder/report"
|
||||
data-report-id="{{id}}"
|
||||
data-report-type="{{type}}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user