]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error"
authordongsheng <dongsheng>
Thu, 29 May 2008 02:49:39 +0000 (02:49 +0000)
committerdongsheng <dongsheng>
Thu, 29 May 2008 02:49:39 +0000 (02:49 +0000)
mod/hotpot/grade.php
mod/hotpot/lib.php
mod/hotpot/report.php
mod/hotpot/view.php

index 0b7e9eef4762311405932c4abc18259935757d0d..843414c9160136e807731563696faf6a263179a9 100644 (file)
@@ -5,15 +5,15 @@
     $id   = required_param('id', PARAM_INT);          // Course module ID
 
     if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
-        print_error("Course Module ID was incorrect");
+        print_error('invalidcoursemodule');
     }
 
     if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
-        print_error("hotpot ID was incorrect");
+        print_error('invalidhotpotid', 'hotpot');
     }
 
     if (! $course = get_record("course", "id", $hotpot->course)) {
-        print_error("Course is misconfigured");
+        print_error("invalidcourse");
     }
 
     require_login($course->id, false, $cm);
index 925b7dc72f7eb26e59365a11782be90546c042d3..ca894eb20d1b7cdf5119424378a63718af619383 100644 (file)
@@ -455,7 +455,7 @@ function hotpot_is_visible(&$cm) {
 
     if (!isset($cm->sectionvisible)) {
         if (! $section = get_record('course_sections', 'id', $cm->section)) {
-            print_error('Course module record contains invalid section');
+            print_error('invalidsection');
         }
         $cm->sectionvisible = $section->visible;
     }
@@ -569,7 +569,7 @@ function hotpot_add_chain(&$hotpot) {
             $hotpot->reference = addslashes($hotpot->reference);
 
             if (!$hotpot->instance = insert_record("hotpot", $hotpot)) {
-                print_error("Could not add a new instance of $hotpot->modulename", '', "view.php?id=$hotpot->course");
+                print_error('cannotaddnewinstance', '', 'view.php?id='.$hotpot->course, $hotpot->modulename);
             }
 
             // store (hotpot table) id of start of chain
@@ -582,14 +582,14 @@ function hotpot_add_chain(&$hotpot) {
             }
 
             if (! $hotpot->coursemodule = add_course_module($hotpot)) {
-                print_error("Could not add a new course module");
+                print_error('cannotaddcoursemodule');
             }
             if (! $sectionid = add_mod_to_section($hotpot) ) {
-                print_error("Could not add the new course module to that section");
+                print_error('cannotaddcoursemoduletosection');
             }
 
-            if (! set_field("course_modules", "section", $sectionid, "id", $hotpot->coursemodule)) {
-                print_error("Could not update the course module with the correct section");
+            if (! set_field('course_modules', 'section', $sectionid, "id", $hotpot->coursemodule)) {
+                print_error('cannotupdatecoursemodule');
             }
 
             add_to_log($hotpot->course, "course", "add mod",
@@ -868,7 +868,8 @@ function hotpot_update_chain(&$hotpot) {
 
                 // update $thishotpot, if required
                 if ($require_update && !update_record("hotpot", $thishotpot)) {
-                    print_error("Could not update the $hotpot->modulename", '', "view.php?id=$hotpot->course");
+                    print_error('cannotupdatemod', '',
+                            'view.php?id='.$hotpot->course, $hotpot->modulename);
                 }
             }
         } // end foreach $ids
@@ -1586,7 +1587,7 @@ class hotpot_xml_quiz extends hotpot_xml_tree {
 
         // check xmlize functions are available
         if (! function_exists("xmlize")) {
-            print_error('xmlize functions are not available');
+            print_error('xmlizeunavailable', 'debug');
         }
 
         $this->read_file = $read_file;
index 61b2a597af2bc97e65d651802dcccdc1597816b7..8e4ab16db29959c77140ccb368e2f17f810bb237 100644 (file)
 
     if ($id) {
         if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
-            print_error("Course Module ID was incorrect");
+            print_error('invalidcoursemodule');
         }
         if (! $course = get_record("course", "id", $cm->course)) {
-            print_error("Course is misconfigured");
+            print_error('coursemisconf');
         }    
         if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
-            print_error("Course module is incorrect");
+            print_error('invalidhotpotid', 'hotpot');
         }
 
     } else {
         if (! $hotpot = get_record("hotpot", "id", $hp)) {
-            print_error("Course module is incorrect");
+            print_error('invalidhotpotid', 'hotpot');
         }
         if (! $course = get_record("course", "id", $hotpot->course)) {
-            print_error("Course is misconfigured");
+            print_error('coursemisconf');
         }
         if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
-            print_error("Course Module ID was incorrect");
+            print_error('invalidcoursemodule');
         }
     }
 
 /// Open the selected hotpot report and display it
 
     if (! is_readable("report/$mode/report.php")) {
-        print_error("Report not known (".clean_text($mode).")", '', $course_homeurl);
+        print_error('unknownreport', 'hotpot', $course_homeurl, clean_text($mode));
     }
 
     include("report/default.php");  // Parent class
     $report = new hotpot_report();
 
     if (! $report->display($hotpot, $cm, $course, $users, $attempts, $questions, $formdata)) {
-        print_error("Error occurred during report processing!", '', $course_homeurl);
+        print_error('error_processreport', 'hotpot', $course_homeurl);
     }
 
     if ($formdata['reportformat']=='htm') {
index 3c9ddf3271addcda541ba669404ec251575b765a..c3411a10b00f7a3924f17b9c21759331a85f3287 100644 (file)
 
         if ($id) {
             if (! $cm = get_coursemodule_from_id('hotpot', $id)) {
-                print_error("Course Module ID was incorrect");
+                print_error('invalidcoursemodule');
             }
             if (! $course = get_record("course", "id", $cm->course)) {
-                print_error("Course is misconfigured");
+                print_error('coursemisconf');
             }
             if (! $hotpot = get_record("hotpot", "id", $cm->instance)) {
-                print_error("Course module is incorrect");
+                print_error('invalidcoursemodule');
             }
 
         } else {
             if (! $hotpot = get_record("hotpot", "id", $hp)) {
-                print_error("Course module is incorrect");
+                print_error('invalidhotpotid', 'hotpot');
             }
             if (! $course = get_record("course", "id", $hotpot->course)) {
-                print_error("Course is misconfigured");
+                print_error('coursemisconf');
             }
             if (! $cm = get_coursemodule_from_instance("hotpot", $hotpot->id, $course->id)) {
-                print_error("Course Module ID was incorrect");
+                print_error('invalidcoursemodule');
             }
 
         }
     }
     // open and parse the source file
     if(!$hp = new hotpot_xml_quiz($hotpot)) {
-        print_error("Quiz is unavailable at the moment");
+        print_error('quizunavailable', 'hotpot');
     }
     $get_js = optional_param('js', '', PARAM_ALPHA);
     $get_css = optional_param('css', '', PARAM_ALPHA);
 
                 $attemptid = hotpot_add_attempt($hotpot->id);
                 if (! is_numeric($attemptid)) {
-                    print_error('Could not insert attempt record: '.$DB->get_last_error());
+                    print_error('cannotinsertattempt', 'hotpot', '', $DB->get_last_error());
                 }
             }
             $hp->adjust_media_urls();