Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
"MDL-14129, fix print_error"
  • Loading branch information
dongsheng committed Jun 15, 2008
1 parent d9f3032 commit bcc4574
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
3 changes: 2 additions & 1 deletion admin/xmldb/index.php
Expand Up @@ -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)");
Expand Down
1 change: 1 addition & 0 deletions lang/en_utf8/error.php
Expand Up @@ -417,5 +417,6 @@
$string['wrongroleid'] = 'Incorrect role ID!';
$string['wrongsourcebase'] = 'Wrong source URL base.';
$string['wrongzipfilename'] = 'Wrong ZIP filename.';
$string['xmldberror'] = 'XMLDB Error!';

?>
9 changes: 3 additions & 6 deletions mod/hotpot/lib.php
Expand Up @@ -1616,9 +1616,8 @@ function hotpot_xml_quiz(&$obj, $read_file=true, $parse_xml=true, $convert_urls=

// 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;
}
Expand Down Expand Up @@ -1652,9 +1651,8 @@ function hotpot_xml_quiz(&$obj, $read_file=true, $parse_xml=true, $convert_urls=
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;
}
Expand Down Expand Up @@ -1759,9 +1757,8 @@ function hotpot_xml_quiz(&$obj, $read_file=true, $parse_xml=true, $convert_urls=

// 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;
}
Expand Down
8 changes: 4 additions & 4 deletions mod/quiz/attempt.php
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit bcc4574

Please sign in to comment.