mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 16:13:28 +02:00
"MDL-14129, fix print_error"
This commit is contained in:
parent
aad6739758
commit
38eac4d5c3
5 changed files with 30 additions and 27 deletions
|
@ -9,7 +9,7 @@
|
|||
|
||||
/// locate course information
|
||||
if (!($course = $DB->get_record('course', array('id'=>$courseid)))) {
|
||||
print_error('Incorrect course id found');
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
/// require login to access notes
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
/// locate user information
|
||||
if (!($user = $DB->get_record('user', array('id'=>$userid)))) {
|
||||
print_error('Incorrect user id found');
|
||||
print_error('invaliduserid');
|
||||
}
|
||||
|
||||
/// build-up form
|
||||
|
|
|
@ -8,17 +8,17 @@ $noteid = required_param('note', PARAM_INT);
|
|||
|
||||
// locate note information
|
||||
if (!$note = note_load($noteid)) {
|
||||
print_error('Incorrect note id specified');
|
||||
print_error('invalidid');
|
||||
}
|
||||
|
||||
// locate course information
|
||||
if (!$course = $DB->get_record('course', array('id'=>$note->courseid))) {
|
||||
print_error('Incorrect course id found');
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
// locate user information
|
||||
if (!$user = $DB->get_record('user', array('id'=>$note->userid))) {
|
||||
print_error('Incorrect user id found');
|
||||
print_error('invaliduserid');
|
||||
}
|
||||
|
||||
// require login to access notes
|
||||
|
@ -29,7 +29,7 @@ $context = get_context_instance(CONTEXT_COURSE, $course->id);
|
|||
|
||||
// check capability
|
||||
if (!has_capability('moodle/notes:manage', $context)) {
|
||||
print_error('You may not delete this note');
|
||||
print_error('nopermissiontodelete', 'notes');
|
||||
}
|
||||
|
||||
if (data_submitted() && confirm_sesskey()) {
|
||||
|
@ -38,7 +38,7 @@ if (data_submitted() && confirm_sesskey()) {
|
|||
if (note_delete($noteid)) {
|
||||
add_to_log($note->courseid, 'notes', 'delete', 'index.php?course='.$note->courseid.'&user='.$note->userid . '#note-' . $note->id , 'delete note');
|
||||
} else {
|
||||
print_error('Error occured while deleting post', '', $returnurl);
|
||||
print_error('cannotdeletepost', 'notes', $returnurl);
|
||||
}
|
||||
redirect($returnurl);
|
||||
} else {
|
||||
|
|
|
@ -8,17 +8,17 @@
|
|||
|
||||
/// locate note information
|
||||
if (!$note = note_load($noteid)) {
|
||||
print_error('Incorrect note id specified');
|
||||
print_error('invalidid', 'notes');
|
||||
}
|
||||
|
||||
/// locate course information
|
||||
if (!$course = $DB->get_record('course', array('id'=>$note->courseid))) {
|
||||
print_error('Incorrect course id found');
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
/// locate user information
|
||||
if (!$user = $DB->get_record('user', array('id'=>$note->userid))) {
|
||||
print_error('Incorrect user id found');
|
||||
print_error('invaliduserid');
|
||||
}
|
||||
|
||||
/// require login to access notes
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
|
||||
/// locate course information
|
||||
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
|
||||
print_error('Incorrect course id specified');
|
||||
print_error('invalidcourseid');
|
||||
}
|
||||
|
||||
/// locate user information
|
||||
if ($userid) {
|
||||
if (!$user = $DB->get_record('user', array('id'=>$userid))) {
|
||||
print_error('Incorrect user id specified');
|
||||
print_error('invaliduserid');
|
||||
}
|
||||
$filtertype = 'user';
|
||||
$filterselect = $user->id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue