Permalink
Browse files

MDL-21671, MOODLE_19_STABLE site level categroy manage capability whe…

…n edit category, credits to Vadim Dvorovenko
  • Loading branch information...
1 parent dc92d40 commit 5b6519cb42651a2629d93a9eb936492b8ee00d41 @dcai dcai committed with stronk7 Dec 20, 2010
Showing with 7 additions and 1 deletion.
  1. +7 −1 course/editcategory_form.php
@@ -9,11 +9,17 @@ function definition() {
$category = $this->_customdata;
// get list of categories to use as parents, with site as the first one
- $options = array(get_string('top'));
+ $options = array();
+ if (has_capability('moodle/category:manage', get_system_context()) || $category->parent == 0) {
+ $options[0] = get_string('top');
+ }
$parents = array();
if ($category->id) {
// Editing an existing category.
make_categories_list($options, $parents, 'moodle/category:manage', $category->id);
+ if (empty($options[$category->parent])) {
+ $options[$category->parent] = get_field('course_categories', 'name', 'id', $category->parent);
+ }
$strsubmit = get_string('savechanges');
} else {
// Making a new category

0 comments on commit 5b6519c

Please sign in to comment.