"MDL-14129, fix print_error"

This commit is contained in:
dongsheng 2008-06-13 06:50:06 +00:00
parent aad6739758
commit 38eac4d5c3
5 changed files with 30 additions and 27 deletions

View file

@ -1,26 +1,29 @@
<?PHP // $Id$ <?PHP // $Id$
// note.php // note.php
$string['note'] = 'Note';
$string['notes'] = 'Notes';
$string['sitenotes'] = 'Site notes';
$string['coursenotes'] = 'Course notes';
$string['personalnotes'] = 'Personal notes';
$string['created'] = 'created';
$string['nonotes'] = 'There are no notes of this type yet';
$string['notesnotvisible'] = 'You are not allowed to view the notes.';
$string['addnewnote'] = 'Add a new note'; $string['addnewnote'] = 'Add a new note';
$string['addnewnoteselect'] = 'Select users to write notes about'; $string['addnewnoteselect'] = 'Select users to write notes about';
$string['groupaddnewnote'] = 'Add a common note'; $string['bynameondate'] = 'by $a->name - $a->date';
$string['deleteconfirm'] = 'Delete this note?'; $string['cannotdeletepost'] = 'Error occured while deleting post';
$string['course'] = 'course';
$string['content'] = 'Content'; $string['content'] = 'Content';
$string['created'] = 'created';
$string['coursenotes'] = 'Course notes';
$string['deletenotes'] = 'Delete all notes';
$string['deleteconfirm'] = 'Delete this note?';
$string['editnote'] = 'Edit note';
$string['invalidid'] = 'Invalid note ID specified';
$string['groupaddnewnote'] = 'Add a common note';
$string['note'] = 'Note';
$string['notes'] = 'Notes';
$string['nonotes'] = 'There are no notes of this type yet';
$string['nopermissiontodelete'] = 'You may not delete this note';
$string['notesnotvisible'] = 'You are not allowed to view the notes.';
$string['nocontent'] = 'Note content can not be empty'; $string['nocontent'] = 'Note content can not be empty';
$string['nouser'] = 'You must select a user'; $string['nouser'] = 'You must select a user';
$string['unknown'] = 'unknown'; $string['personalnotes'] = 'Personal notes';
$string['bynameondate'] = 'by $a->name - $a->date';
$string['publishstate'] = 'Status'; $string['publishstate'] = 'Status';
$string['personal'] = 'personal'; $string['personal'] = 'personal';
$string['course'] = 'course'; $string['unknown'] = 'unknown';
$string['site'] = 'site'; $string['site'] = 'site';
$string['editnote'] = 'Edit note'; $string['sitenotes'] = 'Site notes';
$string['deletenotes'] = 'Delete all notes';
?> ?>

View file

@ -9,7 +9,7 @@
/// locate course information /// locate course information
if (!($course = $DB->get_record('course', array('id'=>$courseid)))) { if (!($course = $DB->get_record('course', array('id'=>$courseid)))) {
print_error('Incorrect course id found'); print_error('invalidcourseid');
} }
/// require login to access notes /// require login to access notes
@ -24,7 +24,7 @@
/// locate user information /// locate user information
if (!($user = $DB->get_record('user', array('id'=>$userid)))) { if (!($user = $DB->get_record('user', array('id'=>$userid)))) {
print_error('Incorrect user id found'); print_error('invaliduserid');
} }
/// build-up form /// build-up form

View file

@ -8,17 +8,17 @@ $noteid = required_param('note', PARAM_INT);
// locate note information // locate note information
if (!$note = note_load($noteid)) { if (!$note = note_load($noteid)) {
print_error('Incorrect note id specified'); print_error('invalidid');
} }
// locate course information // locate course information
if (!$course = $DB->get_record('course', array('id'=>$note->courseid))) { if (!$course = $DB->get_record('course', array('id'=>$note->courseid))) {
print_error('Incorrect course id found'); print_error('invalidcourseid');
} }
// locate user information // locate user information
if (!$user = $DB->get_record('user', array('id'=>$note->userid))) { if (!$user = $DB->get_record('user', array('id'=>$note->userid))) {
print_error('Incorrect user id found'); print_error('invaliduserid');
} }
// require login to access notes // require login to access notes
@ -29,7 +29,7 @@ $context = get_context_instance(CONTEXT_COURSE, $course->id);
// check capability // check capability
if (!has_capability('moodle/notes:manage', $context)) { if (!has_capability('moodle/notes:manage', $context)) {
print_error('You may not delete this note'); print_error('nopermissiontodelete', 'notes');
} }
if (data_submitted() && confirm_sesskey()) { if (data_submitted() && confirm_sesskey()) {
@ -38,7 +38,7 @@ if (data_submitted() && confirm_sesskey()) {
if (note_delete($noteid)) { if (note_delete($noteid)) {
add_to_log($note->courseid, 'notes', 'delete', 'index.php?course='.$note->courseid.'&amp;user='.$note->userid . '#note-' . $note->id , 'delete note'); add_to_log($note->courseid, 'notes', 'delete', 'index.php?course='.$note->courseid.'&amp;user='.$note->userid . '#note-' . $note->id , 'delete note');
} else { } else {
print_error('Error occured while deleting post', '', $returnurl); print_error('cannotdeletepost', 'notes', $returnurl);
} }
redirect($returnurl); redirect($returnurl);
} else { } else {

View file

@ -8,17 +8,17 @@
/// locate note information /// locate note information
if (!$note = note_load($noteid)) { if (!$note = note_load($noteid)) {
print_error('Incorrect note id specified'); print_error('invalidid', 'notes');
} }
/// locate course information /// locate course information
if (!$course = $DB->get_record('course', array('id'=>$note->courseid))) { if (!$course = $DB->get_record('course', array('id'=>$note->courseid))) {
print_error('Incorrect course id found'); print_error('invalidcourseid');
} }
/// locate user information /// locate user information
if (!$user = $DB->get_record('user', array('id'=>$note->userid))) { if (!$user = $DB->get_record('user', array('id'=>$note->userid))) {
print_error('Incorrect user id found'); print_error('invaliduserid');
} }
/// require login to access notes /// require login to access notes

View file

@ -27,13 +27,13 @@
/// locate course information /// locate course information
if (!$course = $DB->get_record('course', array('id'=>$courseid))) { if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
print_error('Incorrect course id specified'); print_error('invalidcourseid');
} }
/// locate user information /// locate user information
if ($userid) { if ($userid) {
if (!$user = $DB->get_record('user', array('id'=>$userid))) { if (!$user = $DB->get_record('user', array('id'=>$userid))) {
print_error('Incorrect user id specified'); print_error('invaliduserid');
} }
$filtertype = 'user'; $filtertype = 'user';
$filterselect = $user->id; $filterselect = $user->id;