From: dongsheng Date: Sun, 15 Jun 2008 09:48:42 +0000 (+0000) Subject: "MDL-14129, fix print_error" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d32482383a0409557f8197502e6f33222daa9a14;p=moodle.git "MDL-14129, fix print_error" --- diff --git a/lang/en_utf8/error.php b/lang/en_utf8/error.php index a4d62d8ab7..b365ce87a6 100644 --- a/lang/en_utf8/error.php +++ b/lang/en_utf8/error.php @@ -31,6 +31,7 @@ $string['cannotcreatedefaultcat'] = 'Error creating a default category for conte $string['cannotcreategroup'] = 'Error creating group'; $string['cannotcreatelangdir'] = 'Cannot create lang dir.'; $string['cannotcreatelangbase'] = 'Error: Could not create base lang directory.'; +$string['cannotcreatefield'] = 'Error creating new field'; $string['cannotcreatetempdir'] = 'Cannot create temp dir.'; $string['cannotcreatesitedir'] = 'Cannot create site folder. The site administrator needs to fix the file permissions.'; $string['cannotcreateuploaddir'] = 'Cannot create upload folder. The site administrator needs to fix the file permissions'; @@ -41,7 +42,9 @@ $string['cannotcustomizelocallang'] = 'You do not have permission to customize t $string['cannotdeletelangcache'] = 'Language cache can not be deleted, please fix permissions in dataroot/cache/languages!'; $string['cannotdeletebackupids'] = 'Couldn\'t delete previous backup ids.'; $string['cannotdeletecap'] = 'Could not delete deprecated capability $a'; +$string['cannotdeletecate'] = 'Error while deliting category'; $string['cannotdeletecourse'] = 'You do not have the permission to delete this course.'; +$string['cannotdeletecustomfield'] = 'Error deleting custom field data'; $string['cannotdeleterole'] = 'It can not be deleted, because $a'; $string['cannotdeleterolewithid'] = 'Could not delete role with ID $a'; $string['cannotdownloadcomponents'] = 'Cannot download components.'; @@ -115,6 +118,7 @@ $string['cannotupdatecategory'] = 'Could not update the category ($a)'; $string['cannotupdatecoursemodule'] = 'Could not update the course module with the correct section'; $string['cannotupdatecomment'] = 'Could not update this comment'; $string['cannotupdatecm'] = 'Could not update the course module with the correct section'; +$string['cannotupdatefield'] = 'Error updating field'; $string['cannotupdatelevel'] = 'Could not update the indent level on that course module'; $string['cannotupdategroup'] = 'Error updating group'; $string['cannotupdaterecord'] = 'Could not update record ID $a'; @@ -126,6 +130,7 @@ $string['cannotupdateuseronexauth'] = 'Failed to update user data on external au $strign['cannotupdatepasswordonextauth'] = 'Failed to update password on external auth: $a. See the server logs for more details.'; $string['cannotupdateplugincap'] = 'Could not update $a capabilities!'; $string['cannotupdateprofile'] = 'Error updating user record'; +$string['cannotupdatecustomprofile'] = 'Error updating user custom record'; $stirng['cannotupdaterss'] = 'Cannot update rss'; $string['cannotupdatesummary'] = 'Could not update the summary!'; $string['cannotupdatesubcate'] = 'Could not update a child category!'; diff --git a/user/filters/lib.php b/user/filters/lib.php index 3893f35f02..bcb6624504 100644 --- a/user/filters/lib.php +++ b/user/filters/lib.php @@ -229,7 +229,7 @@ class user_filter_type { * @return string the filtering condition or null if the filter is disabled */ function get_sql_filter($data) { - print_error('Abstract method get_sql_filter() called - must be implemented'); + print_error('mustbeoveride', 'debug', '', 'get_sql_filter'); } /** @@ -238,7 +238,7 @@ class user_filter_type { * @return mixed array filter data or false when filter not set */ function check_data($formdata) { - print_error('Abstract method check_data() called - must be implemented'); + print_error('mustbeoveride', 'debug', '', 'check_data'); } /** @@ -246,7 +246,7 @@ class user_filter_type { * @param object $mform a MoodleForm object to setup */ function setupForm(&$mform) { - print_error('Abstract method setupForm() called - must be implemented'); + print_error('mustbeoveride', 'debug', '', 'setupForm'); } /** @@ -255,6 +255,6 @@ class user_filter_type { * @return string active filter label */ function get_label($data) { - print_error('Abstract method get_label() called - must be implemented'); + print_error('mustbeoveride', 'debug', '', 'get_label'); } } diff --git a/user/profile/definelib.php b/user/profile/definelib.php index 7d65d62834..afd0791fcd 100644 --- a/user/profile/definelib.php +++ b/user/profile/definelib.php @@ -154,11 +154,11 @@ class profile_define_base { if (empty($data->id)) { unset($data->id); if (!$data->id = $DB->insert_record('user_info_field', $data)) { - print_error('Error creating new field'); + print_error('cannotcreatefield'); } } else { if (!$DB->update_record('user_info_field', $data)) { - print_error('Error updating field'); + print_error('cannotupdatefield'); } } } @@ -229,11 +229,11 @@ function profile_delete_category($id) { /// Retrieve the category if (!$category = $DB->get_record('user_info_category', array('id'=>$id))) { - print_error('Incorrect category id'); + print_error('invalidcategoryid'); } if (!$categories = $DB->get_records('user_info_category', null, 'sortorder ASC')) { - print_error('Error no categories!?!?'); + print_error('nocate', 'debug'); } unset($categories[$category->id]); @@ -268,7 +268,7 @@ function profile_delete_category($id) { /// Finally we get to delete the category if (!$DB->delete_records('user_info_category', array('id'=>$category->id))) { - print_error('Error while deliting category'); + print_error('cannotdeletecate'); } profile_reorder_categories(); return true; @@ -280,7 +280,7 @@ function profile_delete_field($id) { /// Remove any user data associated with this field if (!$DB->delete_records('user_info_data', array('fieldid'=>$id))) { - print_error('Error deleting custom field data'); + print_error('cannotdeletecustomfield'); } /// Try to remove the record from the database @@ -425,11 +425,11 @@ function profile_edit_category($id, $redirect) { unset($data->id); $data->sortorder = $DB->count_records('user_info_category') + 1; if (!$DB->insert_record('user_info_category', $data, false)) { - print_error('There was a problem adding the record to the database'); + print_error('cannotinsertcategory'); } } else { if (!$DB->update_record('user_info_category', $data)) { - print_error('There was a problem updating the record in the database'); + print_error('cannotupdatecategory'); } } profile_reorder_categories(); diff --git a/user/profile/lib.php b/user/profile/lib.php index 607cdaf063..6a9f57322c 100644 --- a/user/profile/lib.php +++ b/user/profile/lib.php @@ -43,7 +43,7 @@ class profile_field_base { * @param form instance of the moodleform class */ function edit_field_add(&$mform) { - print_error('mustbeoveride', 'debug'); + print_error('mustbeoveride', 'debug', '', 'edit_field_add'); }