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:22:58 +00:00
parent c50959fa54
commit a97f19333c
2 changed files with 25 additions and 1 deletions
+12
View File
@@ -1374,6 +1374,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);
//}
}
}
}
/**
+13 -1
View File
@@ -591,7 +591,7 @@ class grade_item extends grade_object {
function set_hidden($hidden, $cascade=false) {
$this->hidden = $hidden;
$this->update();
if ($cascade) {
if ($grades = grade_grade::fetch_all(array('itemid'=>$this->id))) {
foreach($grades as $grade) {
@@ -600,6 +600,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);
//}
}
}
}
/**