Permalink
Browse files

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

…unhide to
  • Loading branch information...
1 parent c50959f commit a97f19333c2958f906152703e6ddda52d65a19cc Andrew Davis committed Feb 3, 2010
Showing with 25 additions and 1 deletion.
  1. +12 −0 lib/grade/grade_category.php
  2. +13 −1 lib/grade/grade_item.php
@@ -1374,6 +1374,18 @@ function set_hidden($hidden, $cascade=false) {
}
}
}
+
+ //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);
+ //}
+ }
+ }
}
/**
@@ -591,7 +591,7 @@ function get_hidden() {
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 @@ function set_hidden($hidden, $cascade=false) {
}
}
}
+
+ //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);
+ //}
+ }
+ }
}
/**

0 comments on commit a97f193

Please sign in to comment.