MDL-71062 core: Step 1 deprecation of print_error function

This commit is contained in:
Sujith Haridasan
2022-07-13 08:20:54 +05:30
parent a23f0bff3e
commit 73d604369d
506 changed files with 1511 additions and 1488 deletions
+5 -5
View File
@@ -39,7 +39,7 @@ $user = optional_param('user', 0, PARAM_INT);
$rolec = optional_param('rolec', 0, PARAM_INT);
if (!$cmid && !$courseid) {
print_error('invalidarguments');
throw new \moodle_exception('invalidarguments');
}
// Process self completion
@@ -92,12 +92,12 @@ if ($courseid) {
$completion = $completion->get_completion($USER->id, COMPLETION_CRITERIA_TYPE_SELF);
if (!$completion) {
print_error('noselfcompletioncriteria', 'completion');
throw new \moodle_exception('noselfcompletioncriteria', 'completion');
}
// Check if the user has already marked themselves as complete
if ($completion->is_complete()) {
print_error('useralreadymarkedcomplete', 'completion');
throw new \moodle_exception('useralreadymarkedcomplete', 'completion');
}
$completion->mark_complete();
@@ -128,7 +128,7 @@ switch($targetstate) {
case COMPLETION_INCOMPLETE:
break;
default:
print_error('unsupportedstate');
throw new \moodle_exception('unsupportedstate');
}
// Get course-modules entry
@@ -140,7 +140,7 @@ require_login($course, false, $cm);
require_capability('moodle/course:togglecompletion', context_module::instance($cmid));
if (isguestuser() or !confirm_sesskey()) {
print_error('error');
throw new \moodle_exception('error');
}
// Set up completion object and check it is enabled.