]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, remove the rest error() in moodle2"
authordongsheng <dongsheng>
Fri, 12 Dec 2008 04:53:32 +0000 (04:53 +0000)
committerdongsheng <dongsheng>
Fri, 12 Dec 2008 04:53:32 +0000 (04:53 +0000)
16 files changed:
admin/dbtransfer/index.php
admin/report/courseoverview/index.php
auth/shibboleth/login.php
backup/restore.php
blocks/rss_client/block_rss_client_action.php
course/report/log/indexlive.php
course/report/stats/index.php
group/delete.php
lang/en_utf8/block_rss_client.php
lang/en_utf8/error.php
lang/en_utf8/question.php
lib/dml/pdo_moodle_database.php
lib/packer/zip_archive.php
mod/quiz/addrandom.php
mod/scorm/loadSCO.php
question/type/questiontype.php

index 66bc1d8fae11ba294958eff91cd59510c22cddb2..76bb6c941823e5f983241f459e06caf8bbdf9805 100644 (file)
@@ -18,7 +18,7 @@ if ($data = $form->get_data()) {
     }
     if ($targetdb->get_tables()) {
         // TODO add exception or string...
-        error('Sorry, tables already exist in selected database. Can not continue.'); 
+        print_error('ddltablealreadyexists'); 
     }
     admin_externalpage_print_header();
     dbtransfer_transfer_database($DB, $targetdb);
index 645ce9665b64baeda42a948a1549f91aa85528f6..b819514133a156d36361f664f601d21e887f1812 100644 (file)
@@ -15,7 +15,7 @@
         if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
             redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
         } else {
-            error("Stats is not enabled.");
+            print_error('statsdisable');
         }
     }
 
