]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error"
authordongsheng <dongsheng>
Thu, 8 May 2008 08:43:17 +0000 (08:43 +0000)
committerdongsheng <dongsheng>
Thu, 8 May 2008 08:43:17 +0000 (08:43 +0000)
backup/backup_check.html
backup/backup_execute.html
backup/backup_form.html
backup/restore_check.html
backup/restore_execute.html
backup/restore_form.html
backup/restore_precheck.html
lang/en_utf8/debug.php
lang/en_utf8/error.php

index f17be59115a37dc341f94882e3eba48f5b7c55ec..feb1d12079cc0022221fcbedc303c90f00838891 100644 (file)
@@ -7,16 +7,16 @@
     if (!empty($course->id)) {
         if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
             if (empty($to)) {
-                print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+                print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
             } else {
                 if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
-                    print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+                    print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
                 }
             }
         }
     } else {
         if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
-            print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+            print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
         }
     }
 
 
     //Check site
     if (!$site = get_site()) {
-        print_error("Site not found!");
+        print_error("siteisnotdefined", 'debug');
     }
     if ($count == 0) {
         notice("No backupable modules are installed!");
     }
 
     if (!execute_sql("DELETE FROM {$CFG->prefix}backup_ids WHERE backup_code = '{$backupprefs->backup_unique_code}'",false)){
-        print_error('Couldn\'t delete previous backup ids.');
+        print_error('cannotdeletebackupids');
     }
 
 ?>
index 2e754d7ab67166bce9ec39c6f1281a63a54ec2d8..bd617878a3af5682af42f60b33301fe96f2a5501 100644 (file)
@@ -7,23 +7,23 @@
     if (!empty($course->id)) {
         if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
             if (empty($to)) {
-                print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+                print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
             } else {
                 if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
-                    print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+                    print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
                 }
             }
         }
     } else {
         if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
-            print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+            print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
         }
     }
 
 
     //Check site
     if (!$site = get_site()) {
-        print_error("Site not found!");
+        print_error("siteisnotdefined", 'debug');
     }
 
     $preferences = new StdClass;
index 16e4004988b76d995f6e015e468941201c6d0328..fc1fe182536075978ef01d6d2cc45afd40968fe8 100644 (file)
@@ -7,22 +7,22 @@
     if (!empty($course->id)) {
         if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $course->id))) {
             if (empty($to)) {
-                print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+                print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
             } else {
                 if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_COURSE, $to))) {
-                    print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+                    print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
                 }
             }
         }
     } else {
         if (!has_capability('moodle/site:backup', get_context_instance(CONTEXT_SYSTEM))) {
-            print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+            print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
         }
     }
 
     //Check site
     if (!$site = get_site()) {
-        print_error("Site not found!");
+        print_error("siteisnotdefined", 'debug');
     }
 
     //Checks for the required files/functions to backup every mod
index 3210bd184d9962c48338af5c53a6ebae40c1a69a..c49b46dbd0155628bd09922c66ed13ae7019a4e3 100644 (file)
@@ -45,7 +45,8 @@
 
     // check for session objects
     if (empty($info) or empty($course_header)) {
-      print_error( 'important information missing from SESSION' );
+      print_error('sessionmissing', 'debug', '', 
+              'info and course_header');
     }
 
 
     //Check admin
     if (!empty($id)) {
         if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
-            print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+            print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
         }
     } else {
         if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
-            print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+            print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
         }
     }
 
     //Check site
     if (!$site = get_site()) {
-        print_error("Site not found!");
+        print_error("siteisnotdefined", 'debug');
     }
 
     //Depending the selected restoreto:
     } else if ((($restore->restoreto == 0 or $restore->restoreto == 1) and ($restore->course_id != 0)) or ($restore->restoreto == 2)) {
         //Final access control check
         if ($restore->course_id == 0 and !user_can_create_courses()) {
-            print_error("You need to be a creator or admin to restore into new course!");
+            print_error("cannotrestoreadminorcreator");
         } else if ($restore->course_id != 0 and !has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $restore->course_id))) {
-            print_error("You need to be an edit teacher or admin to restore into selected course!");
+            print_error("cannotrestoreadminoredit");
         }
         $show_continue_button = true;
         //Check if we've selected any mod's user info and restore->users
