]> git.mjollnir.org Git - moodle.git/commitdiff
category paths: MDL-18897 call fix_course_sortorder eveywhere we insert a category...
authortjhunt <tjhunt>
Mon, 20 Apr 2009 05:59:11 +0000 (05:59 +0000)
committertjhunt <tjhunt>
Mon, 20 Apr 2009 05:59:11 +0000 (05:59 +0000)
course/editcategory.php
course/index.php
lib/datalib.php

index 1b03cf1c5653f3d142d26c86e5d8a8c3e7c25c48..006406589442fcd52a31ce281f4fae3f6be5eb4e 100644 (file)
@@ -75,6 +75,7 @@ if ($mform->is_cancelled()) {
         }
         $newcategory->context = get_context_instance(CONTEXT_COURSECAT, $newcategory->id);
         mark_context_dirty($newcategory->context->path);
+        fix_course_sortorder(); // Required to build course_categories.depth and .path.
     }
     redirect('category.php?id='.$newcategory->id.'&categoryedit=on');
 }
index 6ea66f7baf401bc952c77478b3ccfececa2452c1..0613b082c6f2ed8b9f92963ad18bfe3c04941f91 100644 (file)
         }
         $tempcat->context = get_context_instance(CONTEXT_COURSECAT, $tempcat->id);
         mark_context_dirty('/'.SYSCONTEXTID);
+        fix_course_sortorder(); // Required to build course_categories.depth and .path.
     }
 
 /// Move a category to a new parent if required
index 3a04e29172f5c70e33d5ae0d60aa48624dcb79da..dcc863a7a9af17f167ddfc9c7b0d94b883d859ef 100644 (file)
@@ -1221,6 +1221,7 @@ function get_course_category($catid=0) {
             // make sure category context exists
             get_context_instance(CONTEXT_COURSECAT, $catid);
             mark_context_dirty('/'.SYSCONTEXTID);
+            fix_course_sortorder(); // Required to build course_categories.depth and .path.
             $category = $DB->get_record('course_categories', array('id'=>$catid));
         }
     }