MDL-14129, fix print_error
authordongsheng <dongsheng>
Sat, 26 Apr 2008 11:02:51 +0000 (11:02 +0000)
committerdongsheng <dongsheng>
Sat, 26 Apr 2008 11:02:51 +0000 (11:02 +0000)
course/user.php
course/view.php
lang/en_utf8/error.php

index 8768086eacdaa8ec498f9d8f56bbe3c56f4fa5fc..8806e66139d9598e1bfed6e841adbe9b456435e3 100644 (file)
     $perpage = optional_param('perpage', 100, PARAM_INT);
 
     if (! $course = get_record("course", "id", $id)) {
-        print_error("Course id is incorrect.");
+        print_error('invalidcourseid', 'error');
     }
 
     if (! $user = get_record("user", "id", $user)) {
-        print_error("User ID is incorrect");
+        print_error('invaliduserid', 'error');
     }
 
     //require_login($course);
@@ -29,7 +29,7 @@
 
     // if in either context, we can read report, then we can proceed
     if (!(has_capability('moodle/site:viewreports', $coursecontext) or ($course->showreports and $USER->id == $user->id) or has_capability('moodle/user:viewuseractivitiesreport', $personalcontext))) {
-        print_error("You are not allowed to look at this page");
+        print_error('nopermissiontoviewpage', 'error');
     }
 
     add_to_log($course->id, "course", "user report", "user.php?id=$course->id&amp;user=$user->id&amp;mode=$mode", "$user->id");
         case 'stats':
 
             if (empty($CFG->enablestats)) {
-                print_error("Stats is not enabled.");
+                print_error('statsdisable', 'error');
             }
 
             require_once($CFG->dirroot.'/lib/statslib.php');
index 60b75475262c891a4448cbd867881285deb6ab8b..5fc275c5f20f7cb3612d4bedf698a92b2263b949 100644 (file)
 
 
     if (empty($id) && empty($name) && empty($idnumber)) {
-        print_error("Must specify course id, short name or idnumber");
+        print_error('unspecifycourseid', 'error');
     }
 
     if (!empty($name)) {
         if (! ($course = get_record('course', 'shortname', $name)) ) {
-            print_error('Invalid short course name');
+            print_error('invalidcoursenameshort', 'error');
         }
     } else if (!empty($idnumber)) {
         if (! ($course = get_record('course', 'idnumber', $idnumber)) ) {
-            print_error('Invalid course idnumber');
+            print_error('invalidcourseid', 'error');
         }
     } else {
         if (! ($course = get_record('course', 'id', $id)) ) {
-            print_error('Invalid course id');
+            print_error('invalidcourseid', 'error');
         }
     }
 
             $section->id = insert_record('course_sections', $section);
         }
         if (! $sections = get_all_sections($course->id) ) {      // Try again
-            print_error('Error finding or creating section structures for this course');
+            print_error('cannotcreateorfindstructs', 'error');
         }
     }
 
index 811b5dd69186286af5734c221fd6720e81bcf061..b8d3e844bf7cf040f6d707fbe985aa0882b739d5 100644 (file)
@@ -17,6 +17,7 @@ $string['cannotcreatelangdir'] = 'Cannot create lang dir.';
 $string['cannotcreatelangbase'] = 'Error: Could not create base lang directory.';
 $string['cannotcreatetempdir'] = 'Cannot create temp dir.';
 $string['cannotcreatesitedir'] = 'Cannot create site folder. The site administrator needs to fix the file permissions.';
+$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['cannotdeleterole'] = 'It can not be deleted, because $a';
@@ -89,6 +90,8 @@ $string['invalidaccessparameter'] = 'Invalid access parameter.';
 $string['invalidcourse'] = 'Invalid course';
 $string['invalidcourseid'] = 'You are tring to use an invalid course ID: ($a)';
 $string['invalidcoursemodule'] = 'Bad course module ID';
+$string['invalidcoursenameshort'] = 'Invalid short course name';
+$string['invalidevent'] = 'Invalid event';
 $string['invalidfieldname'] = '\"$a\" is not a valid field name';
 $string['invalidfiletype'] = '\"$a\" is not a valid file type';
 $string['invalidgroupid'] = 'INcorrect group id specified.';
@@ -134,6 +137,7 @@ $string['nousers'] = 'No such user!';
 $string['nonmeaningfulcontent'] = 'Non meaningful content';
 $string['noparticipatorycms'] = 'Sorry, but you have no participatory course modules to report on.';
 $string['nopermissions'] = 'Sorry, but you do not currently have permissions to do that ($a)';
+$string['nopermissiontoviewpage'] = 'You are not allowed to look at this patge';
 $string['nosite'] = 'No sites';
 $string['nositeid'] = 'No site ID';
 $string['nostatstodisplay'] = 'There is no available data to display, sorry.';
@@ -157,13 +161,16 @@ $string['sessionipnomatch'] = 'Sorry, but your IP number seems to have changed f
 $string['statscatchupmode'] = 'Statistics is currently in catchup mode. So far $a->daysdone day(s) have been processed and $a->dayspending are pending. Check back soon!';
 $string['tagnotfound'] = 'The specified tag was not found in the database';
 $string['unicodeupgradeerror'] = 'Sorry, but your database is not already in Unicode, and this version of Moodle is not able to migrate your database to Unicode.  Please upgrade to Moodle 1.7.x first and perform the Unicode migration from the Admin page.  After that is done you should be able to migrate to Moodle $a';
+$string['unspecifycourseid'] = 'Must specify course id, short name or idnumber';
 $string['statsnodata'] = 'There is no available data for that combination of course and time period.';
+$string['statsdisable'] = 'Stats is not enabled.';
 $string['unknowaction']= 'Unknown action!';
 $string['unknowncourse'] = 'Unknown course named \"$a\"';
 $string['unknowncourseidnumber'] = 'Unknown Course ID \"$a\"';
 $string['unknowngroup'] = 'Unknown group \"$a\"';
 $string['unknownrole'] = 'Unknown role \"$a\"';
 $string['unknownuseraction'] = 'Sorry, I do not understand this user action.';
+$string['unsupportedevent'] = 'Unsupported event type';
 $string['urlnotdefinerss'] = 'URL not defined for rss feed';
 $string['userautherror'] = 'Unknown auth plugin.';
 $string['userauthunsupported'] = 'Auth plugin not supported here.';