index 58757595d377d089af81cd1b7cb1eb924a14896a..1216fe39331e26a96443943174101b0eac83d11a 100644 (file)
     if (!empty($id)) {
         if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
             if (empty($to)) {
-                print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+                print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
             } else {
                 if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to)) 
                     && !has_capability('moodle/site:import',  get_context_instance(CONTEXT_COURSE, $to))) {
-                    print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+                    print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
                 }
             }
         }
     } else {
         if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
-            print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+            print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");
         }
     }
 
     //Check site
     if (!$site = get_site()) {
-        print_error("Site not found!");
+        print_error("siteisnotdefined", 'debug');
     }
     $errorstr = '';
 
     $status = restore_execute($restore,$info,$course_header,$errorstr);
 
     if (!$status) {
-        print_error ("An error has occurred and the restore could not be completed!");
+        print_error ("cannotrestore");
     }
 
     if (empty($restore->importing)) {
index ce89b3a71d3cb18ace54456a6cec208cf8ad279d..a6c5e4e58561818ab50334f2f6d4fc7d2d962f37 100644 (file)
@@ -6,10 +6,10 @@
 
     //Get objects from session
     if (!($info = $SESSION->info)) {
-      print_error( 'info object missing from session' );
+      print_error('sessionmissing' ,'debug', '', 'info');
     }
     if (!($course_header = $SESSION->course_header)) {
-      print_error( 'course_header object missing from session' );
+      print_error('sessionmissing' ,'debug', '', 'course_header');
     }
 
     $restore_gradebook_history =  optional_param('restore_gradebook_history', 0, PARAM_INT);
     //Check admin
     if (!empty($id)) {
         if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
-            print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+            print_error('cannotuseadminadminorteacher', '', '$CFG->wwwroot/login/index.php');
         }
     } else {
         if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
-            print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+            print_error('cannotuseadmin', '', '$CFG->wwwroot/login/index.php');
         }
     }
 
     //Check site
     if (!$site = get_site()) {
-        print_error("Site not found!");
+        print_error("siteisnotdefined", 'debug');
     }
 
     //Checks for the required files/functions to restore every mod
index b0e052de49d4a28c7f38aa433d0f1b6b24dd3833..84b7eb44e2db98e37fe17a473c2763e8a822b1d4 100644 (file)
     if (!empty($id)) {
         if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $id))) {
             if (empty($to)) {
-                print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+                print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
             } else {
                 if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_COURSE, $to))
                     && !has_capability('moodle/site:import',  get_context_instance(CONTEXT_COURSE, $to))) {
-                    print_error("You need to be a teacher or admin user to use this page.", '', "$CFG->wwwroot/login/index.php");
+                    print_error("cannotuseadminadminorteacher", '', "$CFG->wwwroot/login/index.php");
                 }
             }
         }
     } else {
         if (!has_capability('moodle/site:restore', get_context_instance(CONTEXT_SYSTEM))) {
-            print_error("You need to be an admin user to use this page.", '', "$CFG->wwwroot/login/index.php");   
+            print_error("cannotuseadmin", '', "$CFG->wwwroot/login/index.php");   
         }
     }
 
     //Check site
     if (!$site = get_site()) {
-        print_error("Site not found!");
+        print_error("siteisnotdefined", 'debug');
     }
 
     $errorstr = '';
@@ -42,7 +42,7 @@
     $status = restore_precheck($id,$file,$errorstr);
  
     if (!$status) {
-        print_error("An error occured");
+        print_error("pleasereport");
     }
 
 ?>
index 9369db2c8aaa4b1dc517fdb3f1a77c6548aa2cac..c0a00d71b742ae8b28e3bdabe81ff8ecbf8f1251 100644 (file)
@@ -22,6 +22,7 @@ $string['phpvaron'] = 'The PHP server variable \'$a[0]\' is not turned On - $a[1
 $string['prefixcannotbeempty'] = 'Table prefix \"$a[0]\" cannot be empty for your target DB ($a[1])';
 $string['prefixlimit'] = 'Table prefix \"$a\" maximum allowed length for Oracle DBs is 2cc.';
 $string['withoutversion'] = 'Main version.php was not readable or specified';
+$string['sessionmissing'] = '$a object missing from session';
 $string['siteisnotdefined'] = 'Site is not defined!';
 
 ?>
index 7aa9496c746442db7816e15c3965d8af2079c384..2e8ab5aebe4ed4d4ddcd6c058b9dc95bb3561fa5 100644 (file)
@@ -25,6 +25,7 @@ $string['cannotcreatesitedir'] = 'Cannot create site folder. The site administra
 $string['cannotcreateorfindstructs'] = 'Error finding or creating section structures for this course';
 $string['cannotcustomizelocallang'] = 'You do not have permission to customize the strings translation.  This permission is controlled by the capability "moodle/site:langeditlocal". Set this capability to allow you to edit local language packages in case you want to modify translations for your site.';
 $string['cannotdeletelangcache'] = 'Language cache can not be deleted, please fix permissions in dataroot/cache/languages!';
+$string['cannotdeletebackupids'] = 'Couldn\'t delete previous backup ids.';
 $string['cannotdeletecourse'] = 'You do not have the permission to delete this course.';
 $string['cannotdeleterole'] = 'It can not be deleted, because $a';
 $string['cannotdeleterolewithid'] = 'Could not delete role with ID $a';
@@ -47,6 +48,7 @@ $string['cannotmetacourse'] = 'Could not add the selected course to this meta co
 $string['cannotoverridebaserole'] = 'Can not override base role capabilities';
 $string['cannotreadtmpfile'] = 'Error reading temporary 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\".';
 $string['cannotsavemd5file'] = 'Cannot save md5 file.';
 $string['cannotsavezipfile'] = 'Cannot save ZIP file.';
@@ -65,6 +67,8 @@ $string['cannotupdatesubcate'] = 'Could not update a child category!';
 $string['cannotupdatesubcourse'] = 'Could not update a child course!';
 $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!';
+$string['cannotrestoreadminoredit'] = 'You need to be a edit teacher or admin user to restore into selected course!';
 $string['cannotusepage'] = 'Only teacher and administrator can use this page.';
 $string['cannotviewprofile'] = 'You can not view the profile of this user.';
 $string['cantunenrollfrommetacourse'] = 'You can not unenrol from this meta course.';