MDL-43908 mod_assign: Prevent notifications for unavailable assignments
Signed-off-by: Tony Butler <[email protected]> Conflicts: mod/assign/locallib.php
This commit is contained in:
+10
-1
@@ -5757,7 +5757,16 @@ class assign {
|
||||
}
|
||||
}
|
||||
$mform->addElement('selectyesno', 'sendstudentnotifications', get_string('sendstudentnotifications', 'assign'));
|
||||
$mform->setDefault('sendstudentnotifications', 1);
|
||||
// Get assignment visibility information for student.
|
||||
$modinfo = get_fast_modinfo($settings->course, $userid);
|
||||
$cm = $modinfo->get_cm($this->get_course_module()->id);
|
||||
// Don't allow notification to be sent if student can't access assignment.
|
||||
if (!$cm->uservisible) {
|
||||
$mform->setDefault('sendstudentnotifications', 0);
|
||||
$mform->freeze('sendstudentnotifications');
|
||||
} else {
|
||||
$mform->setDefault('sendstudentnotifications', 1);
|
||||
}
|
||||
|
||||
$mform->addElement('hidden', 'action', 'submitgrade');
|
||||
$mform->setType('action', PARAM_ALPHA);
|
||||
|
||||
Reference in New Issue
Block a user