]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error"
authordongsheng <dongsheng>
Sun, 15 Jun 2008 12:02:43 +0000 (12:02 +0000)
committerdongsheng <dongsheng>
Sun, 15 Jun 2008 12:02:43 +0000 (12:02 +0000)
admin/uploaduser.php
enrol/authorize/enrol.php
grade/import/xml/import.php
lang/en_utf8/error.php
lang/en_utf8/gradeimport_xml.php
lang/en_utf8/question.php
lang/en_utf8/quiz.php
question/export.php
question/import.php
question/type/calculated/questiontype.php
question/type/questiontype.php

index 1a83c4a4da65a87428c26af7fb1596ab79ca58c9..c442213e14a60bd541b42af0ae4dde79a16c75c5 100755 (executable)
@@ -96,7 +96,8 @@ if (empty($iid)) {
         unset($content);
 
         if ($readcount === false) {
-            print_error($cir->get_error(), '', $returnurl);
+            //TODO: need more detailed error info
+            print_error('csvloaderror', '', $returnurl);
         } else if ($readcount == 0) {
             print_error('csvemptyfile', 'error', $returnurl);
         }
index 7f9659af88cec686db65178df023e53c147d9032..6cceb911c1e4386549e5fa96a30f20e9b79fc56d 100755 (executable)
@@ -92,7 +92,7 @@ class enrolment_plugin_authorize
                         break;
                 }
                 if (!empty($authorizeerror)) {
-                    print_error($authorizeerror);
+                    print_error('authorizeerror');
                 }
             }
             $frmenrol->display();
index 6407e475146973482a2c339d063645ca813ebbcd..a7b41e2740916a6c660bbb3aaea7e7113be8be25 100644 (file)
@@ -85,7 +85,7 @@ if ($importcode !== false) {
     }
 
 } else {
-    print_error($error);
+    print_error('error', 'gradeimport_xml');
 }
 
 ?>
index f9d85fdeed614386e72bb355c98a614281106f0d..ceb5a1061b85b05c57796d1ae0cada214c25e0b8 100644 (file)
@@ -3,6 +3,7 @@
 
 
 $string['adminprimarynoedit'] = 'The primary admin cannot be edited by others';
+$string['authorizeerror'] = 'Authorize Error';
 $string['blockdoesnotexist'] = 'This block does not exist';
 $string['blockcannotinistantiate'] = 'Problem in instantiating block object';
 $string['blockcannotread'] = 'Could not read data for blockid= $a ';
@@ -174,6 +175,7 @@ $string['csvfewcolumns'] = 'Not enough columns, please verify the delimiter sett
 $string['csvinvalidcolsnum'] = 'INVALID CSV FILE; Each line must include 49 or 70 fields';
 $string['csvinvalidcols'] = '<b>INVALID CSV FILE:</b> First line must include "Header Fields" and the file must be type of <br />"Expanded Fields/Comma Separated"<br />or<br /> "Expanded Fields with CAVV Result Code/Comma Separated"';
 $string['csvweirdcolumns'] = 'Invalid CSV file format - number of columns is not constant!';
+$string['csvloaderror'] = 'Error occur during loading vcs file!';
 $string['dbconnectionfailed'] = '<p>Error: Database connection failed.</p>
 <p>It is possible that the database is overloaded or otherwise not running properly.</p>
 <p>The site administrator should also check that the database details have been correctly specified in config.php</p>$a';
index ec2e5f4a39286ecab560a7a1a556e110b44ed3f3..e2f3bb741360d5905140cf652a7afa4fa50b2699 100644 (file)
@@ -1,5 +1,6 @@
 <?PHP // $Id$
 
+$string['error'] = 'Errors occur';
 $string['errbadxmlformat'] = 'Error - bad XML format';
 $string['errduplicateidnumber'] = 'Error - duplicate idnumber';
 $string['errincorrectidnumber'] = 'Error - incorrect idnumber';
index c79b486f4d0d86bceacaa5945d02cf24724ebb3e..02880bb7c941307807a060a1171313bfd3b88d87 100644 (file)
@@ -74,6 +74,7 @@ $string['errorsavingcomment'] = 'Error saving the comment for question $a->name
 $string['errorupdatingattempt'] = 'Error updating attempt $a->id in the database.';
 $string['emptyxml'] = 'Unkown error - empty imsmanifest.xml';
 $string['exportcategory'] = 'Export category';
+$string['exporterror'] = 'Errors occur during exporting!';
 $string['filesareasite']= 'the site files area';
 $string['filesareacourse']= 'the course files area';
 $string['filestomove']= 'Move / copy files to $a?';
@@ -125,6 +126,7 @@ $string['questionbank'] = 'Question bank';
 $string['questioncategory'] = 'Question category';
 $string['questioncatsfor'] = 'Question Categories for \'$a\'';
 $string['questiondoesnotexist'] = 'This question does not exist';
+$string['questionsaveerror'] = 'Errors occur during saving question - ($a)';
 $string['questionsmovedto'] = 'Questions still in use moved to "$a" in the parent course category.';
 $string['questionsrescuedfrom'] = 'Questions saved from context $a.';
 $string['questionsrescuedfrominfo'] = 'These questions (some of which may be hidden) where saved when context $a was deleted because they are still used by some quizzes or other activities.';
