MDL-46978 gradebook: Edit grade item changes visibility of category

This commit is contained in:
Daniel Neis Araujo
2014-10-03 14:08:50 -03:00
parent e26204c0cd
commit f9f37ec8f4
2 changed files with 4 additions and 10 deletions
+2 -5
View File
@@ -1691,14 +1691,11 @@ class grade_category extends grade_object {
}
//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);
}
}
}
+2 -5
View File
@@ -594,14 +594,11 @@ class grade_item extends grade_object {
}
//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);
}
}
}