]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix print_error call"
authordongsheng <dongsheng>
Thu, 22 May 2008 07:20:45 +0000 (07:20 +0000)
committerdongsheng <dongsheng>
Thu, 22 May 2008 07:20:45 +0000 (07:20 +0000)
mod/assignment/delete.php
mod/assignment/grade.php
mod/assignment/index.php
mod/assignment/lib.php
mod/assignment/mod_form.php
mod/assignment/submissions.php
mod/assignment/type/online/file.php
mod/assignment/type/upload/assignment.class.php
mod/assignment/type/upload/notes.php
mod/assignment/upload.php
mod/assignment/view.php

index fe3e2039ee7686d1aa42645afaa605f497ee4ad9..c00668a097fea0e387ea0f296f861dd5662c4744 100644 (file)
@@ -8,25 +8,25 @@
 
     if ($id) {
         if (! $cm = get_coursemodule_from_id('assignment', $id)) {
-            print_error("Course Module ID was incorrect");
+            print_error('invalidcoursemodule');
         }
 
         if (! $assignment = get_record('assignment', 'id', $cm->instance)) {
-            print_error("assignment ID was incorrect");
+            print_error('invalidid', 'assignment');
         }
 
         if (! $course = get_record('course', 'id', $assignment->course)) {
-            print_error("Course is misconfigured");
+            print_error('coursemisconf', 'assignment');
         }
     } else {
         if (!$assignment = get_record('assignment', 'id', $a)) {
-            print_error("Course module is incorrect");
+            print_error('invalidcoursemodule');
         }
         if (! $course = get_record('course', 'id', $assignment->course)) {
-            print_error("Course is misconfigured");
+            print_error('coursemisconf', 'assignement');
         }
         if (! $cm = get_coursemodule_from_instance('assignment', $assignment->id, $course->id)) {
-            print_error("Course Module ID was incorrect");
+            print_error('invalidcoursemodule');
         }
     }
 
index 4bc1b99d674ae33bcdd5328596b287edc6df3ac1..dc8a6a42ceeb6aa1f35dd9bc8f0b13691becda79 100644 (file)
@@ -5,15 +5,15 @@
     $id   = required_param('id', PARAM_INT);          // Course module ID
 
     if (! $cm = get_coursemodule_from_id('assignment', $id)) {
-        print_error("Course Module ID was incorrect");
+        print_error('invalidcoursemodule');
     }
 
     if (! $assignment = get_record("assignment", "id", $cm->instance)) {
-        print_error("assignment ID was incorrect");
+        print_error('invalidid', 'assignment');
     }
 
     if (! $course = get_record("course", "id", $assignment->course)) {
-        print_error("Course is misconfigured");
+        print_error('coursemisconf', 'assignment');
     }
 
     require_login($course->id, false, $cm);
index df277d87ebfe3e6916d673597214329647bc3af0..646f35c5a543b5ade79972030bf194802e12e198 100644 (file)
@@ -7,7 +7,7 @@
     $id = required_param('id', PARAM_INT);   // course
 
     if (! $course = get_record("course", "id", $id)) {
-        print_error("Course ID is incorrect");
+        print_error('invalidcourseid');
     }
 
     require_course_login($course);
