From ba6018a9026d734d41fb84c2bc1a5fc65395db32 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Wed, 7 May 2008 06:02:51 +0000 Subject: [PATCH] "MDL-14129, fix print_error call under course/, see tracker" --- course/category.php | 10 ++--- course/delete.php | 8 ++-- course/edit.php | 8 ++-- course/editcategory.php | 8 ++-- course/editsection.php | 6 +-- course/importstudents.php | 6 +-- course/index.php | 8 ++-- course/info.php | 6 +-- course/lib.php | 16 +++---- course/loginas.php | 4 +- course/mod.php | 94 +++++++++++++++++++-------------------- course/modedit.php | 42 ++++++++--------- course/request.php | 2 +- course/reset.php | 2 +- course/scales.php | 2 +- lang/en_utf8/debug.php | 1 + lang/en_utf8/error.php | 40 ++++++++++++++--- 17 files changed, 146 insertions(+), 117 deletions(-) diff --git a/course/category.php b/course/category.php index 22904d0f90e17..1a1c23f4917ab 100644 --- a/course/category.php +++ b/course/category.php @@ -24,19 +24,19 @@ } 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)) { @@ -170,7 +170,7 @@ 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); } diff --git a/course/delete.php b/course/delete.php index 697edf06885ec..9f07a5f8f9aa2 100644 --- a/course/delete.php +++ b/course/delete.php @@ -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()) { diff --git a/course/edit.php b/course/edit.php index 46ded6b77ce7f..e0f66d77b3aa6 100644 --- a/course/edit.php +++ b/course/edit.php @@ -16,11 +16,11 @@ 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); @@ -30,12 +30,12 @@ $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 diff --git a/course/editcategory.php b/course/editcategory.php index 596508bf9af51..becceb67d09a4 100644 --- a/course/editcategory.php +++ b/course/editcategory.php @@ -22,7 +22,7 @@ $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 @@ $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 (!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 @@ 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 } diff --git a/course/editsection.php b/course/editsection.php index 7bb21abfb56a6..13f9f0a0b3e17 100644 --- a/course/editsection.php +++ b/course/editsection.php @@ -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"); diff --git a/course/importstudents.php b/course/importstudents.php index f9d940599f42c..594a41e48bc31 100644 --- a/course/importstudents.php +++ b/course/importstudents.php @@ -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()) { diff --git a/course/index.php b/course/index.php index fd8a4300d9ad5..4e09ab5cb93b7 100644 --- a/course/index.php +++ b/course/index.php @@ -19,7 +19,7 @@ $context = $sysctx; if (!$site = get_site()) { - print_error('Site isn\'t defined!'); + print_error('siteisnotdefined', 'debug'); } if ($CFG->forcelogin) { @@ -120,7 +120,7 @@ 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'); } } } @@ -131,7 +131,7 @@ 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'); } } } @@ -163,7 +163,7 @@ 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); diff --git a/course/info.php b/course/info.php index e3d1e7a92b280..346ffc9cad5ba 100644 --- a/course/info.php +++ b/course/info.php @@ -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"); } } diff --git a/course/lib.php b/course/lib.php index 8d6cf53099cdd..54b944198e7c2 100644 --- a/course/lib.php +++ b/course/lib.php @@ -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) { diff --git a/course/loginas.php b/course/loginas.php index 91f8efc60fd3a..26bd9b19e6a31 100644 --- a/course/loginas.php +++ b/course/loginas.php @@ -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'); diff --git a/course/mod.php b/course/mod.php index 4e8b2ee312537..3ceb89addfbaa 100644 --- a/course/mod.php +++ b/course/mod.php @@ -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")) { @@ -72,17 +72,17 @@ 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"; @@ -122,7 +122,7 @@ 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"); @@ -161,7 +161,7 @@ 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) == '') { @@ -175,7 +175,7 @@ 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"); @@ -198,14 +198,14 @@ // 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 @@ -250,7 +250,7 @@ "$mod->modulename $mod->instance", $mod->coursemodule); break; default: - print_error("No mode defined"); + print_error('unknowaction'); } @@ -269,21 +269,21 @@ 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"); } } @@ -292,7 +292,7 @@ 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); @@ -314,7 +314,7 @@ $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 @@ -328,7 +328,7 @@ } 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) { @@ -341,7 +341,7 @@ } 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 @@ -362,7 +362,7 @@ } 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 @@ -370,11 +370,11 @@ 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))) { @@ -394,7 +394,7 @@ $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 @@ -415,7 +415,7 @@ } 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 @@ -423,15 +423,15 @@ 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; @@ -453,11 +453,11 @@ } 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 @@ -465,7 +465,7 @@ 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)) { @@ -476,8 +476,8 @@ 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); @@ -510,11 +510,11 @@ } 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 @@ -522,15 +522,15 @@ 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)) { @@ -568,11 +568,11 @@ 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 @@ -580,15 +580,15 @@ 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)) { @@ -627,18 +627,18 @@ $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 @@ -675,7 +675,7 @@ } } else { - print_error("No action was specified"); + print_error("unknowaction"); } require_login($course->id); // needed to setup proper $COURSE diff --git a/course/modedit.php b/course/modedit.php index 8d28a2bb46dda..6054a7bc52a87 100644 --- a/course/modedit.php +++ b/course/modedit.php @@ -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); @@ -26,13 +26,13 @@ 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; @@ -75,11 +75,11 @@ $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 @@ -87,15 +87,15 @@ 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; @@ -160,7 +160,7 @@ $CFG->pagepath .= '/mod'; } } else { - print_error('Invalid operation.'); + print_error('invalidaction'); } $modmoodleform = "$CFG->dirroot/mod/$module->name/mod_form.php"; @@ -168,14 +168,14 @@ 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'; @@ -192,17 +192,17 @@ 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; @@ -243,7 +243,7 @@ $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"); @@ -273,12 +273,12 @@ } 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"); @@ -290,14 +290,14 @@ // 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) @@ -315,7 +315,7 @@ "view.php?id=$fromform->coursemodule", "$fromform->instance", $fromform->coursemodule); } else { - print_error("Data submitted is invalid."); + print_error("invaliddata"); } // sync idnumber with grade_item diff --git a/course/request.php b/course/request.php index 7469cfdc4d887..28e5a56d8ca4b 100644 --- a/course/request.php +++ b/course/request.php @@ -8,7 +8,7 @@ require_login(); if (isguest()) { - print_error("No guests here!"); + print_error("noguest"); } if (empty($CFG->enablecourserequests)) { diff --git a/course/reset.php b/course/reset.php index 61c07c205f0ef..9d3e78cecf0a4 100755 --- a/course/reset.php +++ b/course/reset.php @@ -14,7 +14,7 @@ $id = required_param('id', PARAM_INT); if (!$course = get_record('course', 'id', $id)) { - print_error("Course is misconfigured"); + print_error("invalidcourseid"); } require_login($course); diff --git a/course/scales.php b/course/scales.php index 1ea5a7884df60..7250eed67c068 100644 --- a/course/scales.php +++ b/course/scales.php @@ -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); diff --git a/lang/en_utf8/debug.php b/lang/en_utf8/debug.php index 099cbaf2cd981..e148f4f7486bc 100644 --- a/lang/en_utf8/debug.php +++ b/lang/en_utf8/debug.php @@ -21,5 +21,6 @@ $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!'; ?> diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php index b41f0922747d7..a944754f6f30e 100644 --- a/lang/en_utf8/error.php +++ b/lang/en_utf8/error.php @@ -12,6 +12,9 @@ $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['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['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['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['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['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['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['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 http://moodle.org/download/mimetex/, or obtain the C source from http://www.forkosh.com/mimetex.zip, 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['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['remotedownloadnotallowed'] = 'Download of components to your server isn\'t allowed (allow_url_fopen is disabled).

You must download the url\">$a->url 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['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['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.';