diff --git a/mod/quiz/comment.php b/mod/quiz/comment.php index e6b748b00c2..37ef4d9a62d 100644 --- a/mod/quiz/comment.php +++ b/mod/quiz/comment.php @@ -72,6 +72,9 @@ $summary->add_item('quizname', get_string('modulename', 'quiz'), format_string($ // Question name. $summary->add_item('questionname', get_string('question', 'quiz'), $attemptobj->get_question_name($slot)); +// Error message in case of input invalid mark. +$submiterror = false; + // Process any data that was submitted. if (data_submitted() && confirm_sesskey()) { if (optional_param('submit', false, PARAM_BOOL) && question_engine::is_manual_grade_in_range($attemptobj->get_uniqueid(), $slot)) { @@ -96,12 +99,18 @@ if (data_submitted() && confirm_sesskey()) { echo $output->notification(get_string('changessaved'), 'notifysuccess'); close_window(2, true); die; + } else { + $submiterror = true; } } // Print quiz information. echo html_writer::div($output->render($summary), 'mb-3'); +// Display notification if current mark is invalid. +if ($submiterror) { + echo $output->notification(get_string('savemanualgradingfailed', 'quiz'), \core\output\notification::NOTIFY_ERROR); +} // Print the comment form. echo '
'; diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php index de617c2477d..64e9656a09c 100644 --- a/mod/quiz/lang/en/quiz.php +++ b/mod/quiz/lang/en/quiz.php @@ -967,6 +967,7 @@ $string['saveandedit'] = 'Save changes and edit questions'; $string['saveattemptfailed'] = 'Failed to save the current quiz attempt.'; $string['savedfromdeletedcourse'] = 'Saved from deleted course "{$a}"'; $string['savegrades'] = 'Save grades'; +$string['savemanualgradingfailed'] = 'Modification not saved. Please check the message below and try again.'; $string['savemyanswers'] = 'Save my answers'; $string['savenosubmit'] = 'Save without submitting'; $string['saveoverrideandstay'] = 'Save and enter another override'; diff --git a/question/behaviour/rendererbase.php b/question/behaviour/rendererbase.php index 21de819f65c..9ebb9ece7b3 100644 --- a/question/behaviour/rendererbase.php +++ b/question/behaviour/rendererbase.php @@ -164,7 +164,7 @@ abstract class qbehaviour_renderer extends plugin_renderer_base { $error = $qa->validate_manual_mark($currentmark); $errorclass = ''; if ($error !== '') { - $erroclass = ' error'; + $errorclass = ' error alert-danger'; $error = html_writer::tag('span', $error, array('class' => 'error')) . html_writer::empty_tag('br'); }