]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error"
authordongsheng <dongsheng>
Tue, 20 May 2008 03:09:35 +0000 (03:09 +0000)
committerdongsheng <dongsheng>
Tue, 20 May 2008 03:09:35 +0000 (03:09 +0000)
question/file.php
question/type/multianswer/edit_multianswer_form.php
question/type/multianswer/questiontype.php
question/type/random/questiontype.php

index 549b470be31f7783d768624036f439673b308e38..164a4b3a2e2060127eda137293f527ab7f50f588 100644 (file)
@@ -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
index c5f24188f377d1de6bbd33de40eeb1bc091a28b4..09e59a38d67e775798039f3e7fba8d7fc5948e0f 100644 (file)
@@ -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
+?>
index 649468536c021b212584847000248a6236b22a5c..8f83fce8036891a1bd7f4b5e332e16ea32bbf64d 100644 (file)
@@ -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 "</label>"; // 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;
         }
 
index d6024c41b17c5c580a451213955adc725cae18c0..239e43d28da584115062ba42e9a5a74c6e60f486 100644 (file)
@@ -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;
     }