mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-38101 Completion: Error when teacher/admin marks activity complete
This commit is contained in:
parent
cce0d9a100
commit
7ae7c3cf9a
@ -138,14 +138,17 @@ if (isguestuser() or !confirm_sesskey()) {
|
||||
print_error('error');
|
||||
}
|
||||
|
||||
// Now change state
|
||||
// Set up completion object and check it is enabled.
|
||||
$completion = new completion_info($course);
|
||||
if (!$completion->is_enabled()) {
|
||||
throw new moodle_exception('completionnotenabled', 'completion');
|
||||
} elseif (!$completion->is_tracked_user($USER->id)) {
|
||||
throw new moodle_exception('nottracked', 'completion');
|
||||
}
|
||||
|
||||
// NOTE: All users are allowed to toggle their completion state, including
|
||||
// users for whom completion information is not directly tracked. (I.e. even
|
||||
// if you are a teacher, or admin who is not enrolled, you can still toggle
|
||||
// your own completion state. You just don't appear on the reports.)
|
||||
|
||||
// Check completion state is manual
|
||||
if($cm->completion != COMPLETION_TRACKING_MANUAL) {
|
||||
error_or_ajax('cannotmanualctrack', $fromajax);
|
||||
|
Loading…
x
Reference in New Issue
Block a user