]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error"
authordongsheng <dongsheng>
Wed, 14 May 2008 08:05:45 +0000 (08:05 +0000)
committerdongsheng <dongsheng>
Wed, 14 May 2008 08:05:45 +0000 (08:05 +0000)
grade/import/csv/index.php
grade/import/key.php
grade/import/xml/fetch.php
grade/import/xml/import.php
lang/en_utf8/error.php

index e4f1edaa47cafb567020ac174fdecba9f22841e2..35e0b62dc8bafc588db299ea2d6d8980b36d8695 100755 (executable)
@@ -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);
             }
         }
     }
index c4426db2d7d51c22860bf8060935c4fc1b973523..ef35bd02797ef4d7b966867e2e60d25912a4dba2 100644 (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;
index a0c1715badac1e0f6bfeeb3005358e921d605308..c115d3c6f6b7eb3d00d5e8df4fe32b5a4cd2fcae 100644 (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);
index f479aa8ca1a501cdf5e4644d228240eecd290169..2f6125b4a4c3eb0e6bb7e6015146254b891b9c76 100644 (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 {
index 1fd6c1d85c20eadd7450eced013d6d6458f1f166..e311c72f6b380ea62e3271880608d81d9a7a4ef6 100644 (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';