diff --git a/lang/en_utf8/assignment.php b/lang/en_utf8/assignment.php index 01286a41914..d24529d9df3 100644 --- a/lang/en_utf8/assignment.php +++ b/lang/en_utf8/assignment.php @@ -37,6 +37,7 @@ $string['duedateno'] = 'No due date'; $string['early'] = '$a early'; $string['editmysubmission'] = 'Edit my submission'; $string['emailstudents'] = 'Email alerts to students'; +$string['emailnotification'] = 'Send notification email'; $string['emailteachermail'] = '$a->username has updated their assignment submission for \'$a->assignment\' diff --git a/lang/en_utf8/help/assignment/emailnotification.html b/lang/en_utf8/help/assignment/emailnotification.html new file mode 100644 index 00000000000..1b913fa4cf2 --- /dev/null +++ b/lang/en_utf8/help/assignment/emailnotification.html @@ -0,0 +1,6 @@ +
Do you want to nofify students about received grades and feedback via email?
+ +Your preference is saved and will apply to all assignments in all courses.
+ diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 79b790ddbf9..e8716fceb65 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -491,6 +491,13 @@ class assignment_base { //make user global so we can use the id global $USER; + $mailinfo = optional_param('mailinfo', null, PARAM_BOOL); + if (is_null($mailinfo)) { + $mailinfo = get_user_preferences('assignment_mailinfo', 0); + } else { + set_user_preference('assignment_mailinfo', $mailinfo); + } + switch ($mode) { case 'grade': // We are in a popup window grading if ($submission = $this->process_feedback()) { @@ -512,6 +519,8 @@ class assignment_base { case 'fastgrade': ///do the fast grading stuff - this process should work for all 3 subclasses + + $mailinfo = get_user_preferences('assignment_mailinfoqg', 1); $grading = false; $commenting = false; $col = false; @@ -528,6 +537,7 @@ class assignment_base { $this->display_submissions(); break; } + foreach ($_POST[$col] as $id => $unusedvalue){ $id = (int)$id; //clean parameter name @@ -564,7 +574,10 @@ class assignment_base { } $submission->teacher = $USER->id; - $submission->mailed = $updatedb?0:$submission->mailed;//only change if it's an update + if ($updatedb) { + $submission->mailed = (int)(!$mailinfo); + } + $submission->timemarked = time(); //if it is not an update, we don't change the last modified time etc. @@ -921,7 +934,11 @@ class assignment_base { } } + $lastmailinfo = get_user_preferences('assignment_mailinfo', 1) ? 'checked="checked"' : ''; + ///Print Buttons in Single View + echo ''; + echo ''; echo ''; - //echo ''; } $table->print_html(); /// Print the whole table @@ -1303,22 +1320,20 @@ class assignment_base { /// End of fast grading form /// Mini form for setting user preference - echo '