"MDL-14129, fix print_error"

This commit is contained in:
dongsheng
2008-05-14 08:05:45 +00:00
parent 1bb0aa0f06
commit f39c16e0f4
5 changed files with 16 additions and 10 deletions
+2 -2
View File
@@ -160,7 +160,7 @@ if ($formdata = $mform->get_data()) {
$filename = $CFG->dataroot.'/temp/gradeimport/cvs/'.$USER->id.'/'.$importcode;
if (!file_exists($filename)) {
print_error('error processing upload file');
print_error('cannotuploadfile');
}
if ($fp = fopen($filename, "r")) {
@@ -195,7 +195,7 @@ if ($formdata = $mform->get_data()) {
} else {
// collision
unlink($filename); // needs to be uploaded again, sorry
print_error('mapping collision detected, 2 fields maps to the same grade item '.$j);
print_error('cannotmapfield', '', '', $j);
}
}
}
+5 -5
View File
@@ -34,22 +34,22 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
if ($id) {
if (!$key = get_record('user_private_key', 'id', $id)) {
print_error('Group ID was incorrect');
print_error('invalidgroupid');
}
if (empty($courseid)) {
$courseid = $key->instance;
} else if ($courseid != $key->instance) {
print_error('Course ID was incorrect');
print_error('invalidcourseid');
}
if (!$course = get_record('course', 'id', $courseid)) {
print_error('Course ID was incorrect');
print_error('invalidcourseid');
}
} else {
if (!$course = get_record('course', 'id', $courseid)) {
print_error('Course ID was incorrect');
print_error('invalidcourseid');
}
$key = new object();
}
@@ -62,7 +62,7 @@ require_capability('moodle/grade:import', $context);
// extra security check
if (!empty($key->userid) and $USER->id != $key->userid) {
print_error('You are not owner of this key');
print_error('notownerofkey');
}
$returnurl = $CFG->wwwroot.'/grade/import/keymanager.php?id='.$course->id;
+1 -1
View File
@@ -34,7 +34,7 @@ if (!$course = get_record('course', 'id', $id)) {
require_user_key_login('grade/import', $id); // we want different keys for each course
if (empty($CFG->gradepublishing)) {
print_error('Grade publishing disabled');
print_error('gradepubdisable');
}
$context = get_context_instance(CONTEXT_COURSE, $id);
+2 -2
View File
@@ -53,7 +53,7 @@ if (function_exists('apache_child_terminate')) {
$text = download_file_content($url);
if ($text === false) {
print_error('Can not read file');
print_error('cannotreadfile');
}
$error = '';
@@ -67,7 +67,7 @@ if ($importcode !== false) {
echo 'ok';
die;
} else {
print_error('Grade import error'); //TODO: localize
print_error('cannotimportgrade'); //TODO: localize
}
} else {
+6
View File
@@ -45,13 +45,16 @@ $string['cannotfindinfo'] = 'Cannot find info for: \"$a\"';
$string['cannotfindhelp'] = 'Cannot find \"$a\" language help files';
$string['cannotfindlang'] = 'Cannot find \"$a\" language pack!';
$string['cannotfindsite'] = 'Cannot find site-level course';
$string['cannotimportgrade'] = 'Grade import error';
$string['cannotgradeuser'] = 'Can not grade this user';
$string['cannotmapfield'] = 'mapping collision detected, 2 fields maps to the same grade item $a';
$string['cannotmarktopic'] = 'Could not mark that topic for this course';
$string['cannotmoverolewithid'] = 'Cannot move role with ID $a';
$string['cannotmetacourse'] = 'Cannot not add the selected course to this meta course!';
$string['cannotoverridebaserole'] = 'Can not override base role capabilities';
$string['cannotopencsv'] = 'Cannot open csv file';
$string['cannotreadtmpfile'] = 'Error reading temporary file';
$string['cannotreadfile'] = 'Can not read file';
$string['cannotremovefrommeta'] = 'Could not remove the selected course from this meta course!';
$string['cannotrestore'] = 'An error has occurred and the restore could not be completed!';
$string['cannotsavefile'] = 'Cannot save the file \"$a\".';
@@ -74,6 +77,7 @@ $stirng['cannotupdaterss'] = 'Cannot update rss';
$string['cannotupdatesummary'] = 'Could not update the summary!';
$string['cannotupdatesubcate'] = 'Could not update a child category!';
$string['cannotupdatesubcourse'] = 'Could not update a child course!';
$string['cannotuploadfile'] = 'error processing upload file';
$string['cannotuseadmin'] = 'You need to be an admin user to use this page.';
$string['cannotuseadminadminorteacher'] = 'You need to be a teacher or admin user to use this page.';
$string['cannotrestoreadminorcreator'] = 'You need to be a creator or admin user to restore into new course!';
@@ -112,6 +116,7 @@ $string['filemismatch'] = 'Non-core filename mismatch. The file \"$a[0]\" should
$string['filternotinstalled'] = 'Filter $a is not currently installed';
$string['filternotactive'] = 'Filter $a is not currently active';
$string['forumblockingtoomanyposts'] = 'You have exceeded the posting threshold set for this forum.';
$string['gradepubdisable'] = 'Grade publishing disabled';
$string['groupalready'] = 'User already belongs to group $a';
$string['groupexistforcourse'] = 'Group \"$a\" already exists for this course';
$string['groupnotaddederror'] = 'Group \"$a\" not added';
@@ -214,6 +219,7 @@ $string['nofolder'] = 'Requested directory does not exist.';
$string['nostatstodisplay'] = 'There is no available data to display, sorry.';
$string['notavailable'] = 'That is not currently available';
$string['notmemberofgroup'] = 'You are not a member of this course group';
$string['notownerofkey'] = 'You are not owner of this key';
$string['onlyadmins'] = 'Only administrators can do that.';
$string['onlyeditingteachers'] = 'Only editing teachers can do that.';
$string['onlyeditown'] = 'You can only edit your own information';