]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error call under course/, see tracker"
authordongsheng <dongsheng>
Wed, 7 May 2008 06:02:51 +0000 (06:02 +0000)
committerdongsheng <dongsheng>
Wed, 7 May 2008 06:02:51 +0000 (06:02 +0000)
17 files changed:
course/category.php
course/delete.php
course/edit.php
course/editcategory.php
course/editsection.php
course/importstudents.php
course/index.php
course/info.php
course/lib.php
course/loginas.php
course/mod.php
course/modedit.php
course/request.php
course/reset.php
course/scales.php
lang/en_utf8/debug.php
lang/en_utf8/error.php

index 22904d0f90e1787351ac2ef491f79a3bf4a529b2..1a1c23f4917ab59a522f8ad67a9fde73b7588902 100644 (file)
     }
 
     if (!$site = get_site()) {
-        print_error("Site isn't defined!");
+        print_error("siteisnotdefined", 'debug');
     }
 
     if (empty($id)) {
-        print_error("Category not known!");
+        print_error("unknowcategory");
     }
 
     if (!$context = get_context_instance(CONTEXT_COURSECAT, $id)) {
-        print_error("Category not known!");
+        print_error("unknowcategory");
     }
 
     if (!$category = get_record("course_categories", "id", $id)) {
-        print_error("Category not known!");
+        print_error("unknowcategory");
     }
 
     if (has_capability('moodle/course:create', $context)) {
             require_capability('moodle/category:update', get_context_instance(CONTEXT_COURSECAT, $moveto));
 
             if (! $destcategory = get_record("course_categories", "id", $data->moveto)) {
-                print_error("Error finding the category");
+                print_error("cannotfindcategory", '', '', $data->moveto);
             }
 
 
index 697edf06885ec098530eae8aa3f0bfb34b57fa77..9f07a5f8f9aa2023295d3b774d918e5c7a3b1881 100644 (file)
@@ -9,11 +9,11 @@
     require_login();
 
     if (!can_delete_course($id)) {
-        print_error('You do not have the permission to delete this course.');
+        print_error('cannotdeletecourse');
     }
 
     if (!$site = get_site()) {
-        print_error("Site not found!");
+        print_error("siteisnotdefined", 'debug');
     }
 
     $strdeletecourse = get_string("deletecourse");
@@ -21,7 +21,7 @@
     $strcategories = get_string("categories");
 
     if (! $course = get_record("course", "id", $id)) {
-        print_error("Course ID was incorrect (can't find it)");
+        print_error("invalidcourseid");
     }
 
     $category = get_record("course_categories", "id", $course->category);
@@ -49,7 +49,7 @@
     }
 
     if ($delete != md5($course->timemodified)) {
-        print_error("The check variable was wrong - try again");
+        print_error("invalidmd5");
     }
 
     if (!confirm_sesskey()) {
index 46ded6b77ce7fc131c8f43e83e08666f29f6b0a4..e0f66d77b3aa64216323d81cb6844df8f6ee87a9 100644 (file)
 
         if($id == SITEID){
             // don't allow editing of  'site course' using this from
-            print_error('You cannot edit the site course using this form');
+            print_error('cannoteditsiteform');
         }
 
         if (!$course = get_record('course', 'id', $id)) {
-            print_error('Course ID was incorrect');
+            print_error('invalidcourseid');
         }
         require_login($course->id);
         $category = get_record('course_categories', 'id', $course->category);
         $course = null;
         require_login();
         if (!$category = get_record('course_categories', 'id', $categoryid)) {
-            print_error('Category ID was incorrect');
+            print_error('unknowcategory');
         }
         require_capability('moodle/course:create', get_context_instance(CONTEXT_COURSECAT, $category->id));
     } else {
         require_login();
-        print_error('Either course id or category must be specified');
+        print_error('needcoursecategroyid');
     }
 
 /// prepare course
