From 64e71d27b6fdbeea4e983c3918c819d5333c9d21 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Wed, 21 May 2008 06:04:30 +0000 Subject: [PATCH] "MDL-14129, fix print_error" --- question/category_class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/question/category_class.php b/question/category_class.php index 732f38eb76..ca3c513faa 100644 --- a/question/category_class.php +++ b/question/category_class.php @@ -273,7 +273,7 @@ class question_category_object { $this->catform->set_data($category); $this->catform->display(); } else { - print_error("Category $categoryid not found"); + print_error('invalidcategory', '', '', $categoryid); } } @@ -324,11 +324,11 @@ class question_category_object { global $CFG; question_can_delete_cat($categoryid); if (!$category = get_record("question_categories", "id", $categoryid)) { // security - print_error("No such category $cat!", '', $this->pageurl->out()); + print_error('unknowcategory'); } /// Send the children categories to live with their grandparent if (!set_field("question_categories", "parent", $category->parent, "parent", $category->id)) { - print_error("Could not update a child category!", '', $this->pageurl->out()); + print_error('cannotupdatesubcate', 'question'); } /// Finally delete the category itself @@ -372,7 +372,7 @@ class question_category_object { if ($parentid) { if(!(get_field('question_categories', 'contextid', 'id', $parentid) == $contextid)) { - print_error("Could not insert the new question category '$newcategory' illegal contextid '$contextid'."); + print_error('cannotinsertquestioncatecontext', 'question', '', array($newcategory, $contextid)); } } @@ -384,7 +384,7 @@ class question_category_object { $cat->sortorder = 999; $cat->stamp = make_unique_id_code(); if (!insert_record("question_categories", $cat)) { - print_error("Could not insert the new question category '$newcategory'"); + print_error('cannotinsertquestioncate', 'question', '', $newcategory); } else { redirect($this->pageurl->out());//always redirect after successful action } @@ -426,13 +426,13 @@ class question_category_object { if ($oldcat->contextid == $tocontextid){ // not moving contexts $cat->parent = $parentid; if (!update_record("question_categories", $cat)) { - print_error("Could not update the category '$newname'", '', $this->pageurl->out()); + print_error('cannotupdatecate', 'question', $this->pageurl->out(), $newname); } else { redirect($this->pageurl->out()); } } else { if (!update_record("question_categories", $cat)) { - print_error("Could not update the category '$newname'", '', $this->pageurl->out()); + print_error('cannotupdatecate', 'question', $this->pageurl->out(), $newname); } else { redirect($CFG->wwwroot.'/question/contextmove.php?'. $this->pageurl->get_query_string(array('cattomove' => $updateid, @@ -440,7 +440,7 @@ class question_category_object { } } } else { - print_error("Cannot move the category '$newname'. It is the last in this context.", '', $this->pageurl->out()); + print_error('cannotmovecate', 'question', $this->pageurl->out(), $newname); } } -- 2.39.5