index bf0d0af4bd6b6471e59efe57a045d1b2382b236e..0b3cd7e6bd8ada830cf36d656d003a91c5ba4767 100644 (file)
@@ -52,7 +52,7 @@ class assignment_base {
         if ($cm) {
             $this->cm = $cm;
         } else if (! $this->cm = get_coursemodule_from_id('assignment', $cmid)) {
-            print_error('Course Module ID was incorrect');
+            print_error('invalidcoursemodule');
         }
 
         $this->context = get_context_instance(CONTEXT_MODULE, $this->cm->id);
@@ -62,13 +62,13 @@ class assignment_base {
         } else if ($this->cm->course == $COURSE->id) {
             $this->course = $COURSE;
         } else if (! $this->course = get_record('course', 'id', $this->cm->course)) {
-            print_error('Course is misconfigured');
+            print_error('invalidid', 'assignment');
         }
 
         if ($assignment) {
             $this->assignment = $assignment;
         } else if (! $this->assignment = get_record('assignment', 'id', $this->cm->instance)) {
-            print_error('assignment ID was incorrect');
+            print_error('invalidid', 'assignment');
         }
 
         $this->assignment->cmidnumber = $this->cm->id;     // compatibility with modedit assignment obj
@@ -235,7 +235,7 @@ class assignment_base {
 
     /// We need the teacher info
         if (!$teacher = get_record('user', 'id', $graded_by)) {
-            print_error('Could not find the teacher');
+            print_error('cannotfindteacher');
         }
 
     /// Print the feedback
@@ -787,7 +787,7 @@ class assignment_base {
         $offset = required_param('offset', PARAM_INT);//offset for where to start looking for student.
 
         if (!$user = get_record('user', 'id', $userid)) {
-            print_error('No such user!');
+            print_error('nousers');
         }
 
         if (!$submission = $this->get_submission($user->id)) {
@@ -1490,7 +1490,7 @@ class assignment_base {
         }
         $newsubmission = $this->prepare_new_submission($userid, $teachermodified);
         if (!insert_record("assignment_submissions", $newsubmission)) {
-            print_error("Could not insert a new empty submission");
+            print_error('cannotinsertempty', 'assignment');
         }
 
         return get_record('assignment_submissions', 'assignment', $this->assignment->id, 'userid', $userid);
index 33a0eb0e28a75b33d8e2217d2870366cc1ef6c79..b9ffcb3e9638971832111ab45d011deace54d4ea 100644 (file)
@@ -12,7 +12,7 @@ class mod_assignment_mod_form extends moodleform_mod {
             if($ass = get_record('assignment', 'id', (int)$this->_instance)) {
                 $type = $ass->assignmenttype;
             } else {
-                print_error('incorrect assignment');
+                print_error('invalidassignment', 'assignment');
             }
         } else {
             $type = required_param('type', PARAM_ALPHA);
@@ -68,4 +68,4 @@ class mod_assignment_mod_form extends moodleform_mod {
 
 
 }
-?>
\ No newline at end of file
+?>
index 14428765b18eb66e28dfb367bfb31c127b64b36e..abf87994cb2bfc50fab285bdb4407773a0b8acde 100644 (file)
@@ -9,25 +9,25 @@
 
     if ($id) {
         if (! $cm = get_coursemodule_from_id('assignment', $id)) {
-            print_error("Course Module ID was incorrect");
+            print_error('invalidcoursemodule');
         }
 
         if (! $assignment = get_record("assignment", "id", $cm->instance)) {
-            print_error("assignment ID was incorrect");
+            print_error('invalidid', 'assignment');
         }
 
         if (! $course = get_record("course", "id", $assignment->course)) {
-            print_error("Course is misconfigured");
+            print_error('coursemisconf', 'assignment');
         }
     } else {
         if (!$assignment = get_record("assignment", "id", $a)) {
-            print_error("Course module is incorrect");
+            print_error('invalidcoursemodule');
         }
         if (! $course = get_record("course", "id", $assignment->course)) {
-            print_error("Course is misconfigured");
+            print_error('coursemisconf', 'assignment');
         }
         if (! $cm = get_coursemodule_from_instance("assignment", $assignment->id, $course->id)) {
-            print_error("Course Module ID was incorrect");
+            print_error('invalidcoursemodule');
         }
     }
 
index 63df4d05e45edc22ee00138abb78e1479003d675..85018ec47cc8f2d9e3e0452afec55059e1255b4d 100644 (file)
@@ -8,29 +8,29 @@
     $userid = required_param('userid', PARAM_INT);  // User ID
 
     if (! $cm = get_coursemodule_from_id('assignment', $id)) {
-        print_error("Course Module ID was incorrect");
+        print_error('invalidcoursemodule');
     }
 
     if (! $assignment = get_record("assignment", "id", $cm->instance)) {
-        print_error("Assignment ID was incorrect");
+        print_error('invalidid', 'assignment');
     }
 
     if (! $course = get_record("course", "id", $assignment->course)) {
-        print_error("Course is misconfigured");
+        print_error('coursemisconf', 'assignment');
     }
 
     if (! $user = get_record("user", "id", $userid)) {
-        print_error("User is misconfigured");
+        print_error('usermisconf', 'assignment');
     }
 
     require_login($course->id, false, $cm);
 
     if (($USER->id != $user->id) && !has_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE, $cm->id))) {
-        print_error("You can not view this assignment");
+        print_error('cannotviewassignment', 'assignment');
     }
 
     if ($assignment->assignmenttype != 'online') {
-        print_error("Incorrect assignment type");
+        print_error('invalidtype', 'assignment');
     }
 
     $assignmentinstance = new assignment_online($cm->id, $assignment, $cm, $course);
index aaa0f335c63d82a08c8f28919ae89523ee62eab0..b0390e3629ca2c2b8e7cf3b5d6ecb0c1f381afcb 100644 (file)
@@ -105,7 +105,7 @@ class assignment_upload extends assignment_base {
 
     /// We need the teacher info
         if (!$teacher = get_record('user', 'id', $graded_by)) {
-            print_error('Could not find the teacher');
+            print_error('cannotfindteacher');
         }
 
     /// Print the feedback
@@ -466,7 +466,7 @@ class assignment_upload extends assignment_base {
             case 'editnotes':
                 $this->upload_notes();
             default:
-                print_error('Error: Unknow upload action ('.$action.').');
+                print_error('unknowuploadaction', '', '', $action);
         }
     }
 
index 77cc82a6bb1f02a237d089840a7105fab1abb601..0ac6afec855d9018edf64701d87eab943d4f116d 100644 (file)
     $mode   = optional_param('mode', '', PARAM_ALPHA);
 
     if (! $cm = get_coursemodule_from_id('assignment', $id)) {
-        print_error("Course Module ID was incorrect");
+        print_error('invalidcoursemodule');
     }
 
     if (! $assignment = get_record('assignment', 'id', $cm->instance)) {
-        print_error("Assignment ID was incorrect");
+        print_error('invalidid', 'assignment');
     }
 
     if (! $course = get_record('course', 'id', $assignment->course)) {
-        print_error("Course is misconfigured");
+        print_error('coursemisconf', 'assignment');
     }
 
     if (! $user = get_record('user', 'id', $userid)) {
-        print_error("User is misconfigured");
+        print_error("invaliduserid");
     }
 
     require_login($course->id, false, $cm);
 
     if (!has_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE, $cm->id))) {
-        print_error("You can not view this assignment");
+        print_error('cannotviewassignment', 'assignment');
     }
 
     if ($assignment->assignmenttype != 'upload') {
-        print_error("Incorrect assignment type");
+        print_error('invalidtype', 'assignment');
     }
 
     $assignmentinstance = new assignment_upload($cm->id, $assignment, $cm, $course);
index 759a4724c88f01a30284e5367e036ca5c7cdbe26..0a0509fe529607f128e292d0383c3ccdaea3b9f6 100644 (file)
@@ -8,25 +8,25 @@
 
     if ($id) {
         if (! $cm = get_coursemodule_from_id('assignment', $id)) {
-            print_error("Course Module ID was incorrect");
+            print_error('invalidcoursemodule');
         }
 
         if (! $assignment = get_record("assignment", "id", $cm->instance)) {
-            print_error("assignment ID was incorrect");
+            print_error('invalidid', 'assignment');
         }
 
         if (! $course = get_record("course", "id", $assignment->course)) {
-            print_error("Course is misconfigured");
+            print_error('coursemisconf', 'assignment');
         }
     } else {
         if (!$assignment = get_record("assignment", "id", $a)) {
-            print_error("Course module is incorrect");
+            print_error('invalidcoursemodule');
         }
         if (! $course = get_record("course", "id", $assignment->course)) {
-            print_error("Course is misconfigured");
+            print_error('invalidid', 'assignment');
         }
         if (! $cm = get_coursemodule_from_instance("assignment", $assignment->id, $course->id)) {
-            print_error("Course Module ID was incorrect");
+            print_error('invalidcoursemodule', 'assignement');
         }
     }
 
index 123b54a2d469ce926e40599f52e17c3aad1e2aa5..2499c98bae9568c52e55b2dec1467db0a42354bb 100644 (file)
@@ -8,25 +8,25 @@
 
     if ($id) {
         if (! $cm = get_coursemodule_from_id('assignment', $id)) {
-            print_error("Course Module ID was incorrect");
+            print_error('invalidcoursemodule');
         }
 
         if (! $assignment = get_record("assignment", "id", $cm->instance)) {
-            print_error("assignment ID was incorrect");
+            print_error('invalidid', 'assignment');
         }
 
         if (! $course = get_record("course", "id", $assignment->course)) {
-            print_error("Course is misconfigured");
+            print_error('coursemisconf', 'assignment');
         }
     } else {
         if (!$assignment = get_record("assignment", "id", $a)) {
-            print_error("Course module is incorrect");
+            print_error('invalidid', 'assignment');
         }
         if (! $course = get_record("course", "id", $assignment->course)) {
-            print_error("Course is misconfigured");
+            print_error('coursemisconf', 'assignment');
         }
         if (! $cm = get_coursemodule_from_instance("assignment", $assignment->id, $course->id)) {
-            print_error("Course Module ID was incorrect");
+            print_error('invalidcoursemodule');
         }
     }