]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-14129, fix error() in moodle2"
authordongsheng <dongsheng>
Fri, 12 Dec 2008 05:45:43 +0000 (05:45 +0000)
committerdongsheng <dongsheng>
Fri, 12 Dec 2008 05:45:43 +0000 (05:45 +0000)
28 files changed:
admin/lang.php
admin/roles/tabs.php
admin/xmldb/index.php
auth/ldap/auth.php
backup/backup_execute.html
backup/restore_check.html
backup/restore_precheck.html
backup/restorelib.php
blog/header.php
blog/lib.php
grade/import/csv/index.php
grade/report/lib.php
lang/en_utf8/access.php
lang/en_utf8/admin.php
lang/en_utf8/auth.php
lang/en_utf8/error.php
lang/en_utf8/glossary.php
lang/en_utf8/grades.php
lang/en_utf8/xmldb.php
lib/accesslib.php
mod/glossary/formats.php
mod/lesson/essay.php
mod/lesson/format.php
mod/resource/type/ims/deploy.php
mod/resource/type/ims/preview.php
mod/resource/type/ims/repository_deploy.php
mod/resource/type/ims/resource.class.php
question/type/questiontype.php

index abb1ed238917c2f5abab45a2a36892a7ecc62ea0..d0349f1d377de02bf47e3c67cc7d710dd931c19e 100644 (file)
 
     if ($mode == 'missing') {
         if (!file_exists($langdir)) {
-            error ('to edit this language pack, you need to put it in '.$CFG->dataroot.'/lang');
+            print_error('invalidlangpack');
         }
 
         // Following variables store the HTML output to be echo-ed
index 05116468e04dd796095a319daafbe76f191af8cb..830004dcc4a6b7dcc7e7635c952702185039a532 100755 (executable)
@@ -164,7 +164,7 @@ if ($currenttab != 'update') {
             break;
 
         default:
-            error ('This is an unknown context (' . $context->contextlevel . ') in admin/roles/tabs.php!');
+            print_error('unknowncontext');
             return false;
 
     }
index ca048aea9ac2c1ea000fa022a622cad80da4185f..16a00f9fa5ee83a25f905e73edd4fd7546d0950b 100644 (file)
                 print_error('xmldberror');
             }
         } else {
-            error ("Error: cannot instantiate class (actions/$action/$actionclass)");
+            $a = new stdclass;
+            $a->action = $action;
+            $a->actionclass = $actionclass;
+            print_error('cannotinstantiateclass', 'xmldb', '', $a);
         }
     } else {
-        error ("Error: wrong action specified ($action)");
+        print_error('invalidaction');
     }
 
     if ($xmldb_action->getDoesGenerate() != ACTION_GENERATE_XML) {
index 2cddfe5a2b5eab5ace0bc6a2d5d491e6858ef73f..c2f674c64d25da0ba5d9e55f39beefce474082be 100644 (file)
@@ -355,7 +355,7 @@ class auth_plugin_ldap extends auth_plugin_base {
                 // strings (UCS-2 Little Endian format) and surrounded with
                 // double quotes. See http://support.microsoft.com/?kbid=269190
                 if (!function_exists('mb_convert_encoding')) {
-                    print_error ('auth_ldap_no_mbstring', 'auth');
+                    print_error('auth_ldap_no_mbstring', 'auth');
                 }
 
                 // First create the user account, and mark it as disabled.
@@ -366,7 +366,7 @@ class auth_plugin_ldap extends auth_plugin_base {
                 $userdn = 'cn=' .  $this->ldap_addslashes($extusername) .
                           ',' . $this->config->create_context;
                 if (!ldap_add($ldapconnection, $userdn, $newuser)) {
-                    print_error ('auth_ldap_ad_create_req', 'auth');
+                    print_error('auth_ldap_ad_create_req', 'auth');
                 }
 
                 // Now set the password
@@ -376,7 +376,7 @@ class auth_plugin_ldap extends auth_plugin_base {
                 if(!ldap_modify($ldapconnection, $userdn, $newuser)) {
                     // Something went wrong: delete the user account and error out
                     ldap_delete ($ldapconnection, $userdn);
-                    print_error ('auth_ldap_ad_create_req', 'auth');
+                    print_error('auth_ldap_ad_create_req', 'auth');
                 }
                 $uadd = true;
                 break;
@@ -918,7 +918,7 @@ class auth_plugin_ldap extends auth_plugin_base {
                                                  & (~AUTH_AD_ACCOUNTDISABLE);
                 break;
             default:
-                error ('auth: ldap user_activate() does not support selected usertype:"'.$this->config->user_type.'" (..yet)');
+                print_error('user_activatenotsupportusertype', 'auth', '', $this->config->user_type);
         }
         $result = ldap_modify($ldapconnection, $userdn, $newinfo);
         ldap_close($ldapconnection);
@@ -953,7 +953,7 @@ class auth_plugin_ldap extends auth_plugin_base {
                                                  | AUTH_AD_ACCOUNTDISABLE;
                 break;
             default:
-                error ('auth: ldap user_disable() does not support selected usertype (..yet)');
+                print_error('user_disablenotsupportusertype', 'auth');
         }
         $result = ldap_modify($ldapconnection, $userdn, $newinfo);
         ldap_close($ldapconnection);
index 5eb083d0240d6061170dd7ec6edd2029945a4a47..7c4bfc86ae5e24686044d7a291559c64aaae86a5 100644 (file)
@@ -69,8 +69,7 @@
     echo "</table>";
     
     if (!$status) {
-        error ("The backup did not complete successfully", 
-               "$CFG->wwwroot/course/view.php?id=$course->id");
+        print_error('error', 'error', "$CFG->wwwroot/course/view.php?id=$course->id");
     }
 
     if (empty($to)) {
index 0a0eca910a0ff33ea50754d30d01d0e56ee13a36..6c2a4c6bd3bd8b5b5ab7e552c4a0d73eddfc2d6f 100644 (file)
             echo "</div>";
         } else {
             //Show error
-            error ("Something was wrong checking restore preferences");
+            print_error('error');
         }
 
     //If we are here. Something must be wrong. Debug !!!
         print_object($restore);
         print_object($info);
         print_object($course_header);
-        error ("Something must be wrong");
+        print_error('error');
     }
 
 ?>
index 84b7eb44e2db98e37fe17a473c2763e8a822b1d4..e14d2fbe873e8810651eb96019e6058e7496f170 100644 (file)
@@ -6,7 +6,7 @@
 
     //Checks we have the file variable
     if (!isset($file)) {         
-        error ("File not specified");
+        print_error('nofile');
     }
 
     //Check login   
index ba6ebd4194082a37eff7180708bf18c062166bd3..4899a94774776282afdfe79d7109e4e3f06dcd71 100644 (file)
@@ -7284,7 +7284,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
         //Check the file exists
         if (!is_file($file)) {
             if (!defined('RESTORE_SILENTLY')) {
-                error ("File not exists ($file)");
+                print_error('nofile');
             } else {
                 $errorstr = "File not exists ($file)";
                 return false;
@@ -7294,9 +7294,9 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
         //Check the file name ends with .zip
         if (!substr($file,-4) == ".zip") {
             if (!defined('RESTORE_SILENTLY')) {
-                error ("File has an incorrect extension");
+                print_error('incorrectext');
             } else {
-                $errorstr = 'File has an incorrect extension';
+                $errorstr = get_string('incorrectext', 'error');
                 return false;
             }
         }
@@ -7463,7 +7463,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
 
         if (!$status) {
             if (!defined('RESTORE_SILENTLY')) {
-                error ("An error has ocurred");
+                print_error('error');
             } else {
                 $errorstr = "An error has occured"; // helpful! :P
                 return false;
index 619bd8862fe7122bd12d8ca9d8a7f14c056616a9..58b0d23f8500522eb8a3e3a110dd37947832c217 100755 (executable)
@@ -231,7 +231,7 @@ $navlinks = array();
         break;
 
         default:
-            error ('Error unknown filtertype');
+            print_error('unknownfiletype');
         break;
     }
 
index de5501c626346bb90212a3d34b3747eb1cca7ea9..d5ec5104a0c22f298ade9a4602fa1ed9510d3805 100755 (executable)
 
         /*
         if (!blog_user_can_view_user_post($template['userid'])) {
-            error ('you can not view this post');
+            print_error('cannotviewuserblog', 'blog');
         }*/
 
         $stredit = get_string('edit');
index 7c4e95a7415705341f2b223e9ed966ea45555254..ace73d7e4bf27afb5463aedad7cf214eca092e25 100755 (executable)
@@ -177,7 +177,7 @@ if ($formdata = $mform->get_data()) {
             $h = trim($h); $header[$i] = $h; // remove whitespace
         }
     } else {
-        error ('could not open file');
+        print_error('cannotopenfile');
     }
 
     $map = array();
@@ -481,7 +481,7 @@ if ($formdata = $mform->get_data()) {
         // temporary file can go now
         unlink($filename);
     } else {
-        error ('import file '.$filename.' not readable');
+        print_error('cannotreadfil');
     }
 
 } else {
index 7667802983ac5e8010216bd249d050bb87fe6432..f1e2556ca4662479602dcd5a79cee781d2b3ace2 100755 (executable)
@@ -144,7 +144,7 @@ abstract class grade_report {
         global $CFG, $COURSE, $DB;
 
         if (empty($CFG->gradebookroles)) {
-            error ('no roles defined in admin->appearance->graderoles');
+            print_error('norolesdefined', 'grades');
         }
 
 
index 27bbdfa0d1a3b386ba742e7f9311a0027bdce0c6..0331636991c24e1f624cd8d4d59873b35072e7b0 100644 (file)
@@ -10,6 +10,7 @@ $string['accessstatement'] = 'Accessibility statement';
 $string['activitynext'] = 'Next activity';
 $string['activityprev'] = 'Previous activity';
 $string['breadcrumb'] = 'Breadcrumb trail';
+$string['cannotdeleterolenoadmin'] = 'You can not delete this role because there is no other admin roles with users assigned';
 $string['currentweek'] = 'This week ';
 $string['currenttopic'] = 'This topic ';
 $string['monthnext'] = 'Next month';
index 295d973fcd87ad144a699d5f7f4d772284e4931c..51422a6d015b31e3fbd94a21a63711c2a2aa7229 100644 (file)
@@ -450,6 +450,7 @@ $string['installedlangs'] = 'Installed language packs';
 $string['intcachemax'] = 'Int. cache max';
 $string['invalidsection'] = 'Invalid section.';
 $string['invaliduserchangeme'] = 'Username \"changeme\" is reserved -- you cannot create an account with it.';
+$string['invalidlangpack'] = 'to edit this language pack, you need to put it in language folder.';
 $string['ipblocker'] = 'IP Blocker';
 $string['ipblocked'] = 'This site is not available currently.';
 $string['iplookup'] = 'IP address lookup';
index db94c0bc6e683aaef79d32075f9d6cc34e1fb219..2224928b0fde5c4efd58fe696b4f10d466862174 100644 (file)
@@ -9,6 +9,8 @@ $string['forgottenpassword'] = 'If you enter a URL here, it will be used as the
 $string['forgottenpasswordurl'] = 'Forgotten password URL';
 $string['pluginnotenabled'] = 'Authentication plugin \'$a\' is not enabled.';
 $string['pluginnotinstalled'] = 'Authentication plugin \'$a\' is not installed.';
+$string['user_activatenotsupportusertype'] = 'auth: ldap user_activate() does not support selected usertype: $a';
+$string['user_disablenotsupportusertype'] = 'auth: ldap user_disable() does not support selected usertype (..yet)';
 // synchronization
 $string['auth_sync_script'] ='Cron synchronization script';
 $string['auth_dbinsertuser'] ='Inserted user $a[0] id $a[1]';
index 8afb051ccaa810202a5694417a8ddbbccd58d53d..79204fd5ada479e70cf49b2f05500bf7f1d79dbc 100644 (file)
@@ -239,6 +239,7 @@ $string['guestnoeditprofileother'] = 'The guest user profile cannot be edited';
 $string['guestnorate'] = 'Guests are not allowed to rate entries';
 $string['guestsarenotallowed'] = 'The guest user is not allowed to do this';
 $string['hashpoolproblem'] = 'Incorrect pool file content $a.';
+$string['incorrectext'] = 'File has an incorrect extension';
 $string['invalidaction'] = 'Invalid action parameter';
 $string['invalidactivityid'] = 'Invalid Activity ID';
 $string['invalidarguments'] = 'No valid arguments supplied';
@@ -336,6 +337,7 @@ $string['needcoursecategroyid'] = 'Either course id or category must be specifie
 $string['noblocks'] = 'No blocks found!';
 $string['nodata'] = 'No data';
 $string['noformdesc'] = 'No formslib form description file found for this activity.';
+$string['nofile'] = 'File not specified';
 $string['nocategorydelete'] = 'Category \'$a\' cannot be deleted!';
 $string['nocontext'] = 'Sorry, but that course is not a valid context';
 $string['noinstances'] = 'There are no instances of $a in this course!';
@@ -423,6 +425,8 @@ $string['unknowformat'] = 'Format not known ($a)';
 $string['unknowncourse'] = 'Unknown course named \"$a\"';
 $string['unknowncourseidnumber'] = 'Unknown Course ID \"$a\"';
 $string['unknowncourserequest'] = 'Unknown course request';
+$string['unknowncontext'] = 'This is an unknown context.';
+$string['unknownfiletype'] = 'Error unknown filtertype';
 $string['unknownhelp'] = 'Unknown help topic $a';
 $string['unknowngroup'] = 'Unknown group \"$a\"';
 $string['unknownrole'] = 'Unknown role \"$a\"';
index 8d136af9a19ecf1b2fc663eea888866fa948d5d5..54dea3622c8006f9e1a879531e6f771a7af9029d 100644 (file)
@@ -149,6 +149,7 @@ $string['importentries'] = 'Import entries';
 $string['importentriesfromxml'] = 'Import entries from XML file';
 $string['includegroupbreaks'] = 'Include group breaks';
 $string['invalidid'] = 'Incorrect glossary id';
+$string['invalidglossaryformat'] = 'Invalid Glossary Format';
 $string['isglobal'] = 'Is this glossary global?';
 $string['letter'] = 'letter';
 $string['linkcategory'] = 'Automatically link this category';
index 1b261ee3957d4a8c471a443409ac935f86fd69da..0deccd54a0675ffd87f8d2a877f18d1ab21dea37 100644 (file)
@@ -354,6 +354,7 @@ $string['noselectedcategories'] = 'no categories were selected.';
 $string['noselecteditems'] = 'no items were selected.';
 $string['notteachererror'] = 'You must be a teacher to use this feature.';
 $string['nousersloaded'] = 'No users loaded';
+$string['norolesdefined' ] = 'no roles defined in admin->appearance->graderoles';
 $string['numberofgrades'] = 'Number of grades';
 $string['onascaleof'] = ' on a scale of $a->grademin to $a->grademax';
 $string['operations'] = 'Operations';
index f9c4bef65f6d1f47ffb965e5da9bf5d466e6adc1..ad0963140c453bbe547fc5dd3ba18238acff2b06 100644 (file)
@@ -7,6 +7,7 @@ $string['back'] = 'Back';
 $string['backtomainview'] = 'Back To Main';
 $string['binaryincorrectlength'] = 'Incorrect length for binary field';
 $string['cannotuseidfield'] = 'Cannot insert the \"id\" field. It is an autonumeric column';
+$string['cannotinstantiateclass'] = 'Error: cannot instantiate class (actions/$a->action/$a->actionclass)';
 $string['change'] = 'Change';
 $string['charincorrectlength'] = 'Incorrect length for char field';
 $string['checkbigints'] = 'Check bigints';
index 3603875fb49781f3b35187ec20d9af6f2ac15b67..b74c4139fd6e90ba203084773f67d7fdf76d8840 100755 (executable)
@@ -2627,7 +2627,7 @@ function delete_role($roleid) {
                 }
             }
             if ($status !== true) {
-                error ('You can not delete this role because there is no other admin roles with users assigned');
+                print_error('cannotdeleterolenoadmin', 'access');
             }
         }
     }
@@ -3455,7 +3455,7 @@ function print_context_name($context, $withprefix = true, $short = false) {
             break;
 
         default:
-            error ('This is an unknown context (' . $context->contextlevel . ') in print_context_name!');
+            print_error('unknowncontext');
             return false;
     }
 
@@ -4045,7 +4045,7 @@ function get_component_string($component, $contextlevel) {
         break;
 
         default:
-            error ('This is an unknown context $contextlevel (' . $contextlevel . ') in get_component_string!');
+            print_error('unknowncontext');
         return false;
 
     }
index e59c2bff6773bc9a5ea8835a444d81be8c9c8a11..47fd883e6598a1a453cbfc840c8930b3f5553020 100644 (file)
@@ -11,7 +11,7 @@
     admin_externalpage_setup('managemodules'); // this is hacky, tehre should be a special hidden page for it
 
     if ( !$displayformat = $DB->get_record("glossary_formats", array("id"=>$id))) {
-        error ("Invalid Glossary Format");
+        print_error('invalidglossaryformat', 'glossary');
     }
 
     $form = data_submitted();
index 12f6db8ba33709585299e5bc3c25f72d48db2985..0f4fcb7dc3a11bf97d9430f6d5399bb2c488f78c 100644 (file)
                 $params["userid"] = $userid;
             }
             if (!$attempts = $DB->get_records_select('lesson_attempts', "pageid $usql".$queryadd, $params)) {
-                error ('No one has answered essay questions yet...');
+                print_error('nooneansweredthisquestion', 'lesson');
             }
             // Get the answers
             list($answerUsql, $parameters) = $DB->get_in_or_equal(array_keys($pages));
             $parameters["lessonid"] = $lesson->id;
             if (!$answers = $DB->get_records_select('lesson_answers', "lessonid = :lessonid AND pageid $answerUsql", $parameters, '', 'pageid, score')) {
-                error ('Could not find answer records.');
+                print_error('cannotfindanswer', 'lesson');
             }
             $options = new stdClass;
             $options->noclean = true;
index 7e7b306dcd06d48747db453d18c1e1e2cf510395..faa1a3c5126281a82f14ab2b37caa2640a842d3b 100644 (file)
@@ -88,7 +88,7 @@ class qformat_default {
                     if ($pageid) {
                         // the new page follows on from this page
                         if (!$page = $DB->get_record("lesson_pages", array("id" => $pageid))) {
-                            error ("Format: Page $pageid not found");
+                            print_error('invalidpageid', 'lesson');
                         }
                         $newpage->prevpageid = $pageid;
                         $newpage->nextpageid = $page->nextpageid;
index 0eb1fd20f5bf53e1200ce87c7e178deb4629fb1a..631d628040bad4947261ad9e9258aac11addf511 100644 (file)
 
 /// Create directories
     if (!$resourcedir = make_upload_directory($courseid.'/'.$CFG->moddata.'/resource/'.$resource->id)) {
-        error (get_string('errorcreatingdirectory', 'error', $CFG->moddata.'/resource/'.$resource->id));
+        print_error('errorcreatingdirectory', 'error', '', $CFG->moddata.'/resource/'.$resource->id);
     }
 
 /// Ensure it's empty
     if (!delete_dir_contents($resourcedir)) {
-        error (get_string('errorcleaningdirectory', 'error', $resourcedir));
+        print_error('errorcleaningdirectory', 'error', '', $resourcedir);
     }
     
 /// Copy files
     $origin = $CFG->dataroot.'/'.$courseid.'/'.$file;
 
     if (!is_file($origin)) {
-        error (get_string('filenotfound' , 'error', $file));
+        print_error('filenotfound' , 'error', '', $file);
     }
     $mimetype = mimeinfo("type", $file);
     if ($mimetype != "application/zip") {
-        error (get_string('invalidfiletype', 'error', $file));
+        print_error('invalidfiletype', 'error', '', $file);
     }
     $resourcefile = $resourcedir.'/'.basename($origin);
     if (!backup_copy_file($origin, $resourcefile)) {
-        error (get_string('errorcopyingfiles', 'error'));
+        print_error('errorcopyingfiles', 'error');
     }
 
 /// Unzip files
     if (!unzip_file($resourcefile, '', false)) {
-        error (get_string('errorunzippingfiles', 'error'));
+        print_error('errorunzippingfiles', 'error');
     }
 
 /// Check for imsmanifest
     if (!file_exists($resourcedir.'/imsmanifest.xml')) {
-        error (get_string('filenotfound', 'error', 'imsmanifest.xml'));
+        print_error('filenotfound', 'error', '', 'imsmanifest.xml');
     }
 
 /// Load imsmanifest to memory (instead of using a full parser,
 /// we are going to use xmlize intensively (because files aren't too big)
     if (!$imsmanifest = ims_file2var ($resourcedir.'/imsmanifest.xml')) {
-        error (get_string ('errorreadingfile', 'error', 'imsmanifest.xml'));
+        print_error('errorreadingfile', 'error', '', 'imsmanifest.xml');
     }
 
 /// Check if the first line is a proper one, because I've seen some
             $imsmanifest = substr($imsmanifest, $inixml);
         }
     } else {
-        error (get_string ('invalidxmlfile', 'error', 'imsmanifest.xml'));
+        print_error('invalidxmlfile', 'error', '', 'imsmanifest.xml');
     }
 
 /// xmlize the variable
 /// Extract every manifest present in the imsmanifest file.
 /// Returns a tree structure.
     if (!$manifests = ims_extract_manifests($data)) {
-        error (get_string('nonmeaningfulcontent', 'error'));
+        print_error('nonmeaningfulcontent', 'error');
     }
 
 /// Process every manifest found in inverse order so every one 
 /// Parse XML-content package data
 /// First we select an organization an load all the items
     if (!$items = ims_process_organizations($data['manifest']['#']['organizations']['0'])) {
-        error (get_string('nonmeaningfulcontent', 'error'));
+        print_error('nonmeaningfulcontent', 'error');
     }
 
 /// Detect if all the resources share a common xml:base tag
   
 /// Now, we load all the resources available (keys are identifiers)
     if (!$resources = ims_load_resources($data['manifest']['#']['resources']['0']['#']['resource'], $manifest_base, $resources_base)) {
-        error (get_string('nonmeaningfulcontent', 'error'));
+        print_error('nonmeaningfulcontent', 'error');
     }
 ///Now we assign to each item, its resource (by identifier)
     foreach ($items as $key=>$item) {
 
 /// Create the INDEX (moodle_inx.ser - where the order of the pages are stored serialized) file
     if (!ims_save_serialized_file($resourcedir.'/moodle_inx.ser', $items)) {
-        error (get_string('errorcreatingfile', 'error', 'moodle_inx.ser'));
+        print_error('errorcreatingfile', 'error', '', 'moodle_inx.ser');
     }
 
 /// Create the HASH file (moodle_hash.ser - where the hash of the ims is stored serialized) file
     $hash = $resource_obj->calculatefilehash($resourcefile);
     if (!ims_save_serialized_file($resourcedir.'/moodle_hash.ser', $hash)) {
-        error (get_string('errorcreatingfile', 'error', 'moodle_hash.ser'));
+        print_error('errorcreatingfile', 'error', '', 'moodle_hash.ser');
     }
 
 /// End button (go to view mode)
index 3ed5f3dbbbb9608404d9f9ba69a6108f3dadd46a..9840a3af5e2d287364c1d7550838e13c88e78ede 100644 (file)
@@ -30,7 +30,7 @@
 /// Load serialized IMS CP index to memory only once.
     if (empty($items)) {
         if (!$items = ims_load_serialized_file($deploydir.'/moodle_inx.ser')) {
-            error (get_string('errorreadingfile', 'error', 'moodle_inx.ser'));
+            print_error('errorreadingfile', 'error', '', 'moodle_inx.ser');
         }
     }
 
index 8c58ead3c1111e85566fdc83604fddfbeb3c8ef1..4aae690db32468b21738a29964a5b046074de091 100644 (file)
     /// Load imsmanifest to memory (instead of using a full parser,
     /// we are going to use xmlize intensively (because files aren't too big)
         if (!$imsmanifest = ims_file2var ($resourcedir.'/imsmanifest.xml')) {
-            error (get_string ('errorreadingfile', 'error', 'imsmanifest.xml'));
+            print_error('errorreadingfile', 'error', '', 'imsmanifest.xml');
         }
             
     /// Check if the first line is a proper one, because I've seen some
                 return;
             }
             else {
-                error (get_string ('invalidxmlfile', 'error', 'imsmanifest.xml'));
+                print_error('invalidxmlfile', 'error', '', 'imsmanifest.xml');
             }
         }
     
     /// Extract every manifest present in the imsmanifest file.
     /// Returns a tree structure.
         if (!$manifests = ims_extract_manifests($data)) {
-            error (get_string('nonmeaningfulcontent', 'error'));
+            print_error('nonmeaningfulcontent', 'error');
         }
     
     /// Process every manifest found in inverse order so every one 
     /// First we select an organization an load all the items
 
         if (!$items = ims_process_organizations($data['manifest']['#']['organizations']['0'])) {
-            if ($all == 'force') return; else error (get_string('nonmeaningfulcontent', 'error'));
+            if ($all == 'force') {
+                return;
+            } else {
+                print_error('nonmeaningfulcontent', 'error');
+            }
         }
     
     /// Detect if all the resources share a common xml:base tag
       
     /// Now, we load all the resources available (keys are identifiers)
         if (!$resources = ims_load_resources($data['manifest']['#']['resources']['0']['#']['resource'], $manifest_base, $resources_base)) {
-            error (get_string('nonmeaningfulcontent', 'error'));
+            print_error('nonmeaningfulcontent', 'error');
         }
     ///Now we assign to each item, its resource (by identifier)
         foreach ($items as $key=>$item) {
     /// Create the INDEX (moodle_inx.ser - where the order of the pages are stored serialized) file
         $items['title'] = $title;
         if (!ims_save_serialized_file($resourcedir.'/moodle_inx.ser', $items)) {
-            error (get_string('errorcreatingfile', 'error', 'moodle_inx.ser'));
+            print_error('errorcreatingfile', 'error', '', 'moodle_inx.ser');
         }
     
     /// No zip so no HASH
index 0ab7c2ba667ce3ee2cd687b8e01680a2a523b5d0..d1a4bca280ef293c8eacafe918df9787e7515709 100644 (file)
@@ -416,7 +416,7 @@ class resource_ims extends resource_base {
                 $resourcedir = $CFG->repository . $resource->reference;
             }
             if (!$items = ims_load_serialized_file($resourcedir.'/moodle_inx.ser')) {
-                error (get_string('errorreadingfile', 'error', 'moodle_inx.ser'));
+                print_error('errorreadingfile', 'error', '', 'moodle_inx.ser');
             }
         }
 
index 9ee48227eb2246c3a9ee1e2dde25e35d5b7c58ef..4adccba2d8939db5450e493a3f78e420aeeeb3b8 100644 (file)
@@ -1611,7 +1611,7 @@ class default_questiontype {
     /// If anything has changed, update it in the database.
         if ($updateqrec){
             if (!$DB->update_record('question', $question)){
-                error ('Couldn\'t update question '.$question->name);
+                print_error('cannotupdatequestion', 'question');
             }
         }
 
@@ -1630,7 +1630,7 @@ class default_questiontype {
             /// If anything has changed, update it in the database.
                 if ($answerchanged){
                     if (!$DB->update_record('question_answers', $answer)){
-                        error ('Couldn\'t update question ('.$question->name.') answer '.$answer->id);
+                        print_error('cannotupdatequestion', 'question');
                     }
                 }
             }