course/index: Move categories around using move_category()

Use the newfangled move_category() when moving categories
around, to ensure we Do The Right Thing in the backend,
decoupled from UI stuff.
This commit is contained in:
martinlanghoff
2007-09-19 07:14:34 +00:00
parent 19f601d178
commit 88903eeab9
+2 -1
View File
@@ -187,7 +187,8 @@
if (!empty($move) and ($moveto>=0) and confirm_sesskey()) {
if ($tempcat = get_record('course_categories', 'id', $move)) {
if ($tempcat->parent != $moveto) {
if (! set_field('course_categories', 'parent', $moveto, 'id', $tempcat->id)) {
$newp = get_record('course_categories', 'id', $moveto);
if (! move_category($tempcat, $newp)) {
notify('Could not update that category!');
} else {
rebuild_context_rel(get_context_instance(CONTEXT_COURSECAT, $move));