index 172fc36cabb9aad0df32fd7cb1e4a7c870d516d0..0611cef4682f89a7f2519039b4aee20d1eceb4b3 100644 (file)
@@ -53,6 +53,7 @@ $string['attempt'] = 'Attempt $a';
 $string['attemptclosed'] = 'Attempt has not closed yet';
 $string['attemptduration'] = 'Time taken';
 $string['attemptedon'] = 'Attempted on';
+$string['attempterror'] = 'Attempt error';
 $string['attemptfirst'] = 'First attempt';
 $string['attemptincomplete'] = 'That attempt (by $a) is not yet completed.';
 $string['attemptlast'] = 'Last attempt';
@@ -252,6 +253,7 @@ $string['finishreview'] = 'Finish review';
 $string['forceregeneration'] = 'force regeneration';
 $string['formatnotfound'] = 'Import/export format $a not found';
 $string['formatnotimplemented'] = 'This format has not been correctly implemented, please post a bug report';
+$string['formulaerror'] = 'Formula errors!';
 $string['fractionsaddwrong'] = 'The positive grades you have chosen do not add up to 100%%<br />Instead, they add up to $a%%<br />Do you want to go back and fix this question?';
 $string['fractionsnomax'] = 'One of the answers should be 100%%, so that it is<br />possible to get a full grade for this question.<br />Do you want to go back and fix this question?';
 $string['fromfile'] = 'from file:';
index 5ebf3a3dc9ae1ddfaa499f947769327e1a79b1bc..d0738298a4e6e9b151b544b71096d245cc6a61a9 100644 (file)
         $qformat->setContexttofile(!empty($from_form->contexttofile));
 
         if (! $qformat->exportpreprocess()) {   // Do anything before that we need to
-            print_error($txt->exporterror, '', $thispageurl->out());
+            print_error('exporterror', 'question', $thispageurl->out());
         }
 
         if (! $qformat->exportprocess()) {         // Process the export data
-            print_error($txt->exporterror, '', $thispageurl->out());
+            print_error('exporterror', 'question', $thispageurl->out());
         }
 
         if (! $qformat->exportpostprocess()) {                    // In case anything needs to be done after
-            print_error($txt->exporterror, '', $thispageurl->out());
+            print_error('exporterror', 'question', $thispageurl->out());
         }
         echo "<hr />";
 
index 619b9f2adb1dbc66558e4d7f0fffdad18bb4239c..9eedd4d1d3fe5c528bcc4ba2661de901d5255ff2 100644 (file)
 
             // In case anything needs to be done after
             if (! $qformat->importpostprocess()) {
-                print_error($txt->importerror, '', $thispageurl->out());
+                //TODO: need more detailed error info
+                print_error('cannotimport', '', $thispageurl->out());
             }
 
             echo "<hr />";
index e7a2b7446ce04106363fcafa31f121fd57988536..0b0a2a49e0d1c97e248f46a345dc9ef4a3bddbe0 100644 (file)
@@ -293,40 +293,28 @@ class question_calculated_qtype extends question_dataset_dependent_questiontype
     function validate_form($form) {
         switch($form->wizardpage) {
             case 'question':
-                $calculatedmessages = array();
                 if (empty($form->name)) {
-                    $calculatedmessages[] = get_string('missingname', 'quiz');
+                    print_error('missingname', 'quiz');
                 }
                 if (empty($form->questiontext)) {
-                    $calculatedmessages[] = get_string('missingquestiontext', 'quiz');
+                    print_error('missingquestiontext', 'quiz');
                 }
                 // Verify formulas
                 foreach ($form->answers as $key => $answer) {
                     if ('' === trim($answer)) {
-                        $calculatedmessages[] =
-                            get_string('missingformula', 'quiz');
+                        print_error('missingformula', 'quiz');
                     }
-                    if ($formulaerrors =
-                     qtype_calculated_find_formula_errors($answer)) {
-                        $calculatedmessages[] = $formulaerrors;
+                    if ($formulaerrors = qtype_calculated_find_formula_errors($answer)) {
+                        print_error('formulaerror', 'quiz');
                     }
                     if (! isset($form->tolerance[$key])) {
                         $form->tolerance[$key] = 0.0;
                     }
                     if (! is_numeric($form->tolerance[$key])) {
-                        $calculatedmessages[] =
-                            get_string('tolerancemustbenumeric', 'quiz');
+                        print_error('tolerancemustbenumeric', 'quiz');
                     }
                 }
 
-                if (!empty($calculatedmessages)) {
-                    $errorstring = "The following errors were found:<br />";
-                    foreach ($calculatedmessages as $msg) {
-                        $errorstring .= $msg . '<br />';
-                    }
-                    print_error($errorstring);
-                }
-
                 break;
             default:
                 return parent::validate_form($form);
index 7824debf67d1ed2774bf0670bbd48a668c6c2016..3118e4d5343ea98598b493c201402a2ffccb1d47 100644 (file)
@@ -316,7 +316,7 @@ class default_questiontype {
         $result = $this->save_question_options($form);
 
         if (!empty($result->error)) {
-            print_error($result->error);
+            print_error('questionsaveerror', 'question', '', $result->error);
         }
 
         if (!empty($result->notice)) {