mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-66897 mod_assign: Properly display error messages in quick grading
This commit is contained in:
parent
fd126006b0
commit
9f9a3ddebe
@ -3420,11 +3420,12 @@ class assign {
|
|||||||
$this->show_intro(),
|
$this->show_intro(),
|
||||||
$this->get_course_module()->id,
|
$this->get_course_module()->id,
|
||||||
get_string('quickgradingresult', 'assign')));
|
get_string('quickgradingresult', 'assign')));
|
||||||
|
$gradingerror = in_array($message, $this->get_error_messages());
|
||||||
$lastpage = optional_param('lastpage', null, PARAM_INT);
|
$lastpage = optional_param('lastpage', null, PARAM_INT);
|
||||||
$gradingresult = new assign_gradingmessage(get_string('quickgradingresult', 'assign'),
|
$gradingresult = new assign_gradingmessage(get_string('quickgradingresult', 'assign'),
|
||||||
$message,
|
$message,
|
||||||
$this->get_course_module()->id,
|
$this->get_course_module()->id,
|
||||||
false,
|
$gradingerror,
|
||||||
$lastpage);
|
$lastpage);
|
||||||
$o .= $this->get_renderer()->render($gradingresult);
|
$o .= $this->get_renderer()->render($gradingresult);
|
||||||
$o .= $this->view_footer();
|
$o .= $this->view_footer();
|
||||||
@ -6772,7 +6773,9 @@ class assign {
|
|||||||
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
|
$gradingmanager = get_grading_manager($this->get_context(), 'mod_assign', 'submissions');
|
||||||
$controller = $gradingmanager->get_active_controller();
|
$controller = $gradingmanager->get_active_controller();
|
||||||
if (!empty($controller)) {
|
if (!empty($controller)) {
|
||||||
return get_string('errorquickgradingvsadvancedgrading', 'assign');
|
$message = get_string('errorquickgradingvsadvancedgrading', 'assign');
|
||||||
|
$this->set_error_message($message);
|
||||||
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = array();
|
$users = array();
|
||||||
@ -6806,7 +6809,9 @@ class assign {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($users)) {
|
if (empty($users)) {
|
||||||
return get_string('nousersselected', 'assign');
|
$message = get_string('nousersselected', 'assign');
|
||||||
|
$this->set_error_message($message);
|
||||||
|
return $message;
|
||||||
}
|
}
|
||||||
|
|
||||||
list($userids, $params) = $DB->get_in_or_equal(array_keys($users), SQL_PARAMS_NAMED);
|
list($userids, $params) = $DB->get_in_or_equal(array_keys($users), SQL_PARAMS_NAMED);
|
||||||
@ -6860,7 +6865,9 @@ class assign {
|
|||||||
// handle hidden columns.
|
// handle hidden columns.
|
||||||
if ($plugin->is_quickgrading_modified($modified->userid, $grade)) {
|
if ($plugin->is_quickgrading_modified($modified->userid, $grade)) {
|
||||||
if ((int)$current->lastmodified > (int)$modified->lastmodified) {
|
if ((int)$current->lastmodified > (int)$modified->lastmodified) {
|
||||||
return get_string('errorrecordmodified', 'assign');
|
$message = get_string('errorrecordmodified', 'assign');
|
||||||
|
$this->set_error_message($message);
|
||||||
|
return $message;
|
||||||
} else {
|
} else {
|
||||||
$modifiedusers[$modified->userid] = $modified;
|
$modifiedusers[$modified->userid] = $modified;
|
||||||
continue;
|
continue;
|
||||||
@ -6895,7 +6902,9 @@ class assign {
|
|||||||
$badattempt = (int)$current->attemptnumber != (int)$modified->attemptnumber;
|
$badattempt = (int)$current->attemptnumber != (int)$modified->attemptnumber;
|
||||||
if ($badmodified || $badattempt) {
|
if ($badmodified || $badattempt) {
|
||||||
// Error - record has been modified since viewing the page.
|
// Error - record has been modified since viewing the page.
|
||||||
return get_string('errorrecordmodified', 'assign');
|
$message = get_string('errorrecordmodified', 'assign');
|
||||||
|
$this->set_error_message($message);
|
||||||
|
return $message;
|
||||||
} else {
|
} else {
|
||||||
$modifiedusers[$modified->userid] = $modified;
|
$modifiedusers[$modified->userid] = $modified;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user