From 2471ef8650388f9c629ec577dd05b3a29e61baf2 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Tue, 20 May 2008 03:09:35 +0000 Subject: [PATCH] "MDL-14129, fix print_error" --- question/file.php | 6 +++--- question/type/multianswer/edit_multianswer_form.php | 4 ++-- question/type/multianswer/questiontype.php | 6 +++--- question/type/random/questiontype.php | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/question/file.php b/question/file.php index 549b470be31..164a4b3a2e2 100644 --- a/question/file.php +++ b/question/file.php @@ -20,9 +20,9 @@ // relative path must start with '/', because of backup/restore!!! if (!$relativepath) { - print_error('No valid arguments supplied or incorrect server configuration'); + print_error('invalidarguments'); } else if ($relativepath{0} != '/') { - print_error('No valid arguments supplied, path does not start with slash!'); + print_error('pathdoesnotstartslash'); } $pathname = $CFG->dataroot.'/questionattempt'.$relativepath; @@ -32,7 +32,7 @@ // check for the right number of directories in the path if (count($args) != 3) { - print_error('Invalid arguments supplied'); + print_error('invalidarguments'); } // security: require login diff --git a/question/type/multianswer/edit_multianswer_form.php b/question/type/multianswer/edit_multianswer_form.php index c5f24188f37..09e59a38d67 100644 --- a/question/type/multianswer/edit_multianswer_form.php +++ b/question/type/multianswer/edit_multianswer_form.php @@ -108,7 +108,7 @@ class question_edit_multianswer_form extends question_edit_form { $parsableanswerdef .= 'NUMERICAL:'; break; default: - print_error("questiontype $wrapped->qtype not recognized"); + print_error('unknownquestiontype', 'question', '', $wrapped->qtype); } $separator= ''; foreach ($wrapped->options->answers as $subanswer) { @@ -252,4 +252,4 @@ class question_edit_multianswer_form extends question_edit_form { return 'multianswer'; } } -?> \ No newline at end of file +?> diff --git a/question/type/multianswer/questiontype.php b/question/type/multianswer/questiontype.php index 649468536c0..8f83fce8036 100644 --- a/question/type/multianswer/questiontype.php +++ b/question/type/multianswer/questiontype.php @@ -439,7 +439,7 @@ class embedded_cloze_qtype extends default_questiontype { echo $feedbackimg; break; default: - print_error("Unable to recognize questiontype of question part #$positionkey."); + print_error('unknownquestiontype', 'question'); break; } echo ""; // MDL-7497 @@ -672,7 +672,7 @@ class embedded_cloze_qtype extends default_questiontype { $answer = $exploded[1]; // $sequence is an ordered array of the question ids. if (!$sequence = get_field('question_multianswer', 'sequence', 'question', $state->question)) { - print_error("The cloze question $state->question is missing its options"); + print_error('missingoption', 'question', '', $state->question); } $sequence = explode(',', $sequence); // The id of the current question. @@ -799,7 +799,7 @@ function qtype_multianswer_extract_question($text) { $wrapped->partiallycorrectfeedback = ''; $wrapped->incorrectfeedback = ''; } else { - print_error("Cannot identify qtype $answerregs[2]"); + print_error('unknownquestiontype', 'question', '', $answerregs[2]); return false; } diff --git a/question/type/random/questiontype.php b/question/type/random/questiontype.php index d6024c41b17..239e43d28da 100644 --- a/question/type/random/questiontype.php +++ b/question/type/random/questiontype.php @@ -54,11 +54,11 @@ class random_qtype extends default_questiontype { $form->name = ''; $question = parent::save_question($question, $form, $course); if (!$category = get_record('question_categories', 'id', $question->category)) { - print_error('Could retrieve question category'); + print_error('cannotretrieveqcat', 'question'); } $question->name = $this->question_name($category); if (!set_field('question', 'name', $question->name, 'id', $question->id)) { - print_error('Could not update random question name'); + print_error('cannotupdaterandomqname', 'question'); } return $question; }