From 877a5222a5cad5a9367243b72a1121ec72ceb4b2 Mon Sep 17 00:00:00 2001 From: Alexander Van der Bellen Date: Tue, 27 Aug 2024 19:23:38 +0800 Subject: [PATCH] MDL-82128 core_grades: Grade import notification --- grade/import/csv/lang/en/gradeimport_csv.php | 1 + grade/lib.php | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/grade/import/csv/lang/en/gradeimport_csv.php b/grade/import/csv/lang/en/gradeimport_csv.php index 3e2a2090bb86a..06f06562c552f 100644 --- a/grade/import/csv/lang/en/gradeimport_csv.php +++ b/grade/import/csv/lang/en/gradeimport_csv.php @@ -24,5 +24,6 @@ */ $string['csv:view'] = 'Import grades from CSV'; +$string['gradepenalties'] = 'Grade penalties will not be applied to imported grades.'; $string['pluginname'] = 'CSV file'; $string['privacy:metadata'] = 'The import grades from CSV plugin does not store any personal data.'; diff --git a/grade/lib.php b/grade/lib.php index e241c7ae9879c..ab25f7b0319ad 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -992,6 +992,17 @@ function print_grade_page_head(int $courseid, string $active_type, ?string $acti $output = $OUTPUT->heading($heading); } + // If any grade penalty plugins are enabled, notify the user that grade penalties will not be applied to imported grades. + if ($active_type === 'import') { + foreach (core_plugin_manager::instance()->get_plugins_of_type('gradepenalty') as $plugin) { + if ($plugin->is_enabled()) { + $output .= $OUTPUT->notification(get_string('gradepenalties', 'gradeimport_csv'), + \core\output\notification::NOTIFY_INFO, false); + break; + } + } + } + if ($return) { $returnval .= $output; } else {