"MDL-14129, fix hardcoded print_error"

This commit is contained in:
dongsheng
2008-09-25 02:09:49 +00:00
parent 85c30b9c91
commit 9b34dc6e75
5 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -100,7 +100,7 @@
require_once('delete_category_form.php');
if (!$deletecat = $DB->get_record('course_categories', array('id'=>$delete))) {
error('Incorrect category id', 'index.php');
print_error('invalidcategoryid');
}
$heading = get_string('deletecategory', '', format_string($deletecat->name));
+1 -1
View File
@@ -249,7 +249,7 @@ class moodleform_mod extends moodleform {
$matches=array();
if (!preg_match('/^mod_([^_]+)_mod_form$/', $this->_formname, $matches)) {
debugging('Use $modname parameter or rename form to mod_xx_mod_form, where xx is name of your module');
error('Unknown module name for form');
print_error('unknownmodulename');
}
$modname=$matches[1];
}
+1 -1
View File
@@ -6,7 +6,7 @@ global $DB;
// Get course
$course=$DB->get_record('course',array('id'=>required_param('course',PARAM_INT)));
if(!$course) {
error('Specified course not found');
print_error('invalidcourseid');
}
// Sort (default lastname, optionally firstname)
+6 -6
View File
@@ -13,27 +13,27 @@ switch($targetstate) {
case COMPLETION_INCOMPLETE:
break;
default:
error('Unsupported completion state');
print_error('unsupportedstate');
}
$fromajax=optional_param('fromajax',0,PARAM_INT);
function error_or_ajax($message) {
global $fromajax;
if($fromajax) {
print $message;
print get_string($message, 'error');
exit;
} else {
error($message);
print_error($message);
}
}
// Get course-modules entry
if(!($cm=$DB->get_record('course_modules',array('id'=>$cmid)))) {
error_or_ajax('Activity ID unknown');
error_or_ajax('invalidactivityid');
}
if(!($course=$DB->get_record('course',array('id'=>$cm->course)))) {
error_or_ajax('Missing course (database corrupt?)');
error_or_ajax('invalidcourseid');
}
// Check user is logged in
@@ -41,7 +41,7 @@ require_login($course);
// Check completion state is manual
if($cm->completion!=COMPLETION_TRACKING_MANUAL) {
error_or_ajax('Activity does not provide manual completion tracking');
error_or_ajax('cannotmanualctrack');
}
// Now change state
+4
View File
@@ -83,6 +83,7 @@ $string['cannotgetdata'] = 'Cannot get data';
$string['cannotgradeuser'] = 'Cannot grade this user';
$string['cannothaveparentcate'] = 'Course category cannot have parent!';
$string['cannotmailconfirm'] = 'Error sending password change confirmation email';
$string['cannotmanualctrack'] = 'Activity does not provide manual completion tracking';
$string['cannotmapfield'] = 'Mapping collision detected - two fields maps to the same grade item $a';
$string['cannotmarktopic'] = 'Could not mark that topic for this course';
$string['cannotmoverolewithid'] = 'Cannot move role with ID $a';
@@ -223,6 +224,7 @@ $string['guestnorate'] = 'Guests are not allowed to rate entries';
$string['guestnoeditprofileother'] = 'The guest user profile cannot be edited';
$string['hashpoolproblem'] = 'Incorrect pool file content $a.';
$string['invalidaction'] = 'Invalid action parameter';
$string['invalidactivityid'] = 'Invalid Activity ID';
$string['invalidarguments'] = 'No valid arguments supplied';
$string['invalidargorconf'] = 'No valid arguments supplied or incorrect server configuration';
$string['invalidaccessparameter'] = 'Invalid access parameter';
@@ -404,11 +406,13 @@ $string['unknownhelp'] = 'Unknown help topic $a';
$string['unknowngroup'] = 'Unknown group \"$a\"';
$string['unknownrole'] = 'Unknown role \"$a\"';
$string['unknownuseraction'] = 'Sorry, I do not understand this user action';
$string['unknownmodulename'] = 'Unknown module name for form';
$string['unknoworder'] = 'Unknown ordering';
$string['unknowparamtype'] = 'Unknown parameter type: $a';
$string['unknowquestiontype'] = 'Unsupported question type $a';
$string['unknowuploadaction'] = 'Error: Unknown upload action ($a)';
$string['unsupportedevent'] = 'Unsupported event type';
$string['unsupportedstate'] = 'Unsupported completion state';
$string['upgraderequires19'] = 'Error: New Moodle version was installed on server, unfortunately upgrade from the previous version is not supported.<br />Please upgrade first to latest 1.9.x release. You can also return to previous version by reinstalling original files.';
$string['urlnotdefinerss'] = 'URL not defined for RSS feed';
$string['userautherror'] = 'Unknown auth plugin';