Skip to content

Commit

Permalink
MDL-46978 gradebook: Edit grade item changes visibility of category
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neis Araujo committed Oct 3, 2014
1 parent e26204c commit f9f37ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 2 additions & 5 deletions lib/grade/grade_category.php
Expand Up @@ -1691,14 +1691,11 @@ public function set_hidden($hidden, $cascade=false) {
}

//if marking category visible make sure parent category is visible MDL-21367
if( !$hidden ) {
if ($this->is_hidden() != $hidden) {
$category_array = grade_category::fetch_all(array('id'=>$this->parent));
if ($category_array && array_key_exists($this->parent, $category_array)) {
$category = $category_array[$this->parent];
//call set_hidden on the category regardless of whether it is hidden as its parent might be hidden
//if($category->is_hidden()) {
$category->set_hidden($hidden, false);
//}
$category->set_hidden($hidden, false);
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions lib/grade/grade_item.php
Expand Up @@ -594,14 +594,11 @@ public function set_hidden($hidden, $cascade=false) {
}

//if marking item visible make sure category is visible MDL-21367
if( !$hidden ) {
if ($this->is_hidden() != $hidden) {
$category_array = grade_category::fetch_all(array('id'=>$this->categoryid));
if ($category_array && array_key_exists($this->categoryid, $category_array)) {
$category = $category_array[$this->categoryid];
//call set_hidden on the category regardless of whether it is hidden as its parent might be hidden
//if($category->is_hidden()) {
$category->set_hidden($hidden, false);
//}
$category->set_hidden($hidden, false);
}
}
}
Expand Down

0 comments on commit f9f37ec

Please sign in to comment.