MDL-33600 Assign: Allow teachers to skip notifying students about grade update.

This commit is contained in:
Damyon Wiese 2013-12-16 11:27:23 +08:00
parent ab7f498343
commit f7dc9871e7
4 changed files with 21 additions and 2 deletions

View file

@ -4928,7 +4928,10 @@ class assign {
$this->update_user_flags($flags);
}
$this->update_grade($grade);
$this->notify_grade_modified($grade);
// Allow teachers to skip sending notifications.
if (optional_param('sendstudentnotifications', true, PARAM_BOOL)) {
$this->notify_grade_modified($grade);
}
// Save outcomes.
if ($CFG->enableoutcomes) {
@ -5720,6 +5723,8 @@ class assign {
$mform->setDefault('addattempt', 0);
}
}
$mform->addElement('selectyesno', 'sendstudentnotifications', get_string('sendstudentnotifications', 'assign'));
$mform->setDefault('sendstudentnotifications', 1);
$mform->addElement('hidden', 'action', 'submitgrade');
$mform->setType('action', PARAM_ALPHA);
@ -6215,7 +6220,11 @@ class assign {
}
}
$this->update_grade($grade);
$this->notify_grade_modified($grade);
// Note the default if not provided for this option is true (e.g. webservices).
// This is for backwards compatibility.
if (!isset($formdata->sendstudentnotifications) || $formdata->sendstudentnotifications) {
$this->notify_grade_modified($grade);
}
$addtolog = $this->add_to_log('grade submission', $this->format_grade_for_log($grade), '', true);
$params = array(