index 596508bf9af51a9cb2157e81611a62771b772532..becceb67d09a4b9e1a55b71b3155d2e8efc79570 100644 (file)
@@ -22,7 +22,7 @@ $categoryupdate = optional_param('categoryupdate', 0, PARAM_BOOL); // Enables th
 $resort         = optional_param('resort', 0, PARAM_BOOL);
 
 if (!$site = get_site()) {
-    print_error("Site isn't defined!");
+    print_error("siteisnotdefined");
 }
 
 if ($categoryadd) { // Show Add category form: if $id is given, it is used as the parent category 
@@ -33,7 +33,7 @@ if ($categoryadd) { // Show Add category form: if $id is given, it is used as th
     $strtitle = get_string("editcategorysettings");
     $context = get_context_instance(CONTEXT_COURSECAT, $id); 
     if (!$category = get_record("course_categories", "id", $id)) {
-        print_error("Category not known!");
+        print_error("unknowcategory");
     }
 }
 
@@ -83,7 +83,7 @@ if ($mform->is_cancelled()){
         }
 
         if (!update_record('course_categories', $newcategory)) {
-            print_error( "Could not update the category '$newcategory->name' ");
+            print_error( "cannotupdatecategory", '', '', $newcategory->name);
         } else {
             if ($newcategory->parent == 0) {
                 $redirect_link = 'index.php?categoryedit=on';
@@ -210,7 +210,7 @@ if ($id && !$categoryadd && !$categoryupdate && false) {
             require_capability('moodle/category:update', get_context_instance(CONTEXT_COURSECAT, $moveto));
 
             if (!$destcategory = get_record("course_categories", "id", $data->moveto)) {
-                print_error("Error finding the destination category");
+                pritn_error("unknowcategory");
             } 
             // TODO function to move the category
         }
index 7bb21abfb56a6c2e48f2d844f3c214edea054f02..13f9f0a0b3e17e9554f94632c1c48e2adf22b152 100644 (file)
@@ -7,11 +7,11 @@
     $id = required_param('id',PARAM_INT);    // Week ID
 
     if (! $section = get_record("course_sections", "id", $id)) {
-        print_error("Course section is incorrect");
+        print_error("sectionnotexist");
     }
 
     if (! $course = get_record("course", "id", $section->course)) {
-        print_error("Could not find the course!");
+        print_error("invalidcourseid");
     }
 
     require_login($course->id);
@@ -25,7 +25,7 @@
         $timenow = time();
 
         if (! set_field("course_sections", "summary", $form->summary, "id", $section->id)) {
-            print_error("Could not update the summary!");
+            print_error("cannotupdatesummary");
         }
 
         add_to_log($course->id, "course", "editsection", "editsection.php?id=$section->id", "$section->section");
index f9d940599f42c7ccf21e8cf9ab67b54a0fb9ae91..594a41e48bc31a2db944e17236432a7b92610341 100644 (file)
@@ -20,7 +20,7 @@
     }
 
     if (! $course = get_record("course", "id", $id)) {
-        print_error("Course ID was incorrect (can't find it)");
+        print_error("invalidcourseid");
     }
 
     require_login($course->id);
@@ -65,7 +65,7 @@
                 $addcourse = clean_param($addcourse, PARAM_INT);
                 set_time_limit(180);
                 if (!add_to_metacourse($course->id,$addcourse)) {
-                    print_error("Could not add the selected course to this meta course!");
+                    print_error("cannotmetacourse");
                 }
             }
         } else if ($remove and !empty($frm->removeselect) and confirm_sesskey()) {
@@ -73,7 +73,7 @@
                 set_time_limit(180);
                 $removecourse = clean_param($removecourse, PARAM_INT);
                 if (! remove_from_metacourse($course->id,$removecourse)) {
-                    print_error("Could not remove the selected course from this meta course!");
+                    print_error("cannotremovefrommeta");
                 }
             }
         } else if ($showall and confirm_sesskey()) {
index fd8a4300d9ad57589f84ed9009418ba54972a247..4e09ab5cb93b7bd2dd05f5f025568370de206cc6 100644 (file)
@@ -19,7 +19,7 @@
     $context = $sysctx;
 
     if (!$site = get_site()) {
-        print_error('Site isn\'t defined!');
+        print_error('siteisnotdefined', 'debug');
     }
 
     if ($CFG->forcelogin) {
                 if ($childcats = get_records('course_categories', 'parent', $deletecat->id)) {
                     foreach ($childcats as $childcat) {
                         if (! set_field('course_categories', 'parent', $deletecat->parent, 'id', $childcat->id)) {
-                            print_error('Could not update a child category!', 'index.php');
+                            print_error('cannotupdatesubcate', '', 'index.php');
                         }
                     }
                 }
                     if ($childcourses = get_records('course', 'category', $deletecat->id)) {
                         foreach ($childcourses as $childcourse) {
                             if (! set_field('course', 'category', $deletecat->parent, 'id', $childcourse->id)) {
-                                print_error('Could not update a child course!', 'index.php');
+                                print_error('cannotupdatesubcourse', '', 'index.php');
                             }
                         }
                     }
         unset($tempcat);
         $tempcat->name = get_string('miscellaneous');
         if (!$tempcat->id = insert_record('course_categories', $tempcat)) {
-            print_error('Serious error: Could not create a default category!');
+            print_error('cannotsetupcategory');
         }
         $tempcat->context = get_context_instance(CONTEXT_COURSECAT, $tempcat->id);
         mark_context_dirty('/'.SYSCONTEXTID);
index e3d1e7a92b2806dc145c4394ab9123be05aaf799..346ffc9cad5baf8c38d5c25c6dc817fe911b70b5 100644 (file)
@@ -9,16 +9,16 @@
     $name = optional_param('name', false, PARAM_RAW); // Course short name
 
     if (!$id and !$name) {
-        print_error("Must specify course id or short name");
+        print_error("unspecifycourseid");
     }
 
     if ($name) {
         if (! $course = get_record("course", "shortname", $name) ) {
-            print_error("That's an invalid short course name");
+            print_error("invalidshortname");
         }
     } else {
         if (! $course = get_record("course", "id", $id) ) {
-            print_error("That's an invalid course id");
+            print_error("invalidcourseid");
         }
     }
 
index 8d6cf53099cdd8090d2f0d778feec88ef84ba3e4..54b944198e7c29be7bd669c8f4daea6154c13378 100644 (file)
@@ -1184,7 +1184,7 @@ function get_all_mods($courseid, &$mods, &$modnames, &$modnamesplural, &$modname
         }
         asort($modnames, SORT_LOCALE_STRING);
     } else {
-        print_error("No modules are installed!");
+        print_error("nomodules", 'debug');
     }
 
     if ($rawmods = get_course_mods($courseid)) {
@@ -1948,7 +1948,7 @@ function print_my_moodle() {
     global $USER, $CFG;
 
     if (empty($USER->id)) {
-        print_error("It shouldn't be possible to see My Moodle without being logged in.");
+        print_error('nopermissions', '', '', 'See My Moodle');
     }
 
     $courses  = get_my_courses($USER->id, 'visible DESC,sortorder ASC', array('summary'));
@@ -2539,7 +2539,7 @@ function course_in_meta ($course) {
  */
 function print_standard_coursemodule_settings($form, $features=null) {
     if (! $course = get_record('course', 'id', $form->course)) {
-        print_error("This course doesn't exist");
+        print_error("invalidcourseid");
     }
     print_groupmode_setting($form, $course);
     if (!empty($features->groupings)) {
@@ -2555,12 +2555,12 @@ function print_groupmode_setting($form, $course=NULL) {
 
     if (empty($course)) {
         if (! $course = get_record('course', 'id', $form->course)) {
-            print_error("This course doesn't exist");
+            print_error("invalidcourseid");
         }
     }
     if ($form->coursemodule) {
         if (! $cm = get_record('course_modules', 'id', $form->coursemodule)) {
-            print_error("This course module doesn't exist");
+            print_error("cmunknown");
         }
         $groupmode = groups_get_activity_groupmode($cm);
     } else {
@@ -2588,12 +2588,12 @@ function print_grouping_settings($form, $course=NULL) {
 
     if (empty($course)) {
         if (! $course = get_record('course', 'id', $form->course)) {
-            print_error("This course doesn't exist");
+            print_error("invalidcourseid");
         }
     }
     if ($form->coursemodule) {
         if (! $cm = get_record('course_modules', 'id', $form->coursemodule)) {
-            print_error("This course module doesn't exist");
+            print_error("cmunknown");
         }
     } else {
         $cm = null;
@@ -2627,7 +2627,7 @@ function print_grouping_settings($form, $course=NULL) {
 function print_visible_setting($form, $course=NULL) {
     if (empty($course)) {
         if (! $course = get_record('course', 'id', $form->course)) {
-            print_error("This course doesn't exist");
+            print_error("invalidcourseid");
         }
     }
     if ($form->coursemodule) {
index 91f8efc60fd3a208e5a764c4133d52848023c631..26bd9b19e6a310f178ea58b6011d586fa1354a9d 100644 (file)
@@ -46,7 +46,7 @@
     }
 
     if (! $course = get_record('course', 'id', $id)) {
-        print_error("Course ID was incorrect");
+        print_error("invalidcourseid");
     }
 
 /// User must be logged in
@@ -65,7 +65,7 @@
         require_login($course);
         require_capability('moodle/user:loginas', $coursecontext);
         if (!has_capability('moodle/course:view', $coursecontext, $userid, false)) {
-            print_error('This user is not in this course!');
+            print_error('usernotincourse');
         }
         if (has_capability('moodle/site:doanything', $coursecontext, $userid, false)) {
             print_error('nologinas');
index 4e8b2ee312537fc07f6bc914cc18e6dc7522ae25..3ceb89addfbaa971daa60b68484315b82cc25c6a 100644 (file)
@@ -58,7 +58,7 @@
                                 {$CFG->prefix}modules md
                            WHERE cm.id = '$update' AND
                                  md.id = cm.module")){
-            print_error('Invalid course module id!');
+            print_error('invalidcourseid');
         }
         $returntomod = optional_param('return', 0, PARAM_BOOL);
         if (file_exists("../mod/$modname/mod_form.php")) {
 
         if (empty($mod->coursemodule)) { //add
             if (! $course = get_record("course", "id", $mod->course)) {
-                print_error("This course doesn't exist");
+                print_error("invalidcourse");
             }
             $mod->instance = '';
             $mod->coursemodule = '';
         } else { //delete and update
             if (! $cm = get_record("course_modules", "id", $mod->coursemodule)) {
-                print_error("This course module doesn't exist");
+                print_error("cmunknown");
             }
 
             if (! $course = get_record("course", "id", $cm->course)) {
-                print_error("This course doesn't exist");
+                print_error("invalidcourseid");
             }
             $mod->instance = $cm->instance;
             $mod->coursemodule = $cm->id;
@@ -99,7 +99,7 @@
         if (file_exists($modlib)) {
             include_once($modlib);
         } else {
-            print_error("This module is missing important code! ($modlib)");
+            print_error('modulemissingcode', '', '', $modlib);
         }
         $addinstancefunction    = $mod->modulename."_add_instance";
         $updateinstancefunction = $mod->modulename."_update_instance";
                         include_once($moderr);
                         die;
                     }
-                    print_error("Could not update the $mod->modulename", '', "view.php?id=$course->id");
+                    print_error('cannotupdatemod', '', 'view.php?id=$course->id', $mod->modulename);
                 }
                 if (is_string($return)) {
                     print_error($return, '', "view.php?id=$course->id");
             case "add":
 
                 if (!course_allowed_module($course,$mod->modulename)) {
-                    print_error("This module ($mod->modulename) has been disabled for this particular course");
+                    print_error('moduledisable', '', '', $mod->modulename);
                 }
 
                 if (!isset($mod->name) || trim($mod->name) == '') {
                         include_once($moderr);
                         die;
                     }
-                    print_error("Could not add a new instance of $mod->modulename", '', "view.php?id=$course->id");
+                    print_error('cannotaddnewmodule', '', "view.php?id=$course->id", $mod->modulename);
                 }
                 if (is_string($return)) {
                     print_error($return, '', "view.php?id=$course->id");
                 // to each other, so we have to update one of them twice.
 
                 if (! $mod->coursemodule = add_course_module($mod) ) {
-                    print_error("Could not add a new course module");
+                    print_error("cannotaddcoursemodule");
                 }
                 if (! $sectionid = add_mod_to_section($mod) ) {
-                    print_error("Could not add the new course module to that section");
+                    print_error("cannotaddcmtosection");
                 }
 
                 if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
-                    print_error("Could not update the course module with the correct section");
+                    print_error("cannotupdatecm");
                 }
 
                 if (!isset($mod->visible)) {   // We get the section's visible field status
                            "$mod->modulename $mod->instance", $mod->coursemodule);
                 break;
             default:
-                print_error("No mode defined");
+                print_error('unknowaction');
 
         }
 
     if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
 
         if (! $cm = get_record("course_modules", "id", $USER->activitycopy)) {
-            print_error("The copied course module doesn't exist!");
+            print_error('copiedcmnotexist');
         }
 
         if (!empty($movetosection)) {
             if (! $section = get_record("course_sections", "id", $movetosection)) {
-                print_error("This section doesn't exist");
+                print_error("sectionnotexist");
             }
             $beforecm = NULL;
 
         } else {                      // normal moveto
             if (! $beforecm = get_record("course_modules", "id", $moveto)) {
-                print_error("The destination course module doesn't exist");
+                print_error("destinationcmnotexit");
             }
             if (! $section = get_record("course_sections", "id", $beforecm->section)) {
-                print_error("This section doesn't exist");
+                print_error("sectionnotexist");
             }
         }
 
         require_capability('moodle/course:manageactivities', $context);
 
         if (!ismoving($section->course)) {
-            print_error("You need to copy something first!");
+            print_error("needcopy");
         }
 
         moveto_module($cm, $section, $beforecm);
         $id = required_param('id',PARAM_INT);
 
         if (! $cm = get_record("course_modules", "id", $id)) {
-            print_error("This course module doesn't exist");
+            print_error("cmunknown");
         }
 
         require_login($cm->course); // needed to setup proper $COURSE
         }
 
         if (!set_field("course_modules", "indent", $cm->indent, "id", $cm->id)) {
-            print_error("Could not update the indent level on that course module");
+            print_error("cannotupdatelevel");
         }
 
         if (SITEID == $cm->course) {
     } else if (!empty($hide) and confirm_sesskey()) {
 
         if (! $cm = get_record("course_modules", "id", $hide)) {
-            print_error("This course module doesn't exist");
+            print_error("cmunknown");
         }
 
         require_login($cm->course); // needed to setup proper $COURSE
     } else if (!empty($show) and confirm_sesskey()) {
 
         if (! $cm = get_record("course_modules", "id", $show)) {
-            print_error("This course module doesn't exist");
+            print_error("cmunknown");
         }
 
         require_login($cm->course); // needed to setup proper $COURSE
         require_capability('moodle/course:activityvisibility', $context);
 
         if (! $section = get_record("course_sections", "id", $cm->section)) {
-            print_error("This module doesn't exist");
+            print_error("sectionnotexist");
         }
 
         if (! $module = get_record("modules", "id", $cm->module)) {
-            print_error("This module doesn't exist");
+            print_error("moduledoesnotexist");
         }
 
         if ($module->visible and ($section->visible or (SITEID == $cm->course))) {
         $id = required_param( 'id', PARAM_INT );
 
         if (! $cm = get_record("course_modules", "id", $id)) {
-            print_error("This course module doesn't exist");
+            print_error("cmunknown");
         }
 
         require_login($cm->course); // needed to setup proper $COURSE
     } else if (!empty($copy) and confirm_sesskey()) { // value = course module
 
         if (! $cm = get_record("course_modules", "id", $copy)) {
-            print_error("This course module doesn't exist");
+            print_error("cmunknown");
         }
 
         require_login($cm->course); // needed to setup proper $COURSE
         require_capability('moodle/course:manageactivities', $context);
 
         if (! $section = get_record("course_sections", "id", $cm->section)) {
-            print_error("This module doesn't exist");
+            print_error("sectionnotexist");
         }
 
         if (! $module = get_record("modules", "id", $cm->module)) {
-            print_error("This module doesn't exist");
+            print_error("moduledoesnotexist");
         }
 
         if (! $instance = get_record($module->name, "id", $cm->instance)) {
-            print_error("Could not find the instance of this module");
+            print_error("moduleinstancedoesnotexist");
         }
 
         $USER->activitycopy = $copy;
     } else if (!empty($delete) and confirm_sesskey()) {   // value = course module
 
         if (! $cm = get_record("course_modules", "id", $delete)) {
-            print_error("This course module doesn't exist");
+            print_error('cmunknown');
         }
 
         if (! $course = get_record("course", "id", $cm->course)) {
-            print_error("This course doesn't exist");
+            print_error("invalidcourseid");
         }
 
         require_login($cm->course); // needed to setup proper $COURSE
         require_capability('moodle/course:manageactivities', $context);
 
         if (! $module = get_record("modules", "id", $cm->module)) {
-            print_error("This module doesn't exist");
+            print_error("moduledoesnotexist");
         }
 
         if (! $instance = get_record($module->name, "id", $cm->instance)) {
             if (! delete_course_module($cm->id)) {
                 notify("Could not delete the $module->name (coursemodule)");
             }
-            print_error("The required instance of this module didn't exist.  Module deleted.",
-                  "$CFG->wwwroot/course/view.php?id=$course->id");
+            print_error("moduleinstancedoesnotexist",'', 
+                    "$CFG->wwwroot/course/view.php?id=$course->id");
         }
 
         $fullmodulename = get_string("modulename", $module->name);
     } else if (!empty($update) and confirm_sesskey()) {   // value = course module
 
         if (! $cm = get_record("course_modules", "id", $update)) {
-            print_error("This course module doesn't exist");
+            print_error("cmunknown");
         }
 
         if (! $course = get_record("course", "id", $cm->course)) {
-            print_error("This course doesn't exist");
+            print_error("invalidcourseid");
         }
 
         require_login($course->id); // needed to setup proper $COURSE
         require_capability('moodle/course:manageactivities', $context);
 
         if (! $module = get_record("modules", "id", $cm->module)) {
-            print_error("This module doesn't exist");
+            print_error("moduledoesnotexist");
         }
 
         if (! $form = get_record($module->name, "id", $cm->instance)) {
-            print_error("The required instance of this module doesn't exist");
+            print_error("moduleinstancedoesnotexist");
         }
 
         if (! $cw = get_record("course_sections", "id", $cm->section)) {
-            print_error("This course section doesn't exist");
+            print_error("sectionnotexist");
         }
 
         if (isset($return)) {
 
 
         if (! $cm = get_record("course_modules", "id", $duplicate)) {
-            print_error("This course module doesn't exist");
+            print_error("cmunknown");
         }
 
         if (! $course = get_record("course", "id", $cm->course)) {
-            print_error("This course doesn't exist");
+            print_error("invalidcourseid");
         }
 
         require_login($course->id); // needed to setup proper $COURSE
         require_capability('moodle/course:manageactivities', $context);
 
         if (! $module = get_record("modules", "id", $cm->module)) {
-            print_error("This module doesn't exist");
+            print_error("moduledoesnotexist");
         }
 
         if (! $form = get_record($module->name, "id", $cm->instance)) {
-            print_error("The required instance of this module doesn't exist");
+            print_error("moduleinstancedoesnotexist");
         }
 
         if (! $cw = get_record("course_sections", "id", $cm->section)) {
-            print_error("This course section doesn't exist");
+            print_error("sectionnotexist");
         }
 
         if (isset($return)) {
         $section = required_param('section',PARAM_INT);
 
         if (! $course = get_record("course", "id", $id)) {
-            print_error("This course doesn't exist");
+            print_error("invalidcourseid");
         }
 
         if (! $module = get_record("modules", "name", $add)) {
-            print_error("This module type doesn't exist");
+            print_error("moduledoesnotexist");
         }
 
         $context = get_context_instance(CONTEXT_COURSE, $course->id);
         require_capability('moodle/course:manageactivities', $context);
 
         if (!course_allowed_module($course,$module->id)) {
-            print_error("This module has been disabled for this particular course");
+            print_error("moduledisable");
         }
 
         require_login($course->id); // needed to setup proper $COURSE
         }
 
     } else {
-        print_error("No action was specified");
+        print_error("unknowaction");
     }
 
     require_login($course->id); // needed to setup proper $COURSE
index 8d28a2bb46dda2ced395dd982f1031ac1727cbb0..6054a7bc52a8704b0e4903e985ce41c93fc73af9 100644 (file)
@@ -18,7 +18,7 @@
         $course = required_param('course', PARAM_INT);
 
         if (! $course = get_record("course", "id", $course)) {
-            print_error("This course doesn't exist");
+            print_error("invalidcourseid");
         }
 
         require_login($course);
         require_capability('moodle/course:manageactivities', $context);
 
         if (! $module = get_record("modules", "name", $add)) {
-            print_error("This module type doesn't exist");
+            print_error("moduledoesnotexist");
         }
 
         $cw = get_course_section($section, $course->id);
 
         if (!course_allowed_module($course, $module->id)) {
-            print_error("This module has been disabled for this particular course");
+            print_error("moduledisable");
         }
 
         $cm = null;
         $navlinksinstancename = '';
     } else if (!empty($update)) {
         if (! $cm = get_record("course_modules", "id", $update)) {
-            print_error("This course module doesn't exist");
+            print_error("cmunknown");
         }
 
         if (! $course = get_record("course", "id", $cm->course)) {
-            print_error("This course doesn't exist");
+            print_error("invalidcourseid");
         }
 
         require_login($course); // needed to setup proper $COURSE
         require_capability('moodle/course:manageactivities', $context);
 
         if (! $module = get_record("modules", "id", $cm->module)) {
-            print_error("This module doesn't exist");
+            print_error("moduledoesnotexist");
         }
 
         if (! $form = get_record($module->name, "id", $cm->instance)) {
-            print_error("The required instance of this module doesn't exist");
+            print_error("moduleinstancedoesnotexist");
         }
 
         if (! $cw = get_record("course_sections", "id", $cm->section)) {
-            print_error("This course section doesn't exist");
+            print_error("sectionnotexist");
         }
 
         $form->coursemodule     = $cm->id;
             $CFG->pagepath .= '/mod';
         }
     } else {
-        print_error('Invalid operation.');
+        print_error('invalidaction');
     }
 
     $modmoodleform = "$CFG->dirroot/mod/$module->name/mod_form.php";
         require_once($modmoodleform);
 
     } else {
-        print_error('No formslib form description file found for this activity.');
+        print_error('noformdesc');
     }
 
     $modlib = "$CFG->dirroot/mod/$module->name/lib.php";
     if (file_exists($modlib)) {
         include_once($modlib);
     } else {
-        print_error("This module is missing important code! ($modlib)");
+        print_error("modulemissingcode", '', '', $modlib);
     }
 
     $mformclassname = 'mod_'.$module->name.'_mod_form';
         if (empty($fromform->coursemodule)) { //add
             $cm = null;
             if (! $course = get_record("course", "id", $fromform->course)) {
-                print_error("This course doesn't exist");
+                print_error("invalidcourseid");
             }
             $fromform->instance = '';
             $fromform->coursemodule = '';
         } else { //update
             if (! $cm = get_record("course_modules", "id", $fromform->coursemodule)) {
-                print_error("This course module doesn't exist");
+                print_error("cmunknown");
             }
 
             if (! $course = get_record("course", "id", $cm->course)) {
-                print_error("This course doesn't exist");
+                print_error("invalidcourseid");
             }
             $fromform->instance = $cm->instance;
             $fromform->coursemodule = $cm->id;
 
             $returnfromfunc = $updateinstancefunction($fromform);
             if (!$returnfromfunc) {
-                print_error("Could not update the $fromform->modulename", '', "view.php?id=$course->id");
+                print_error('cannotupdatemod', '', 'view.php?id=$course->id', $fromform->modulename);
             }
             if (is_string($returnfromfunc)) {
                 print_error($returnfromfunc, '', "view.php?id=$course->id");
             }
 
             if (!course_allowed_module($course,$fromform->modulename)) {
-                print_error("This module ($fromform->modulename) has been disabled for this particular course");
+                print_error('moduledisable', '', '', $fromform->modulename);
             }
 
             $returnfromfunc = $addinstancefunction($fromform);
             if (!$returnfromfunc) {
-                print_error("Could not add a new instance of $fromform->modulename", '', "view.php?id=$course->id");
+                print_error("cannotaddnewmodule", '', "view.php?id=$course->id", $fromform->modulename);
             }
             if (is_string($returnfromfunc)) {
                 print_error($returnfromfunc, '', "view.php?id=$course->id");
             // to each other, so we have to update one of them twice.
 
             if (! $fromform->coursemodule = add_course_module($fromform) ) {
-                print_error("Could not add a new course module");
+                print_error("cannotaddcoursemodule");
             }
             if (! $sectionid = add_mod_to_section($fromform) ) {
-                print_error("Could not add the new course module to that section");
+                print_error("cannotaddcmtosection");
             }
 
             if (! set_field("course_modules", "section", $sectionid, "id", $fromform->coursemodule)) {
-                print_error("Could not update the course module with the correct section");
+                print_error("cannotupdatecm");
             }
 
             // make sure visibility is set correctly (in particular in calendar)
                        "view.php?id=$fromform->coursemodule",
                        "$fromform->instance", $fromform->coursemodule);
         } else {
-            print_error("Data submitted is invalid.");
+            print_error("invaliddata");
         }
 
         // sync idnumber with grade_item
index 7469cfdc4d887f227cd8f9a36ca14acd8f20a757..28e5a56d8ca4b75ed19e91b6f6ce54094f641ab2 100644 (file)
@@ -8,7 +8,7 @@
     require_login();
 
     if (isguest()) {
-        print_error("No guests here!");
+        print_error("noguest");
     }
 
     if (empty($CFG->enablecourserequests)) {
index 61c07c205f0ef68a27d185b4d097628ed2f847d3..9d3e78cecf0a48342efd3dbd6eee1a2132dde9c6 100755 (executable)
@@ -14,7 +14,7 @@ require_once('reset_form.php');
 $id = required_param('id', PARAM_INT);
 
 if (!$course = get_record('course', 'id', $id)) {
-    print_error("Course is misconfigured");
+    print_error("invalidcourseid");
 }
 
 require_login($course);
index 1ea5a7884df6095cb6bc82c4b5449f68c03ab2e2..7250eed67c0680a4182a2e9c39c71e2d489b4aa6 100644 (file)
@@ -7,7 +7,7 @@
     $id   = required_param('id', PARAM_INT);               // course id
 
     if (! $course = get_record("course", "id", $id)) {
-        print_error("Course ID was incorrect");
+        print_error("invalidcourseid");
     }
 
     require_login($course);
index 099cbaf2cd981babd571499895617d8b07f54d21..e148f4f7486bc8c05888e2a084c7587ce814833c 100644 (file)
@@ -21,5 +21,6 @@ $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['siteisnotdefined'] = 'Site is not defined!';
 
 ?>
index b41f0922747d7fd9c60c33c9f7cd54ce7d5ad6dc..a944754f6f30ec705e39b47151f9e686c4ec15a3 100644 (file)
@@ -12,6 +12,9 @@ $string['backuptablefail'] = 'Backup tables could NOT be set up successfully!';
 $string['cannotassignrole'] = 'Cannot assign role in course';
 $string['cannotunassignrolefrom'] = 'Can not unassign this user from role id: $a';
 $string['cannotaddrss'] = 'You do not have permission to add rss feeds';
+$string['cannotaddnewmodule'] = 'Could not add a new instance of $a';
+$string['cannotaddcoursemodule'] = 'Could not add a new course module';
+$string['cannotaddcmtosection'] = 'Could not add the new course module to that section';
 $string['cannotsaveconfig'] = 'Problem saving config \"$a[0]\" as \"$a[1]\" for plugin \"$a[2]\"'; 
 $string['cannotsavefile'] = 'Cannot save the file\"$a[0]\/$a[1]\"!';
 $string['cannotcreatebackupdir'] = 'Could not create backupdata folder.  The site administrator needs to fix the file permissions';
@@ -22,11 +25,13 @@ $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['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';
 $string['cannotdownloadcomponents'] = 'Cannot download components.';
 $string['cannotdownloadlanguageupdatelist'] = 'Cannot download list of language updates from download.moodle.org';
 $string['cannotdownloadzipfile'] = 'Cannot download ZIP file.';
+$string['cannoteditsiteform'] = 'You cannot edit the site course using this form';
 $string['cannoteditpostorblog'] = 'You can not post or edit blogs.';
 $string['cannoteditmasterlang'] = 'You do not have permission to edit master language package. This permission is controlled by the capability "moodle/site:langeditmaster". Set this capability to allow you to edit master language packages in case you are the maintainer of a package.';
 $string['cannotfindcomponent'] = 'Cannot find component.';
@@ -38,16 +43,25 @@ $string['cannotfindhelp'] = 'Cannot find \"$a\" language help files';
 $string['cannotfindlang'] = 'Cannot find \"$a\" language pack!';
 $string['cannotfindsite'] = 'Cannot find site-level course';
 $string['cannotmoverolewithid'] = 'Cannot move role with ID $a';
+$string['cannotmetacourse'] = 'Could not add the selected course to this meta course!';
 $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['cannotsavefile'] = 'Cannot save the file \"$a\".';
 $string['cannotsavemd5file'] = 'Cannot save md5 file.';
 $string['cannotsavezipfile'] = 'Cannot save ZIP file.';
 $string['cannotsetupcategory'] = 'Serious Error! Could not set up a default course category!';
 $string['cannotsetupsite'] = 'Serious Error! Could not set up the site!';
 $string['cannotunzipfile'] = 'Cannot unzip file.';
+$string['cannotupdatecategory'] = 'Could not update the category ($a)';
+$string['cannotupdatecm'] = 'Could not update the course module with the correct section';
+$string['cannotupdatelevel'] = 'Could not update the indent level on that course module';
 $string['cannotupdaterole'] = 'Cannot update role!';
-$stirng['cannotupdaterss'] = 'Cannot ';
+$string['cannotupdatemod'] = 'Could not update the $a';
+$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['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['cannotusepage'] = 'Only teacher and administrator can use this page.';
@@ -57,6 +71,7 @@ $string['cantunenrollinthisrole'] = 'You can not unenrol from this course while
 $string['cmunknown'] = 'Couldn\'t find this course module';
 $string['componentisuptodate'] = 'Component is up to date.';
 $string['confirmsesskeybad'] = 'Sorry, but your session key could not be confirmed to carry out this action.  This security feature prevents against accidental or malicious execution of important functions in your name.  Please make sure you really wanted to execute this function.';
+$string['copiedcmnotexist'] = 'The copied course module does not exist!';
 $string['couldnotassignrole'] = 'A serious but unspecified error occurred while trying to assign a role to you';
 $string['coursegroupunknown'] = 'Course corresponding to group $a not specified';
 $string['csvemptyfile'] = 'The CSV file is empty.';
@@ -64,6 +79,7 @@ $string['csvcolumnduplicates'] = 'Duplicate columns detected.';
 $string['csvfewcolumns'] = 'Not enough columns, please verify the delimiter setting.';
 $string['csvweirdcolumns'] = 'Invalid CSV file format - number of columns is not constant!';
 $string['dbupdatefailed'] = 'Database update failed.';
+$string['destinationcmnotexit'] = 'The destination course module does not exist';
 $string['downloadedfilecheckfailed'] = 'Downloaded file check failed.';
 $string['duplicateusername'] = 'Duplicate username - skiping record';
 $string['errorcleaningdirectory'] = 'Error cleaning directory \"$a\"';
@@ -92,8 +108,9 @@ $string['invalidargorconf'] = 'No valid arguments supplied or incorrect server c
 $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['invalidcoursemodule'] = 'Invalid course module ID';
 $string['invalidcontext'] = 'Invalid context';
+$string['invaliddata'] = 'Data submitted is invalid.';
 $string['invalidevent'] = 'Invalid event';
 $string['invalidcoursenameshort'] = 'Invalid short course name';
 $string['invalidevent'] = 'Invalid event';
@@ -108,12 +125,14 @@ $string['invalidmodulename'] = 'Invalid module name: $a';
 $string['invalidpagesize'] = 'Invalid page size';
 $string['invalidrequest'] = 'Invalid request';
 $string['invalidrole'] = 'Invalid role';
+$string['invalidshortname'] = 'That\'s an invalid short course name';
 $string['invalidurl'] = 'Invalid url';
 $string['invaliduser'] = 'Invalid user';
 $string['invaliduserid'] = 'Invalid user id';
+$string['invalidmd5'] = 'The check variable was wrong - try again';
+$string['invalidxmlfile'] = '\"$a\" is not a valid XML file';
 $string['iplookupfailed'] = 'Can not find geo information about this IP address $a.';
 $string['iplookupprivate'] = 'Can not display lookup of private IP address';
-$string['invalidxmlfile'] = '\"$a\" is not a valid XML file';
 $string['listnopeers'] = 'No peers of item found.';
 $string['listnoitem'] = 'Item not found.';
 $string['listnochildren'] = 'No children of item found.';
@@ -129,15 +148,21 @@ $string['missingfield'] = 'Field \"$a\" is missing.';
 $string['missingrequiredfield'] = 'Some required field is missing';
 $string['mimetexisnotexist'] = 'Your system is not configured to run mimeTeX. You need to download the appropriate executable for you PHP_OS platform from <a href=\"http://moodle.org/download/mimetex/\">http://moodle.org/download/mimetex/</a>, or obtain the C source from <a href=\"http://www.forkosh.com/mimetex.zip\"> http://www.forkosh.com/mimetex.zip</a>, compile it and put the executable into your moodle/filter/tex/ directory.';
 $string['mimetexnotexecutable'] = 'Custom mimetex is not executable!';
-$string['moduledoesnotexist'] = 'The instance of this module doesn\'t exist';
+$string['moduledoesnotexist'] = 'This module does not exist';
+$string['moduleinstancedoesnotexist'] = 'The instance of this module does not exist';
+$string['moduledisable'] = 'This module ($a) has been disabled for this particular course';
 $string['modulemissingcode'] = 'Module $a is missing the code needed to perform this function';
 $string['modulerequirementsnotmet'] = 'Module \"$a->modulename\" ($a->moduleversion) could not be installed.  It requires a newer version of Moodle (currently you are using $a->currentmoodle, you need $a->requiremoodle).';
 $string['mustbeteacher'] = 'You must be a teacher to look at this page';
 $string['multiplerestorenotallow'] = 'Multiple restore execution not allowed!';
 $string['needphpext'] = 'You need to add $a support to your PHP installation';
+$string['needcopy'] = 'You need to copy something first!';
+$string['needcoursecategroyid'] = 'Either course id or category must be specified';
 $string['noblocks'] = 'No blocks found!';
+$string['noformdesc'] = 'No formslib form description file found for this activity.';
 $string['nocontext'] = 'Sorry, but that course is not a valid context';
 $string['noinstances'] = 'There are no instances of $a in this course!';
+$string['noguest'] = 'No guests here!';
 $string['nologinas'] = 'You are not allowed to login as that user';
 $string['noadmins'] = 'No administrators!';
 $string['nousers'] = 'No such user!';
@@ -153,7 +178,7 @@ $string['notmemberofgroup'] = 'You are not a member of this course group';
 $string['onlyadmins'] = 'Only administrators can do that.';
 $string['onlyeditingteachers'] = 'Only editing teachers can do that.';
 $string['onlyeditown'] = 'You can only edit your own information';
-$string['pagenotexist'] = 'An unusual error occurred (tried to reach a page that doesn\'t exist).';
+$string['pagenotexist'] = 'An unusual error occurred (tried to reach a page that does not exist).';
 $string['pathdoesnotstartslash'] = 'No valid arguments supplied, path does not start with slash!';
 $string['pleasereport'] = 'If you have time, please let us know what you were trying to do when the error occurred:';
 $string['pluginrequirementsnotmet'] = 'Plugin \"$a->pluginname\" ($a->pluginversion) could not be installed.  It requires a newer version of Moodle (currently you are using $a->currentmoodle, you need $a->requiremoodle).';
@@ -162,6 +187,7 @@ $string['remotedownloaderror'] = 'Download of component to your server failed, p
 $string['remotedownloadnotallowed'] = 'Download of components to your server isn\'t allowed (allow_url_fopen is disabled).<br /><br />You must download the <a href=\"$a->url\">$a->url</a> file manually, copy it to \"$a->dest\" in your server and unzip it there.';
 $string['restricteduser'] = 'Sorry, but your current account \"$a\" is restricted from doing that.';
 $string['scheduledbackupsdisabled'] = 'Scheduled backups have been disabled by the server admin';
+$string['sectionnotexist'] = 'This section does not exist';
 $string['sendmessage'] = 'Send Message';
 $string['sessionerroruser'] = 'Your session has timed out.  Please login again.';
 $string['sessionerroruser2'] = 'A server error that affects your login session was detected. Please login again or restart your browser.';
@@ -175,6 +201,7 @@ $string['statsnodata'] = 'There is no available data for that combination of cou
 $string['statsdisable'] = 'Stats is not enabled.';
 $string['unenrolerror'] = 'An error occurred while trying to unenrol that person.';
 $string['unknowaction']= 'Unknown action!';
+$string['unknowcategory'] = 'Category not known!';
 $string['unknowncourse'] = 'Unknown course named \"$a\"';
 $string['unknowncourseidnumber'] = 'Unknown Course ID \"$a\"';
 $string['unknowngroup'] = 'Unknown group \"$a\"';
@@ -190,10 +217,11 @@ $string['usermustbemnet'] = 'Users in the MNET access control list must be remot
 $string['usernotaddedadmin'] = 'Can not delete admin accounts.';
 $string['usernotaddederror'] = 'User not added - error.';
 $string['usernotaddedregistered'] = 'User not added - already registered.';
+$string['usernotavailable'] = 'The details of this user are not available to you.';
 $string['usernotdeletederror'] = 'User not deleted - error.';
 $string['usernotdeletedmissing'] = 'User not deleted - could not find the username.';
 $string['usernotdeletedoff'] = 'User not deleted - deleting not allowed.';
-$string['usernotavailable'] = 'The details of this user are not available to you.';
+$string['usernotincourse'] = 'This user is not in this course!';
 $string['usernotrenamedadmin'] = 'Can not rename admin accounts.';
 $string['usernotrenamedexists'] = 'User not renamed - the new username is already in use.';
 $string['usernotrenamedmissing'] = 'User not renamed - could not find the old username.';