Skip to content

Commit

Permalink
MDL-82128 core_grades: Grade import notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Fragonite committed Nov 24, 2024
1 parent 47b8136 commit 877a522
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions grade/import/csv/lang/en/gradeimport_csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
11 changes: 11 additions & 0 deletions grade/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 877a522

Please sign in to comment.