"MDL-14129, fix print_error"

This commit is contained in:
dongsheng
2008-06-15 11:25:45 +00:00
parent d9f30321da
commit bcc45748f5
4 changed files with 10 additions and 11 deletions
+2 -1
View File
@@ -107,7 +107,8 @@
break;
}
} else {
print_error($xmldb_action->getError());
//TODO: need more detailed error info
print_error('xmldberror');
}
} else {
error ("Error: cannot instantiate class (actions/$action/$actionclass)");
+1
View File
@@ -417,5 +417,6 @@ $string['wrongdestpath'] = 'Wrong destination path.';
$string['wrongroleid'] = 'Incorrect role ID!';
$string['wrongsourcebase'] = 'Wrong source URL base.';
$string['wrongzipfilename'] = 'Wrong ZIP filename.';
$string['xmldberror'] = 'XMLDB Error!';
?>
+3 -6
View File
@@ -1616,9 +1616,8 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
// can't continue if there is no course or reference
if (empty($this->course) || empty($this->reference)) {
$this->error = get_string('error_nocourseorfilename', 'hotpot');
if ($this->report_errors) {
print_error($this->error);
print_error('error_nocourseorfilename', 'hotpot');
}
return;
}
@@ -1652,9 +1651,8 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
if ($this->read_file) {
if (!file_exists($this->filepath) || !is_readable($this->filepath)) {
$this->error = get_string('error_couldnotopensourcefile', 'hotpot', $this->filepath);
if ($this->report_errors) {
print_error($this->error, '', $this->course_homeurl);
print_error('error_couldnotopensourcefile', 'hotpot');
}
return;
}
@@ -1759,9 +1757,8 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
// check template class exists
if (!file_exists($this->template_filepath) || !is_readable($this->template_filepath)) {
$this->error = get_string('error_couldnotopentemplate', 'hotpot', $this->template_dir);
if ($this->report_errors) {
print_error($this->error, '', $this->course_homeurl);
print_error('error_couldnotopentemplate', 'hotpot', $this->course_homeurl);
}
return;
}
+4 -4
View File
@@ -122,8 +122,8 @@
$messages = $accessmanager->prevent_access() +
$accessmanager->prevent_new_attempt($attemptnumber - 1, $lastattempt);
if (!$canpreview && $messages) {
print_error($accessmanager->print_messages($messages, true), '',
$CFG->wwwroot . '/mod/quiz/view.php?q=' . $quiz->id);
//TODO: need more detailed error info
print_error('attempterror', 'quiz', $CFG->wwwroot . '/mod/quiz/view.php?q=' . $quiz->id);
}
$accessmanager->do_password_check($canpreview);
@@ -286,8 +286,8 @@
if (!$newattempt) {
$messages = $accessmanager->prevent_access();
if (!$canpreview && $messages) {
print_error($accessmanager->print_messages($messages, true), '',
$CFG->wwwroot . '/mod/quiz/view.php?q=' . $quiz->id);
//TODO: need more detailed error info
print_error('attempterror', 'quiz', $CFG->wwwroot . '/mod/quiz/view.php?q=' . $quiz->id);
}
$accessmanager->do_password_check($canpreview);
}