index 32c14781204d87e4ba3542d135ca6d0aa3a3281b..d27c117906556f0b6d4d05f95a7a8b7356f0661d 100644 (file)
@@ -21,7 +21,7 @@ httpsrequired();
 
 /// Define variables used in page
     if (!$site = get_site()) {
-        error("No site found!");
+        print_error('nosite');
     }
 
     if (empty($CFG->langmenu)) {
index 602bdd4264a7c2dac957827577d6c7bd1feab3ca..f79fd96499ee3230cb93dc1438849e96f558b5a0 100644 (file)
@@ -25,7 +25,7 @@
 
     //Get and check course
     if (! $course = get_record("course", "id", $id)) {
-        error("Course ID was incorrect (can't find it)");
+        print_error('invalidcourseid');
     }
     // To some reasons, course_startdateoffset value was lost during restoring
     // See MDL-17469
index f8171255e905b5e8a6e7e0d0234c89dca56de76a..798268198760ab8821779770a06762f15d9b5544 100644 (file)
@@ -102,10 +102,7 @@ if (isset($rss_record)) {
 if ($act == 'updfeed') {
 
     if (!$managefeeds) {
-        //error(get_string('noguestpost', 'forum').
-        //        ' You are not allowed to make modifications to this RSS feed at this time.',
-        //        $referrer);
-        print_error('noguestpost', 'forum', $referrer, 'You are not allowed to make modifications to this RSS feed at this time.');
+        print_error('cannotmakemodification', 'rss_client', $referrer);
     }
 
 
@@ -227,10 +224,7 @@ if ($act == 'updfeed') {
 } else if ($act == 'delfeed') {
 
     if (!$managefeeds) {
-        //error(get_string('noguestpost', 'forum').
-        //        ' You are not allowed to make modifications to this RSS feed at this time.',
-        //        $referrer);
-        print_error('noguestpost', 'forum', $referrer, 'You are not allowed to make modifications to this RSS feed at this time.');
+        print_error('cannotmakemodification', 'rss_client', $referrer);
     }
 
     $file = $CFG->dataroot .'/cache/rsscache/'. $rssid .'.xml';
index 8c59224a92b65291980a3bd23f25b90f39c87cb4..67aa3c6f210d2b622334f776231cf6da5f0989af 100644 (file)
@@ -9,7 +9,7 @@
     $id = optional_param('id', 0, PARAM_INT);// Course ID
 
     if (!$course = $DB->get_record('course', array('id'=>$id)) ) {
-        error('That\'s an invalid course id'.$id);
+        print_error('invalidcourseid');
     }
 
     require_login($course);
index 453c33abc43b6ab26c7171162d260a612298ccba..73c0c22010a9a2da7e805582871683b2ef317e84 100644 (file)
@@ -66,7 +66,7 @@
         if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
             redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
         } else {
-            error("Stats is not enabled.");
+            print_error('statsdisable');
         }
     }
 
index f06e2d8f400871c86010d99cfc4db00f2de40973..8589380635517dbb2d08327c5af41fe69ccef906 100644 (file)
@@ -18,7 +18,7 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
 
 // Make sure course is OK and user has access to manage groups
 if (!$course = $DB->get_record('course', array('id' => $courseid))) {
-    error('Course ID was incorrect');
+    print_error('invalidcourseid');
 }
 require_login($course);
 $context = get_context_instance(CONTEXT_COURSE, $course->id);
@@ -29,10 +29,10 @@ $groupidarray = explode(',',$groupids);
 $groupnames = array();
 foreach($groupidarray as $groupid) {
     if (!$group = $DB->get_record('groups', array('id' => $groupid))) {
-        error('Group ID was incorrect');
+        print_error('invalidgroupid');
     }
     if ($courseid != $group->courseid) {
-        error('Group not on required course');
+        print_error('groupunknown', '', '', $group->courseid);
     }
     $groupnames[] = format_string($group->name);
 }
index dabd66071faf3a6ecbe037d3025595ced8e2ae64..280fd944cc4a785b4ff92bcbc23a92f13d857824 100644 (file)
@@ -6,6 +6,7 @@ $string['addfeed'] = 'Add a news feed URL:';
 $string['addheadlineblock'] = 'Add RSS headline block';
 $string['addnew'] = 'Add New';
 $string['blockname'] = 'RSS Client';
+$string['cannotmakemodification'] = 'You are not allowed to make modifications to this RSS feed at this time.';
 $string['choosefeedlabel'] = 'Choose the feeds which you would like to make available in this block:';
 $string['clientchannellink'] = 'Source site...';
 $string['clientnumentries'] = 'The default number of entries to show per feed.';
index 959fc82715b31bb528f612757e68515a9e50212c..8afb051ccaa810202a5694417a8ddbbccd58d53d 100644 (file)
@@ -97,6 +97,7 @@ $string['cannotopencsv'] = 'Cannot open CSV file';
 $string['cannotopenforwrit'] = 'Cannot open for writing: $a';
 $string['cannotopenfile'] = 'Cannot open file ($a)';
 $string['cannotopentemplate'] = 'Cannot open template file ($a)';
+$string['cannotopenzip'] = 'Can not open zip file, probably zip extension bug on 64bit os';
 $string['cannotoverridebaserole'] = 'Cannot override base role capabilities';
 $string['cannotoverriderolehere'] = 'You are not allowed to override this role (id = $a->roleid) in this context ($a->context)';
 $string['cannotreadtmpfile'] = 'Error reading temporary file';
@@ -408,6 +409,7 @@ $string['tagnotfound'] = 'The specified tag was not found in the database';
 $string['tagdisabled'] = 'Tags are disabled!';
 $string['themenotinstall'] = 'This theme is not installed!';
 $string['transactionvoid'] = 'Transaction cannot be voided because it has already been voided';
+$string['TODO'] = 'TODO';
 $string['importformatnotimplement'] = 'Sorry, importing this format is not yet implemented!';
 $string['unicodeupgradeerror'] = 'Sorry, but your database is not already in Unicode, and this version of Moodle is not able to migrate your database to Unicode.  Please upgrade to Moodle 1.7.x first and perform the Unicode migration from the Admin page.  After that is done you should be able to migrate to Moodle $a';
 $string['unspecifycourseid'] = 'Must specify course id, short name or idnumber';
index 2f87805d451292723b2899c416c8b7e4ba674373..fb5c859d19af323364b0407029d8e0ef019e8365 100644 (file)
@@ -114,6 +114,7 @@ $string['maketoplevelitem'] = 'Move to top level';
 $string['missingoption'] = 'The cloze question $a is missing its options';
 $string['missingimportantcode'] = 'This question type is missing important code: $a.';
 $string['missingcourseorcmid'] = 'Need to provide courseid or cmid to print_question.';
+$string['missingcourseorcmidtolink'] = 'Need to provide courseid or cmid to get_question_edit_link.';
 $string['modified'] = 'Last saved';
 $string['move']= 'Move from $a and change links.';
 $string['movecategory']= 'Move Category';
index 8cfbb654e785730aeeb2ac7d8bccebeb8684521e..0714ab9420f6b2dba5912363ac8346854cb865a3 100644 (file)
@@ -498,8 +498,8 @@ abstract class pdo_moodle_database extends moodle_database {
                 array_unshift($params, $newvalue);
                 break;
             default:
-                $this->lastError = 'Unknown parameter type in file ' . __FILE__ . ' on line ' . __LINE__ . '.';
-                error($this->lastError);
+                $this->lastError = __FILE__ . ' LINE: ' . __LINE__ . '.';
+                print_error(unknowparamtype, 'error', '', $this->lastError);
             }
         }
         $sql = "UPDATE {{$table}} SET $newfield $select";
@@ -508,11 +508,11 @@ abstract class pdo_moodle_database extends moodle_database {
     }
 
     public function sql_concat() {
-        error('TODO');
+        print_error('TODO');
     }
 
     public function sql_concat_join($separator="' '", $elements=array()) {
-        error('TODO');
+        print_error('TODO');
     }
 
     public function begin_sql() {
index 4933e1c8e4e8d4a6be504817e2fac1edb5621661..c889235d6eda97b0ccc7853c7de8135c71167601 100644 (file)
@@ -194,7 +194,7 @@ class zip_archive extends file_archive {
             $this->close();
             $res = $this->open($this->archivepathname, file_archive::OPEN, $this->encoding);
             if ($res !== true) {
-                error('Can not open zip file, probably zip extension bug on 64bit os'); //TODO ??
+                print_error('cannotopenzip'); //TODO ??
             }
         }
 
@@ -225,7 +225,7 @@ class zip_archive extends file_archive {
             $this->close();
             $res = $this->open($this->archivepathname, file_archive::OPEN, $this->encoding);
             if ($res !== true) {
-                error('Can not open zip file, probably zip extension bug on 64bit os'); //TODO ??
+                print_error('cannotopenzip'); //TODO ??
             }
         }
         $this->usedmem += strlen($contents);
@@ -301,4 +301,4 @@ class zip_archive extends file_archive {
 
         return ($this->pos < $this->count());
     }
-}
\ No newline at end of file
+}
index e5c4e4caf36013d19d2f103b6f7474ae61f0cdc6..66696b8d94ec64c1ab73d6b43f30655b0716d83c 100644 (file)
@@ -47,7 +47,7 @@
 
     // Get the course object and related bits.
     if (! $course = $DB->get_record("course", array("id"=> $quiz->course))) {
-        error("This course doesn't exist");
+        print_error('invalidcourseid');
     }
     //you need mod/quiz:manage in addition to question capabilities to access this page.
     require_capability('mod/quiz:manage', $contexts->lowest());
