This commit is contained in:
Andrew Nicols
2023-03-02 10:46:49 +08:00
5 changed files with 28 additions and 6 deletions
+7 -1
View File
@@ -1143,6 +1143,12 @@ class flexible_table {
foreach ($row as $index => $data) {
$column = $colbyindex[$index];
$columnattributes = $this->columnsattributes[$column] ?? [];
if (isset($columnattributes['class'])) {
$this->column_class($column, $columnattributes['class']);
unset($columnattributes['class']);
}
$attributes = [
'class' => "cell c{$index}" . $this->column_class[$column],
'id' => "{$rowid}_c{$index}",
@@ -1155,7 +1161,7 @@ class flexible_table {
$attributes['scope'] = 'row';
}
$attributes += $this->columnsattributes[$column] ?? [];
$attributes += $columnattributes;
if (empty($this->prefs['collapse'][$column])) {
if ($this->column_suppress[$column] && $suppresslastrow !== null && $suppresslastrow[$index] === $data) {
+1
View File
@@ -74,6 +74,7 @@ information provided here is intended especially for developers.
action in the modal body like ticking a checkbox or selecting an element.
* Course module indentation has been recovered for course format using components via Move right/left feature.
Course formats using components will be allowed to use one level indentation only.
* The method `flexible_table::set_columnsattributes` now can be used with 'class' key to add custom classes to the DOM.
=== 4.1 ===
+10 -2
View File
@@ -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;
+9 -2
View File
@@ -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 ?? '',
];
}
}
+1 -1
View File
@@ -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}}"