MDL-46442 mod_assign: Notify users when grades are changed

This commit is contained in:
Zachary Durber 2014-12-02 09:42:13 +08:00
parent 8f06fffbe1
commit a4b10a5244
2 changed files with 11 additions and 3 deletions

View file

@ -1810,13 +1810,14 @@ class assign {
* Mark in the database that this grade record should have an update notification sent by cron.
*
* @param stdClass $grade a grade record keyed on id
* @param bool $mailedoverride when true, flag notification to be sent again.
* @return bool true for success
*/
public function notify_grade_modified($grade) {
public function notify_grade_modified($grade, $mailedoverride = false) {
global $DB;
$flags = $this->get_user_flags($grade->userid, true);
if ($flags->mailed != 1) {
if ($flags->mailed != 1 || $mailedoverride) {
$flags->mailed = 0;
}
@ -6557,7 +6558,7 @@ class assign {
// 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);
$this->notify_grade_modified($grade, true);
}
}