@@ -60,7 +60,7 @@
     print_header_simple($streditingquiz, '', $navigation, "", "", true, $strupdatemodule);
 
     if (!$quizname = $DB->get_field($cm->modname, 'name', array('id'=> $cm->instance))) {
-                error('Cannot get the module name in build navigation.');
+                print_error('invalidcoursemodule');
     }
 
     print_heading(get_string("addrandomquestiontoquiz","quiz",$quizname), 'left', 2);
@@ -69,4 +69,4 @@
     $qcobject->display_randomquestion_user_interface($addonpage);
 
     print_footer($course);
-?>
\ No newline at end of file
+?>
index 3e9d77188bf7b4875bc61173c247e61c9cad0149..5cf4110d949c49196fb022ccf38c11b85c9b0bc8 100755 (executable)
@@ -38,9 +38,9 @@
     $timenow = time();
     if ($scorm->timeclose !=0) {
         if ($scorm->timeopen > $timenow) {
-            error(get_string("notopenyet", "scorm", userdate($scorm->timeopen)));
+            print_error('notopenyet', 'scorm', null, userdate($scorm->timeopen));
         } else if ($timenow > $scorm->timeclose) {
-            error(get_string("expired", "scorm", userdate($scorm->timeclose)));
+            print_error('expired', 'scorm', null, userdate($scorm->timeclose));
         }
     }
 
               }
         ?>
     </body>
-</html>
\ No newline at end of file
+</html>
index 86a83d891bd64ad329956111ef3431085576c79b..9ee48227eb2246c3a9ee1e2dde25e35d5b7c58ef 100644 (file)
@@ -1030,7 +1030,7 @@ class default_questiontype {
         } else if (!empty($cmoptions->course)) {
             $linkurl .= '&amp;courseid=' . $cmoptions->course;
         } else {
-            error('Need to provide courseid or cmid to get_question_edit_link.');
+            print_error('missingcourseorcmidtolink', 'question');
         }
 
     /// Work out the contents of the link.