"MDL-14129, remove the rest error() in moodle2"

This commit is contained in:
dongsheng 2008-12-12 04:53:32 +00:00
parent 3b8c248237
commit 60e40dda6c
16 changed files with 29 additions and 31 deletions

View File

@ -18,7 +18,7 @@ if ($data = $form->get_data()) {
}
if ($targetdb->get_tables()) {
// TODO add exception or string...
error('Sorry, tables already exist in selected database. Can not continue.');
print_error('ddltablealreadyexists');
}
admin_externalpage_print_header();
dbtransfer_transfer_database($DB, $targetdb);

View File

@ -15,7 +15,7 @@
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
} else {
error("Stats is not enabled.");
print_error('statsdisable');
}
}

View File

@ -21,7 +21,7 @@ httpsrequired();
/// Define variables used in page
if (!$site = get_site()) {
error("No site found!");
print_error('nosite');
}
if (empty($CFG->langmenu)) {

View File

@ -25,7 +25,7 @@
//Get and check course
if (! $course = get_record("course", "id", $id)) {
error("Course ID was incorrect (can't find it)");
print_error('invalidcourseid');
}
// To some reasons, course_startdateoffset value was lost during restoring
// See MDL-17469

View File

@ -102,10 +102,7 @@ if (isset($rss_record)) {
if ($act == 'updfeed') {
if (!$managefeeds) {
//error(get_string('noguestpost', 'forum').
// ' You are not allowed to make modifications to this RSS feed at this time.',
// $referrer);
print_error('noguestpost', 'forum', $referrer, 'You are not allowed to make modifications to this RSS feed at this time.');
print_error('cannotmakemodification', 'rss_client', $referrer);
}
@ -227,10 +224,7 @@ if ($act == 'updfeed') {
} else if ($act == 'delfeed') {
if (!$managefeeds) {
//error(get_string('noguestpost', 'forum').
// ' You are not allowed to make modifications to this RSS feed at this time.',
// $referrer);
print_error('noguestpost', 'forum', $referrer, 'You are not allowed to make modifications to this RSS feed at this time.');
print_error('cannotmakemodification', 'rss_client', $referrer);
}
$file = $CFG->dataroot .'/cache/rsscache/'. $rssid .'.xml';

View File

@ -9,7 +9,7 @@
$id = optional_param('id', 0, PARAM_INT);// Course ID
if (!$course = $DB->get_record('course', array('id'=>$id)) ) {
error('That\'s an invalid course id'.$id);
print_error('invalidcourseid');
}
require_login($course);

View File

@ -66,7 +66,7 @@
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
} else {
error("Stats is not enabled.");
print_error('statsdisable');
}
}

View File

@ -18,7 +18,7 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
// Make sure course is OK and user has access to manage groups
if (!$course = $DB->get_record('course', array('id' => $courseid))) {
error('Course ID was incorrect');
print_error('invalidcourseid');
}
require_login($course);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
@ -29,10 +29,10 @@ $groupidarray = explode(',',$groupids);
$groupnames = array();
foreach($groupidarray as $groupid) {
if (!$group = $DB->get_record('groups', array('id' => $groupid))) {
error('Group ID was incorrect');
print_error('invalidgroupid');
}
if ($courseid != $group->courseid) {
error('Group not on required course');
print_error('groupunknown', '', '', $group->courseid);
}
$groupnames[] = format_string($group->name);
}

View File

@ -6,6 +6,7 @@ $string['addfeed'] = 'Add a news feed URL:';
$string['addheadlineblock'] = 'Add RSS headline block';
$string['addnew'] = 'Add New';
$string['blockname'] = 'RSS Client';
$string['cannotmakemodification'] = 'You are not allowed to make modifications to this RSS feed at this time.';
$string['choosefeedlabel'] = 'Choose the feeds which you would like to make available in this block:';
$string['clientchannellink'] = 'Source site...';
$string['clientnumentries'] = 'The default number of entries to show per feed.';

View File

@ -97,6 +97,7 @@ $string['cannotopencsv'] = 'Cannot open CSV file';
$string['cannotopenforwrit'] = 'Cannot open for writing: $a';
$string['cannotopenfile'] = 'Cannot open file ($a)';
$string['cannotopentemplate'] = 'Cannot open template file ($a)';
$string['cannotopenzip'] = 'Can not open zip file, probably zip extension bug on 64bit os';
$string['cannotoverridebaserole'] = 'Cannot override base role capabilities';
$string['cannotoverriderolehere'] = 'You are not allowed to override this role (id = $a->roleid) in this context ($a->context)';
$string['cannotreadtmpfile'] = 'Error reading temporary file';
@ -408,6 +409,7 @@ $string['tagnotfound'] = 'The specified tag was not found in the database';
$string['tagdisabled'] = 'Tags are disabled!';
$string['themenotinstall'] = 'This theme is not installed!';
$string['transactionvoid'] = 'Transaction cannot be voided because it has already been voided';
$string['TODO'] = 'TODO';
$string['importformatnotimplement'] = 'Sorry, importing this format is not yet implemented!';
$string['unicodeupgradeerror'] = 'Sorry, but your database is not already in Unicode, and this version of Moodle is not able to migrate your database to Unicode. Please upgrade to Moodle 1.7.x first and perform the Unicode migration from the Admin page. After that is done you should be able to migrate to Moodle $a';
$string['unspecifycourseid'] = 'Must specify course id, short name or idnumber';

View File

@ -114,6 +114,7 @@ $string['maketoplevelitem'] = 'Move to top level';
$string['missingoption'] = 'The cloze question $a is missing its options';
$string['missingimportantcode'] = 'This question type is missing important code: $a.';
$string['missingcourseorcmid'] = 'Need to provide courseid or cmid to print_question.';
$string['missingcourseorcmidtolink'] = 'Need to provide courseid or cmid to get_question_edit_link.';
$string['modified'] = 'Last saved';
$string['move']= 'Move from $a and change links.';
$string['movecategory']= 'Move Category';

View File

@ -498,8 +498,8 @@ abstract class pdo_moodle_database extends moodle_database {
array_unshift($params, $newvalue);
break;
default:
$this->lastError = 'Unknown parameter type in file ' . __FILE__ . ' on line ' . __LINE__ . '.';
error($this->lastError);
$this->lastError = __FILE__ . ' LINE: ' . __LINE__ . '.';
print_error(unknowparamtype, 'error', '', $this->lastError);
}
}
$sql = "UPDATE {{$table}} SET $newfield $select";
@ -508,11 +508,11 @@ abstract class pdo_moodle_database extends moodle_database {
}
public function sql_concat() {
error('TODO');
print_error('TODO');
}
public function sql_concat_join($separator="' '", $elements=array()) {
error('TODO');
print_error('TODO');
}
public function begin_sql() {

View File

@ -194,7 +194,7 @@ class zip_archive extends file_archive {
$this->close();
$res = $this->open($this->archivepathname, file_archive::OPEN, $this->encoding);
if ($res !== true) {
error('Can not open zip file, probably zip extension bug on 64bit os'); //TODO ??
print_error('cannotopenzip'); //TODO ??
}
}
@ -225,7 +225,7 @@ class zip_archive extends file_archive {
$this->close();
$res = $this->open($this->archivepathname, file_archive::OPEN, $this->encoding);
if ($res !== true) {
error('Can not open zip file, probably zip extension bug on 64bit os'); //TODO ??
print_error('cannotopenzip'); //TODO ??
}
}
$this->usedmem += strlen($contents);
@ -301,4 +301,4 @@ class zip_archive extends file_archive {
return ($this->pos < $this->count());
}
}
}

