category paths: MDL-18897 call fix_course_sortorder eveywhere we insert a category to set category.path and .depth

This commit is contained in:
tjhunt 2009-04-20 05:59:11 +00:00
parent 3bba572f0e
commit 7a9d505bb9
3 changed files with 3 additions and 0 deletions

View 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');
}

View File

@ -153,6 +153,7 @@
}
$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

View 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));
}
}