Skip to content

Commit

Permalink
"MDL-14129, fix print_error"
Browse files Browse the repository at this point in the history
  • Loading branch information
dongsheng committed May 14, 2008
1 parent 1bb0aa0 commit f39c16e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions grade/import/csv/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
$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")) {
Expand Down Expand Up @@ -195,7 +195,7 @@
} 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);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions grade/import/key.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@

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();
}
Expand All @@ -62,7 +62,7 @@

// 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;
Expand Down
2 changes: 1 addition & 1 deletion grade/import/xml/fetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
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);
Expand Down
4 changes: 2 additions & 2 deletions grade/import/xml/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

$text = download_file_content($url);
if ($text === false) {
print_error('Can not read file');
print_error('cannotreadfile');
}

$error = '';
Expand All @@ -67,7 +67,7 @@
echo 'ok';
die;
} else {
print_error('Grade import error'); //TODO: localize
print_error('cannotimportgrade'); //TODO: localize
}

} else {
Expand Down
6 changes: 6 additions & 0 deletions lang/en_utf8/error.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@
$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\".';
Expand All @@ -74,6 +77,7 @@
$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!';
Expand Down Expand Up @@ -112,6 +116,7 @@
$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';
Expand Down Expand Up @@ -214,6 +219,7 @@
$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';
Expand Down

0 comments on commit f39c16e

Please sign in to comment.