MDL-71062 core: Step 1 deprecation of print_error function
This commit is contained in:
+5
-5
@@ -23,27 +23,27 @@ $noteid = required_param('id', PARAM_INT);
|
||||
$PAGE->set_url('/notes/delete.php', array('id' => $noteid));
|
||||
|
||||
if (!$note = note_load($noteid)) {
|
||||
print_error('invalidid');
|
||||
throw new \moodle_exception('invalidid');
|
||||
}
|
||||
|
||||
if (!$course = $DB->get_record('course', array('id' => $note->courseid))) {
|
||||
print_error('invalidcourseid');
|
||||
throw new \moodle_exception('invalidcourseid');
|
||||
}
|
||||
|
||||
require_login($course);
|
||||
|
||||
if (empty($CFG->enablenotes)) {
|
||||
print_error('notesdisabled', 'notes');
|
||||
throw new \moodle_exception('notesdisabled', 'notes');
|
||||
}
|
||||
|
||||
if (!$user = $DB->get_record('user', array('id' => $note->userid))) {
|
||||
print_error('invaliduserid');
|
||||
throw new \moodle_exception('invaliduserid');
|
||||
}
|
||||
|
||||
$context = context_course::instance($course->id);
|
||||
|
||||
if (!has_capability('moodle/notes:manage', $context)) {
|
||||
print_error('nopermissiontodelete', 'notes');
|
||||
throw new \moodle_exception('nopermissiontodelete', 'notes');
|
||||
}
|
||||
|
||||
if (data_submitted() && confirm_sesskey()) {
|
||||
|
||||
Reference in New Issue
Block a user