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:
Tony Butler
2014-07-25 09:54:49 +01:00
parent 1d3c72cafd
commit d53cc3da71
+10 -1
View File
@@ -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);