Skip to content

Commit

Permalink
course/index: Move categories around using move_category()
Browse files Browse the repository at this point in the history
Use the newfangled move_category() when moving categories
around, to ensure we Do The Right Thing in the backend,
decoupled from UI stuff.
  • Loading branch information
martinlanghoff committed Sep 19, 2007
1 parent 19f601d commit 88903ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion course/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 88903ee

Please sign in to comment.