From bcc45748f5943dc53ce80da83f2902b1a8433107 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Sun, 15 Jun 2008 11:25:45 +0000 Subject: [PATCH] "MDL-14129, fix print_error" --- admin/xmldb/index.php | 3 ++- lang/en_utf8/error.php | 1 + mod/hotpot/lib.php | 9 +++------ mod/quiz/attempt.php | 8 ++++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/admin/xmldb/index.php b/admin/xmldb/index.php index f2f7adb9fb..c95f77b114 100644 --- a/admin/xmldb/index.php +++ b/admin/xmldb/index.php @@ -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)"); diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php index 72540a968a..da406c6717 100644 --- a/lang/en_utf8/error.php +++ b/lang/en_utf8/error.php @@ -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!'; ?> diff --git a/mod/hotpot/lib.php b/mod/hotpot/lib.php index cb9d775698..437c31593f 100644 --- a/mod/hotpot/lib.php +++ b/mod/hotpot/lib.php @@ -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; } diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index defa90655c..e8735525cf 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -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); } -- 2.39.5