Skip to content

Commit

Permalink
MDL-13925
Browse files Browse the repository at this point in the history
Was not handling adding subcategories properly. Thanks to Dennis Protzek for the patch.

Merged from STABLE_19
  • Loading branch information
thepurpleblob committed Jul 23, 2008
1 parent e1eaf07 commit 488aa8f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion course/editcategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,20 @@
$categoryadd = optional_param('categoryadd', 0, PARAM_BOOL); // Enables the Add Category form
$categoryupdate = optional_param('categoryupdate', 0, PARAM_BOOL); // Enables the Edit Category form
$resort = optional_param('resort', 0, PARAM_BOOL);
$parent = optional_param('parent', 0, PARAM_INT );

if (!$site = get_site()) {
print_error("siteisnotdefined");
}

if ($categoryadd) { // Show Add category form: if $id is given, it is used as the parent category
if ($categoryadd and !$parent) { // Show Add category form: if $id is given, it is used as the parent category
$strtitle = get_string("addnewcategory");
$context = get_context_instance(CONTEXT_SYSTEM);
$category = null;
} elseif ($categoryadd and $parent) {
$strtitle = get_string("addnewcategory");
$context = get_context_instance(CONTEXT_COURSECAT,$parent);
$category = null;
} elseif (!is_null($id) && !$categoryadd) { // Show Edit category form: $id is given as the identifier of the category being edited
$strtitle = get_string("editcategorysettings");
$context = get_context_instance(CONTEXT_COURSECAT, $id);
Expand Down

0 comments on commit 488aa8f

Please sign in to comment.