View File

@ -47,7 +47,7 @@
// Get the course object and related bits.
if (! $course = $DB->get_record("course", array("id"=> $quiz->course))) {
error("This course doesn't exist");
print_error('invalidcourseid');
}
//you need mod/quiz:manage in addition to question capabilities to access this page.
require_capability('mod/quiz:manage', $contexts->lowest());
@ -60,7 +60,7 @@
print_header_simple($streditingquiz, '', $navigation, "", "", true, $strupdatemodule);
if (!$quizname = $DB->get_field($cm->modname, 'name', array('id'=> $cm->instance))) {
error('Cannot get the module name in build navigation.');
print_error('invalidcoursemodule');
}
print_heading(get_string("addrandomquestiontoquiz","quiz",$quizname), 'left', 2);
@ -69,4 +69,4 @@
$qcobject->display_randomquestion_user_interface($addonpage);
print_footer($course);
?>
?>

View File

@ -38,9 +38,9 @@
$timenow = time();
if ($scorm->timeclose !=0) {
if ($scorm->timeopen > $timenow) {
error(get_string("notopenyet", "scorm", userdate($scorm->timeopen)));
print_error('notopenyet', 'scorm', null, userdate($scorm->timeopen));
} else if ($timenow > $scorm->timeclose) {
error(get_string("expired", "scorm", userdate($scorm->timeclose)));
print_error('expired', 'scorm', null, userdate($scorm->timeclose));
}
}
@ -198,4 +198,4 @@
}
?>
</body>
</html>
</html>

View File

@ -1030,7 +1030,7 @@ class default_questiontype {
} else if (!empty($cmoptions->course)) {
$linkurl .= '&amp;courseid=' . $cmoptions->course;
} else {
error('Need to provide courseid or cmid to get_question_edit_link.');
print_error('missingcourseorcmidtolink', 'question');
}
/// Work out the contents of the link.