mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-18293 removing unused error strings (now replaced by exceptions)
This commit is contained in:
parent
644d506ac1
commit
90ee78e21c
@ -64,9 +64,7 @@ if ($mform->is_cancelled()) {
|
||||
$parent_cat = $DB->get_record('course_categories', array('id' => $newcategory->parent));
|
||||
move_category($newcategory, $parent_cat);
|
||||
}
|
||||
if (!$DB->update_record('course_categories', $newcategory)) {
|
||||
print_error( "cannotupdatecategory", '', '', $newcategory->name);
|
||||
}
|
||||
$DB->update_record('course_categories', $newcategory);
|
||||
fix_course_sortorder();
|
||||
|
||||
} else {
|
||||
|
@ -156,9 +156,7 @@
|
||||
if ($cattomove->parent != $moveto) {
|
||||
$newparent = $DB->get_record('course_categories', array('id'=>$moveto));
|
||||
require_capability('moodle/category:manage', get_category_or_system_context($moveto));
|
||||
if (!move_category($cattomove, $newparent)) {
|
||||
print_error('cannotupdatecategory', '', '', format_string($cattomove->name));
|
||||
}
|
||||
move_category($cattomove, $newparent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -174,12 +172,8 @@
|
||||
}
|
||||
require_capability('moodle/category:manage', get_category_or_system_context($tempcat->parent));
|
||||
if ($tempcat) {
|
||||
if (!$DB->set_field('course_categories', 'visible', $visible, array('id'=>$tempcat->id))) {
|
||||
print_error('cannotupdatecategory', '', '', format_string($tempcat->name));
|
||||
}
|
||||
if (!$DB->set_field('course', 'visible', $visible, array('category' => $tempcat->id))) {
|
||||
print_error('cannotshowhidecoursesincategory', '', '', format_string($tempcat->name));
|
||||
}
|
||||
$DB->set_field('course_categories', 'visible', $visible, array('id'=>$tempcat->id));
|
||||
$DB->set_field('course', 'visible', $visible, array('category' => $tempcat->id));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3281,10 +3281,7 @@ function category_delete_move($category, $newparentid, $showfeedback=true) {
|
||||
|
||||
if ($children = $DB->get_records('course_categories', array('parent'=>$category->id), 'sortorder ASC')) {
|
||||
foreach ($children as $childcat) {
|
||||
if (!move_category($childcat, $newparentcat)) {
|
||||
notify("Error moving category $childcat->name");
|
||||
return false;
|
||||
}
|
||||
move_category($childcat, $newparentcat);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3352,22 +3349,18 @@ function move_courses($courseids, $categoryid) {
|
||||
* Efficiently moves a category - NOTE that this can have
|
||||
* a huge impact access-control-wise...
|
||||
*/
|
||||
function move_category ($category, $newparentcat) {
|
||||
function move_category($category, $newparentcat) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$context = get_context_instance(CONTEXT_COURSECAT, $category->id);
|
||||
|
||||
if (empty($newparentcat->id)) {
|
||||
if (!$DB->set_field('course_categories', 'parent', 0, array('id'=>$category->id))) {
|
||||
return false;
|
||||
}
|
||||
$DB->set_field('course_categories', 'parent', 0, array('id'=>$category->id));
|
||||
|
||||
$newparent = get_context_instance(CONTEXT_SYSTEM);
|
||||
|
||||
} else {
|
||||
if (!$DB->set_field('course_categories', 'parent', $newparentcat->id, array('id'=>$category->id))) {
|
||||
return false;
|
||||
}
|
||||
$DB->set_field('course_categories', 'parent', $newparentcat->id, array('id'=>$category->id));
|
||||
$newparent = get_context_instance(CONTEXT_COURSECAT, $newparentcat->id);
|
||||
}
|
||||
|
||||
@ -3378,8 +3371,6 @@ function move_category ($category, $newparentcat) {
|
||||
|
||||
// and fix the sortorders
|
||||
fix_course_sortorder();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,9 +168,7 @@
|
||||
$cm->indent = 0;
|
||||
}
|
||||
|
||||
if (!$DB->set_field('course_modules', 'indent', $cm->indent, array('id'=>$cm->id))) {
|
||||
print_error('cannotupdatelevel');
|
||||
}
|
||||
$DB->set_field('course_modules', 'indent', $cm->indent, array('id'=>$cm->id));
|
||||
|
||||
rebuild_course_cache($cm->course);
|
||||
|
||||
|
@ -298,9 +298,7 @@
|
||||
condition_info::update_cm_from_form($cm,$fromform,true);
|
||||
}
|
||||
|
||||
if (!$DB->update_record('course_modules', $cm)) {
|
||||
print_error('cannotupdatecoursemodule');
|
||||
}
|
||||
$DB->update_record('course_modules', $cm);
|
||||
|
||||
if (!$updateinstancefunction($fromform, $mform)) {
|
||||
print_error('cannotupdatemod', '', 'view.php?id=$course->id', $fromform->modulename);
|
||||
|
@ -129,14 +129,7 @@ $string['cannotsetupcapforplugin'] = 'Could not set up the capabilities for $a';
|
||||
$string['cannotsetupcapformod'] = 'Could not set up the capabilities for $a';
|
||||
$string['cannotshowhidecoursesincategory'] = 'Cannot show/hide the courses in category $a.';
|
||||
$string['cannotunzipfile'] = 'Cannot unzip file';
|
||||
$string['cannotupgradeblock'] = 'Upgrade of blocks system failed! (Could not update version in config table.)';
|
||||
$string['cannotupgradecaps'] = 'Had difficulties upgrading the core capabilities for the Roles system';
|
||||
$string['cannotupdatecategory'] = 'Could not update the category ($a)';
|
||||
$string['cannotupdatecoursemodule'] = 'Could not update the course module';
|
||||
$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['cannotupdaterate'] = 'Could not update an old rating ($a->id = $a->rating)';
|
||||
$string['cannotupdaterecord'] = 'Could not update record ID $a';
|
||||
|
@ -188,11 +188,9 @@ function glossary_comment_edit() {
|
||||
$updatedcomment->format = $data->format;
|
||||
$updatedcomment->timemodified = time();
|
||||
|
||||
if (!$DB->update_record('glossary_comments', $updatedcomment)) {
|
||||
print_error('cannotupdatecomment');
|
||||
} else {
|
||||
add_to_log($course->id, 'glossary', 'update comment', "comments.php?id=$cm->id&eid=$entry->id", "$updatedcomment->id",$cm->id);
|
||||
}
|
||||
$DB->update_record('glossary_comments', $updatedcomment);
|
||||
add_to_log($course->id, 'glossary', 'update comment', "comments.php?id=$cm->id&eid=$entry->id", "$updatedcomment->id",$cm->id);
|
||||
|
||||
redirect("comments.php?id=$cm->id&eid=$entry->id");
|
||||
|
||||
} else {
|
||||
|
@ -68,12 +68,9 @@
|
||||
$cat->name = $name;
|
||||
$cat->usedynalink = $usedynalink;
|
||||
|
||||
if ( !$DB->update_record("glossary_categories", $cat) ) {
|
||||
print_error('cannotupdatecategory');
|
||||
redirect("editcategories.php?id=$cm->id");
|
||||
} else {
|
||||
add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id);
|
||||
}
|
||||
$DB->update_record("glossary_categories", $cat);
|
||||
add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id);
|
||||
|
||||
} else {
|
||||
echo "<p style=\"text-align:center\">" . get_string("edit"). " " . get_string("category","glossary") . "<span style=\"font-size:1.5em\">";
|
||||
|
||||
|
@ -584,9 +584,7 @@ function hotpot_add_chain(&$hotpot) {
|
||||
print_error('cannotaddcoursemoduletosection');
|
||||
}
|
||||
|
||||
if (! $DB->set_field('course_modules', 'section', $sectionid, array("id"=>$hotpot->coursemodule))) {
|
||||
print_error('cannotupdatecoursemodule');
|
||||
}
|
||||
$DB->set_field('course_modules', 'section', $sectionid, array("id"=>$hotpot->coursemodule));
|
||||
|
||||
add_to_log($hotpot->course, "course", "add mod",
|
||||
"../mod/$hotpot->modulename/view.php?id=$hotpot->coursemodule",
|
||||
|
@ -156,13 +156,9 @@ class profile_define_base {
|
||||
|
||||
if (empty($data->id)) {
|
||||
unset($data->id);
|
||||
if (!$data->id = $DB->insert_record('user_info_field', $data)) {
|
||||
print_error('cannotcreatefield');
|
||||
}
|
||||
$data->id = $DB->insert_record('user_info_field', $data);
|
||||
} else {
|
||||
if (!$DB->update_record('user_info_field', $data)) {
|
||||
print_error('cannotupdatefield');
|
||||
}
|
||||
$DB->update_record('user_info_field', $data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -427,13 +423,9 @@ function profile_edit_category($id, $redirect) {
|
||||
if (empty($data->id)) {
|
||||
unset($data->id);
|
||||
$data->sortorder = $DB->count_records('user_info_category') + 1;
|
||||
if (!$DB->insert_record('user_info_category', $data, false)) {
|
||||
print_error('cannotinsertcategory');
|
||||
}
|
||||
$DB->insert_record('user_info_category', $data, false);
|
||||
} else {
|
||||
if (!$DB->update_record('user_info_category', $data)) {
|
||||
print_error('cannotupdatecategory');
|
||||
}
|
||||
$DB->update_record('user_info_category', $data);
|
||||
}
|
||||
profile_reorder_categories();
|
||||
redirect($redirect);
|
||||
|
Loading…
x
Reference in New Issue
Block a user