]> git.mjollnir.org Git - moodle.git/commitdiff
course/index: Move categories around using move_category()
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:14:34 +0000 (07:14 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:14:34 +0000 (07:14 +0000)
Use the newfangled move_category() when moving categories
around, to ensure we Do The Right Thing in the backend,
decoupled from UI stuff.

course/index.php

index 9dad679ac95d08864b74e29afb7c74f59c7562af..92a2965f7fe9558a2d16e855b93a7df94e60afae 100644 (file)
     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));