grader report MDL-21367 when an item is unhidden its category should unhide to

This commit is contained in:
Andrew Davis 2010-02-03 02:31:46 +00:00
parent b9cc756ef3
commit d90aa63419
2 changed files with 24 additions and 0 deletions

View File

@ -1531,6 +1531,18 @@ class grade_category extends grade_object {
}
}
}
//if marking category visible make sure parent category is visible MDL-21367
if( !$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);
//}
}
}
}
/**

View File

@ -570,6 +570,18 @@ class grade_item extends grade_object {
}
}
}
//if marking item visible make sure category is visible MDL-21367
if( !$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);
//}
}
}
}
/**